Check_json Question -> status API UNKNOWN

Hello, everyone.
I have a question about the check_json plugin ( )

I always get the message during my tests:

“Check JSON status API UNKNOWN - Content type is not JSON: text/plain;charset=utf-8”

Do I need additional plugins?
What does the message really tell me, because the test files are undoubtedly json files?

What does a json file have to look like to be accepted?

Thanks for the help and greetings

I was able to narrow the problem down a bit myself.
The file to be read must apparently have the extension .json in the standard call.
Without it, the plugin will not recognize the file as json.

Does anyone know if this can be changed by parameter?
Or if there are other ways to make the plugin recognize files without extension as json?

Thanks and best regards


According to the source code of the plugin, it checks the headers of the stream.

if ($response->is_success) {
    if (!($response->header("content-type") =~ $np->opts->contenttype)) {
        $np->nagios_exit(UNKNOWN,"Content type is not JSON: ".$response->header("content-type"));

Don’t know how it goes for local files though.


Hello, George.

Thanks for answering.
But it’s not about calling a local file (although this would be a nice thing to do).

The call is made via http(s).
for example: https://hostxyz/test

Without file extension there is an error message.
If you then rename this file to test.json and you call https://hostxyz/test.json it works.


According to the error you have, the headers of the stream say “text/plain” instead of “application/json”.

Check the URL with curl or a similar tool to confirm this. I am not sure on how to fix this but one way could be to edit out the script part checking for this. The best approach of course would be to fix this in the webserver/application level.


Hello, George,

thank you… and in the meantime I have also found a switch.
-T or --contenttype
I should just read the help properly. :thinking:

In my case, the call -T text/plain;charset=utf-8.

Thanks and regards.