summaryrefslogtreecommitdiffstats
path: root/plugins-root/check_icmp.c
diff options
context:
space:
mode:
authorroot <dirty.ren@gmail.com>2017-08-21 09:42:10 -0300
committerroot <dirty.ren@gmail.com>2017-08-21 09:42:10 -0300
commitf5c5a7438fa34f2ee2c0b9914806f9a26b56ba59 (patch)
treee9dc3a0122cde9aa667657ad4bd22093cfd8cbf7 /plugins-root/check_icmp.c
parentab7d056ee36c064ae0a75fb0029cb8cf20df5b66 (diff)
downloadmonitoring-plugins-f5c5a7438fa34f2ee2c0b9914806f9a26b56ba59.tar.gz
Clean up plugin exit
Diffstat (limited to 'plugins-root/check_icmp.c')
-rw-r--r--plugins-root/check_icmp.c43
1 files changed, 18 insertions, 25 deletions
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c
index d68c4e0d..2ad644ec 100644
--- a/plugins-root/check_icmp.c
+++ b/plugins-root/check_icmp.c
@@ -1090,7 +1090,6 @@ finish(int sig)
1090 int hosts_ok = 0; 1090 int hosts_ok = 0;
1091 int hosts_warn = 0; 1091 int hosts_warn = 0;
1092 double R; 1092 double R;
1093 int shown=0;
1094 1093
1095 alarm(0); 1094 alarm(0);
1096 if(debug > 1) printf("finish(%d) called\n", sig); 1095 if(debug > 1) printf("finish(%d) called\n", sig);
@@ -1255,64 +1254,58 @@ finish(int sig)
1255 } 1254 }
1256 } 1255 }
1257 else { /* !icmp_recv */ 1256 else { /* !icmp_recv */
1258 printf("%s: ", host->name); 1257 printf("%s ", host->name);
1259 /* rta text output */ 1258 /* rta text output */
1260 if (rta_mode) { 1259 if (rta_mode) {
1261 shown=1;
1262 if (status == STATE_OK) 1260 if (status == STATE_OK)
1263 printf("%s rta %0.3fms",(shown==1)?",":"", host->rta / 1000); 1261 printf("rta %0.3fms", host->rta / 1000);
1264 else if (status==STATE_WARNING && host->rta_status==status) 1262 else if (status==STATE_WARNING && host->rta_status==status)
1265 printf("%s rta %0.3fms > %0.3fms",(shown==1)?",":"", (float)host->rta / 1000, (float)warn.rta/1000); 1263 printf("rta %0.3fms > %0.3fms", (float)host->rta / 1000, (float)warn.rta/1000);
1266 else if (status==STATE_CRITICAL && host->rta_status==status) 1264 else if (status==STATE_CRITICAL && host->rta_status==status)
1267 printf("%s rta %0.3fms > %0.3fms",(shown==1)?",":"", (float)host->rta / 1000, (float)crit.rta/1000); 1265 printf("rta %0.3fms > %0.3fms", (float)host->rta / 1000, (float)crit.rta/1000);
1268 } 1266 }
1269 /* pl text output */ 1267 /* pl text output */
1270 if (pl_mode) { 1268 if (pl_mode) {
1271 shown=1;
1272 if (status == STATE_OK) 1269 if (status == STATE_OK)
1273 printf("%s lost %u%%",(shown==1)?",":"", host->pl); 1270 printf("lost %u%%", host->pl);
1274 else if (status==STATE_WARNING && host->pl_status==status) 1271 else if (status==STATE_WARNING && host->pl_status==status)
1275 printf("%s lost %u%% > %u%%",(shown==1)?",":"", host->pl, warn.pl); 1272 printf("lost %u%% > %u%%", host->pl, warn.pl);
1276 else if (status==STATE_CRITICAL && host->pl_status==status) 1273 else if (status==STATE_CRITICAL && host->pl_status==status)
1277 printf("%s lost %u%% > %u%%",(shown==1)?",":"", host->pl, crit.pl); 1274 printf("lost %u%% > %u%%", host->pl, crit.pl);
1278 } 1275 }
1279 /* jitter text output */ 1276 /* jitter text output */
1280 if (jitter_mode) { 1277 if (jitter_mode) {
1281 shown=1;
1282 if (status == STATE_OK) 1278 if (status == STATE_OK)
1283 printf("%s jitter %0.3fms",(shown==1)?",":"", (float)host->jitter); 1279 printf("jitter %0.3fms", (float)host->jitter);
1284 else if (status==STATE_WARNING && host->jitter_status==status) 1280 else if (status==STATE_WARNING && host->jitter_status==status)
1285 printf("%s jitter %0.3fms > %0.3fms",(shown==1)?",":"", (float)host->jitter, warn.jitter); 1281 printf("jitter %0.3fms > %0.3fms", (float)host->jitter, warn.jitter);
1286 else if (status==STATE_CRITICAL && host->jitter_status==status) 1282 else if (status==STATE_CRITICAL && host->jitter_status==status)
1287 printf("%s jitter %0.3fms > %0.3fms",(shown==1)?",":"", (float)host->jitter, crit.jitter); 1283 printf("jitter %0.3fms > %0.3fms", (float)host->jitter, crit.jitter);
1288 } 1284 }
1289 /* mos text output */ 1285 /* mos text output */
1290 if (mos_mode) { 1286 if (mos_mode) {
1291 shown=1;
1292 if (status == STATE_OK) 1287 if (status == STATE_OK)
1293 printf("%s MOS %0.1f",(shown==1)?",":"", (float)host->mos); 1288 printf("MOS %0.1f", (float)host->mos);
1294 else if (status==STATE_WARNING && host->mos_status==status) 1289 else if (status==STATE_WARNING && host->mos_status==status)
1295 printf("%s MOS %0.1f < %0.1f",(shown==1)?",":"", (float)host->mos, (float)warn.mos); 1290 printf("MOS %0.1f < %0.1f", (float)host->mos, (float)warn.mos);
1296 else if (status==STATE_CRITICAL && host->mos_status==status) 1291 else if (status==STATE_CRITICAL && host->mos_status==status)
1297 printf("%s MOS %0.1f < %0.1f",(shown==1)?",":"", (float)host->mos, (float)crit.mos); 1292 printf("MOS %0.1f < %0.1f", (float)host->mos, (float)crit.mos);
1298 } 1293 }
1299 /* score text output */ 1294 /* score text output */
1300 if (score_mode) { 1295 if (score_mode) {
1301 shown=1;
1302 if (status == STATE_OK) 1296 if (status == STATE_OK)
1303 printf("%s Score %u",(shown==1)?",":"", (int)host->score); 1297 printf("Score %u", (int)host->score);
1304 else if (status==STATE_WARNING && host->score_status==status ) 1298 else if (status==STATE_WARNING && host->score_status==status )
1305 printf("%s Score %u < %u",(shown==1)?",":"", (int)host->score, (int)warn.score); 1299 printf("Score %u < %u", (int)host->score, (int)warn.score);
1306 else if (status==STATE_CRITICAL && host->score_status==status ) 1300 else if (status==STATE_CRITICAL && host->score_status==status )
1307 printf("%s Score %u < %u",(shown==1)?",":"", (int)host->score, (int)crit.score); 1301 printf("Score %u < %u", (int)host->score, (int)crit.score);
1308 } 1302 }
1309 /* order statis text output */ 1303 /* order statis text output */
1310 if (order_mode) { 1304 if (order_mode) {
1311 shown=1;
1312 if (status == STATE_OK) 1305 if (status == STATE_OK)
1313 printf("%s Packets in order",(shown==1)?",":""); 1306 printf("Packets in order");
1314 else if (status==STATE_CRITICAL && host->order_status==status) 1307 else if (status==STATE_CRITICAL && host->order_status==status)
1315 printf("%s Packets out of order",(shown==1)?",":""); 1308 printf("Packets out of order");
1316 } 1309 }
1317 } 1310 }
1318 host = host->next; 1311 host = host->next;