I am using a check_json.pl plugin on EMC XtremIO Cluster to get free space.
This is how I worked through it. Actually, this is how I do all my plugin related work.
1. Use command line to get data and see how it looks. Find the piece you are wanting to monitor.
2. Get the plugin to work from the command line using the syntax figured out from step 1.
3. Transplant to the GUI.
Start by using curl as a basic test to see if we get any response. Once we have username, password, and URL figured out we can move to the actual plugin. It is good to see it work using a basic tool before you get fancy.
This a shortened version of the response.
Pay attention to "content" and "free-ud-ssd-space-in-percent": 35
as those define the data I want to use.
Code: Select all
curl -sk https://<username>:<password>@<Host-IP-address>/api/json/types/clusters/1
{
"content": {
"wr-iops-gt1mb": "0",
"rd-bw-512b": "0",
"free-ud-ssd-space-in-percent": 35,
"wr-latency-256kb": "1954",
"rd-iops": "1504",
"small-bw": "29064"
},
"links": [
{
"index": 1,
"href": "https://131.198.26.23/api/json/types/clusters/1",
"rel": "self"
}
]
}
Once I know I have working syntax I move to the plugin.
The Plugin named check_json.pl will use this syntax from the command line. Trial and error until it looks the way you need it.
(Notice content and free-ud-ssd-space-in-percent)
Code: Select all
./check_json.pl --url "https://<username>:<password>@<Host-IP-address>/api/json/types/clusters/1" --ignoressl --attributes '{content}->{"free-ud-ssd-space-in-percent"}' --perfvars '{content}->{"free-ud-ssd-space-in-percent"}' --warning 4: --critical 2:
Check JSON status API OK - free-ud-ssd-space-in-percent: 35 | free-ud-ssd-space-in-percent=35;4:;2:
Then I transplant to the GUI.
Check_command = check_json
Code: Select all
/usr/local/nagios/libexec/check_json.pl $ARG1$ $ARG2$ $ARG3$ $ARG4$ $ARG5$ $ARG6$ $ARG7$ $ARG8$
Service Definition
Service args
Code: Select all
$ARG1$ = --url "https://[username]:[password]@$HOSTADDRESS$:443/api/json/types/clusters/1"
$ARG2$ = --ignoressl
$ARG3$ = --attributes '{content}->{"free-ud-ssd-space-in-percent"}'
$ARG4$ = --perfvars '{content}->{"free-ud-ssd-space-in-percent"}'
$ARG5$ = --warning 4:
$ARG6$ = --critical 2:
I am pretty certain that I got the plugin from here
https://github.com/c-kr/check_json
I hope this helps get you successful.
Steve B