diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2020-02-18 13:59:45 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2020-02-18 13:59:45 +0200 |
commit | f6be3cd55490eab72be3e497877b5de5758d9911 (patch) | |
tree | 8f186b5ba2438448051d00a30d6bfd380597498e | |
parent | 2fd25b47e87977e9ec60ea1fc3d5d82a10572f55 (diff) | |
download | ping903-f6be3cd55490eab72be3e497877b5de5758d9911.tar.gz ping903-f6be3cd55490eab72be3e497877b5de5758d9911.tar.bz2 |
Fix ping903q in nagios check mode.
This was broken in a744738c.
* src/ping903q.c (nagios_check): Fix handling of the status attribute.
-rw-r--r-- | src/ping903q.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/ping903q.c b/src/ping903q.c index b8a1053..53358b4 100644 --- a/src/ping903q.c +++ b/src/ping903q.c @@ -675,8 +675,12 @@ nagios_check(struct json_value *obj, void *data) jv = ejson_get(obj, "name", json_string); name = jv->v.s; - jv = ejson_get(obj, "status", json_bool); - if (!jv->v.b) { + jv = ejson_get(obj, "status", json_string); + if (strcmp(jv->v.s, "init") == 0) { + printf("PING UNKNOWN - waiting for data to arrive\n"); + exit(EX_NAGIOS_UNKNOWN); + } + if (strcmp(jv->v.s, "invalid") == 0) { printf("PING CRITICAL - Packet loss = 100%%"); print_perfdata(cd->cth.round_trip, 100.0, cd); exit(EX_NAGIOS_CRITICAL); |