Setup Command Management for check_json.pl

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
[email protected]
Posts: 7
Joined: Fri Aug 14, 2015 1:42 pm

Setup Command Management for check_json.pl

Post by [email protected] »

I'm new to Nagios XI , so I'm hoping someone can help me along on my first custom command check setup and then adding service for this command_check. It is for the check_json.pl plugin, which we already installed and confirmed that it is working from Nagios XI terminal session. I'm looking for steps on how to setup the command check properly for the check_json.pl plugin ( info below ) , any/all help is much appreciated, thanks. Really the command line * setup itself is confusing for this check -


check_json 0.5 [https://github.com/c-kr/check_json]

This nagios plugin is free software, and comes with ABSOLUTELY NO WARRANTY.
It may be used, redistributed and/or modified under the terms of the GNU
General Public Licence (see http://www.fsf.org/licensing/licenses/gpl.txt).

Nagios plugin to check JSON attributes via http(s)

Usage: check_json -u|--url <URL> -a|--attributes <attributes> [ -c|--critical <thresholds> ] [ -w|--warning <thresholds> ] [ -p|--perfvars <fields> ] [ -o|--outputvars <fields> ] [ -t|--timeout <timeout> ] [ -d|--divisor <divisor> ] [ -m|--metadata <content> ] [ -T|--contenttype <content-type> ] [ --ignoressl ] [ -h|--help ]

-?, --usage
Print usage information
-h, --help
Print detailed help screen
-V, --version
Print version information
--extra-opts=[section][@file]
Read options from an ini file. See http://nagiosplugins.org/extra-opts
for usage and examples.
-u, --url http://192.168.5.10:9332/local_stats
-a, --attributes {shares}->{dead},{shares}->{uptime}
-d, --divisor 1000000
-w, --warning INTEGER:INTEGER . See http://nagiosplug.sourceforge.net/devel ... HOLDFORMAT for the threshold format.
-c, --critical INTEGER:INTEGER . See http://nagiosplug.sourceforge.net/devel ... HOLDFORMAT for the threshold format.
-p, --perfvars eg. '* or {shares}->{dead},{shares}->{live}'
CSV list of fields from JSON response to include in perfdata
-o, --outputvars eg. '* or {status_message}'
CSV list of fields output in status message, same syntax as perfvars
-m|--metadata '{"name":"value"}'
RESTful request metadata in JSON format
-T, --contenttype application/json
Content-type accepted if different from application/json
--ignoressl
Ignore bad ssl certificates
-t, --timeout=INTEGER
Seconds before plugin times out (default: 15)
-v, --verbose
Show details for command-line debugging (can repeat up to 3 times)

Example:
check_json.pl --url http://192.168.5.10:9332/local_stats --attributes '{shares}->{dead}' --warning :5 --critical :10 --perfvars '{shares}->{dead},{shares}->{live}' --outputvars '{status_message}'
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Setup Command Management for check_json.pl

Post by hsmith »

[email protected] wrote:I'm new to Nagios XI , so I'm hoping someone can help me along on my first custom command check setup and then adding service for this command_check. It is for the check_json.pl plugin, which we already installed and confirmed that it is working from Nagios XI terminal session. I'm looking for steps on how to setup the command check properly for the check_json.pl plugin ( info below ) , any/all help is much appreciated, thanks. Really the command line * setup itself is confusing for this check -


check_json 0.5 [https://github.com/c-kr/check_json]

This nagios plugin is free software, and comes with ABSOLUTELY NO WARRANTY.
It may be used, redistributed and/or modified under the terms of the GNU
General Public Licence (see http://www.fsf.org/licensing/licenses/gpl.txt).

Nagios plugin to check JSON attributes via http(s)

Usage: check_json -u|--url <URL> -a|--attributes <attributes> [ -c|--critical <thresholds> ] [ -w|--warning <thresholds> ] [ -p|--perfvars <fields> ] [ -o|--outputvars <fields> ] [ -t|--timeout <timeout> ] [ -d|--divisor <divisor> ] [ -m|--metadata <content> ] [ -T|--contenttype <content-type> ] [ --ignoressl ] [ -h|--help ]

-?, --usage
Print usage information
-h, --help
Print detailed help screen
-V, --version
Print version information
--extra-opts=[section][@file]
Read options from an ini file. See http://nagiosplugins.org/extra-opts
for usage and examples.
-u, --url http://192.168.5.10:9332/local_stats
-a, --attributes {shares}->{dead},{shares}->{uptime}
-d, --divisor 1000000
-w, --warning INTEGER:INTEGER . See http://nagiosplug.sourceforge.net/devel ... HOLDFORMAT for the threshold format.
-c, --critical INTEGER:INTEGER . See http://nagiosplug.sourceforge.net/devel ... HOLDFORMAT for the threshold format.
-p, --perfvars eg. '* or {shares}->{dead},{shares}->{live}'
CSV list of fields from JSON response to include in perfdata
-o, --outputvars eg. '* or {status_message}'
CSV list of fields output in status message, same syntax as perfvars
-m|--metadata '{"name":"value"}'
RESTful request metadata in JSON format
-T, --contenttype application/json
Content-type accepted if different from application/json
--ignoressl
Ignore bad ssl certificates
-t, --timeout=INTEGER
Seconds before plugin times out (default: 15)
-v, --verbose
Show details for command-line debugging (can repeat up to 3 times)

Example:
check_json.pl --url http://192.168.5.10:9332/local_stats --attributes '{shares}->{dead}' --warning :5 --critical :10 --perfvars '{shares}->{dead},{shares}->{live}' --outputvars '{status_message}'
Is the command you posted working in your environment? You said that you have it working in the XI command line. If this is the command that you have working, I can help you break it down into a service check. Need that information first, though.

Thanks!
Former Nagios Employee.
me.
Locked