diff options
-rw-r--r-- | plugins-root/check_icmp.c | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c index 99bd667f..39ca3024 100644 --- a/plugins-root/check_icmp.c +++ b/plugins-root/check_icmp.c | |||
@@ -1327,21 +1327,24 @@ finish(int sig) | |||
1327 | if (host->icmp_recv>1) { | 1327 | if (host->icmp_recv>1) { |
1328 | host->jitter=(host->jitter / (host->icmp_recv - 1)/1000); | 1328 | host->jitter=(host->jitter / (host->icmp_recv - 1)/1000); |
1329 | host->EffectiveLatency = (rta/1000) + host->jitter * 2 + 10; | 1329 | host->EffectiveLatency = (rta/1000) + host->jitter * 2 + 10; |
1330 | if (host->EffectiveLatency < 160) | 1330 | |
1331 | if (host->EffectiveLatency < 160) { | ||
1331 | R = 93.2 - (host->EffectiveLatency / 40); | 1332 | R = 93.2 - (host->EffectiveLatency / 40); |
1332 | else | 1333 | } else { |
1333 | R = 93.2 - ((host->EffectiveLatency - 120) / 10); | 1334 | R = 93.2 - ((host->EffectiveLatency - 120) / 10); |
1335 | } | ||
1336 | |||
1334 | R = R - (pl * 2.5); | 1337 | R = R - (pl * 2.5); |
1335 | if (R<0) R=0; | 1338 | if (R<0) R=0; |
1336 | host->score = R; | 1339 | host->score = R; |
1337 | host->mos= 1 + ((0.035) * R) + ((.000007) * R * (R-60) * (100-R)); | 1340 | host->mos= 1 + ((0.035) * R) + ((.000007) * R * (R-60) * (100-R)); |
1338 | } | 1341 | } else { |
1339 | else { | ||
1340 | host->jitter=0; | 1342 | host->jitter=0; |
1341 | host->jitter_min=0; | 1343 | host->jitter_min=0; |
1342 | host->jitter_max=0; | 1344 | host->jitter_max=0; |
1343 | host->mos=0; | 1345 | host->mos=0; |
1344 | } | 1346 | } |
1347 | |||
1345 | host->pl = pl; | 1348 | host->pl = pl; |
1346 | host->rta = rta; | 1349 | host->rta = rta; |
1347 | 1350 | ||
@@ -1358,56 +1361,55 @@ finish(int sig) | |||
1358 | this_status = STATE_CRITICAL; | 1361 | this_status = STATE_CRITICAL; |
1359 | status = STATE_CRITICAL; | 1362 | status = STATE_CRITICAL; |
1360 | host->rta_status=STATE_CRITICAL; | 1363 | host->rta_status=STATE_CRITICAL; |
1361 | } | 1364 | } else if(status!=STATE_CRITICAL && (rta >= warn.rta)) { |
1362 | else if(status!=STATE_CRITICAL && (rta >= warn.rta)) { | ||
1363 | THIS_STATUS_WARNING; | 1365 | THIS_STATUS_WARNING; |
1364 | status = STATE_WARNING; | 1366 | status = STATE_WARNING; |
1365 | host->rta_status=STATE_WARNING; | 1367 | host->rta_status=STATE_WARNING; |
1366 | } | 1368 | } |
1367 | } | 1369 | } |
1370 | |||
1368 | if (pl_mode) { | 1371 | if (pl_mode) { |
1369 | if(pl >= crit.pl) { | 1372 | if(pl >= crit.pl) { |
1370 | this_status = STATE_CRITICAL; | 1373 | this_status = STATE_CRITICAL; |
1371 | status = STATE_CRITICAL; | 1374 | status = STATE_CRITICAL; |
1372 | host->pl_status=STATE_CRITICAL; | 1375 | host->pl_status=STATE_CRITICAL; |
1373 | } | 1376 | } else if(status!=STATE_CRITICAL && (pl >= warn.pl)) { |
1374 | else if(status!=STATE_CRITICAL && (pl >= warn.pl)) { | ||
1375 | THIS_STATUS_WARNING; | 1377 | THIS_STATUS_WARNING; |
1376 | status = STATE_WARNING; | 1378 | status = STATE_WARNING; |
1377 | host->pl_status=STATE_WARNING; | 1379 | host->pl_status=STATE_WARNING; |
1378 | } | 1380 | } |
1379 | } | 1381 | } |
1382 | |||
1380 | if (jitter_mode) { | 1383 | if (jitter_mode) { |
1381 | if(host->jitter >= crit.jitter) { | 1384 | if(host->jitter >= crit.jitter) { |
1382 | this_status = STATE_CRITICAL; | 1385 | this_status = STATE_CRITICAL; |
1383 | status = STATE_CRITICAL; | 1386 | status = STATE_CRITICAL; |
1384 | host->jitter_status=STATE_CRITICAL; | 1387 | host->jitter_status=STATE_CRITICAL; |
1385 | } | 1388 | } else if(status!=STATE_CRITICAL && (host->jitter >= warn.jitter)) { |
1386 | else if(status!=STATE_CRITICAL && (host->jitter >= warn.jitter)) { | ||
1387 | THIS_STATUS_WARNING; | 1389 | THIS_STATUS_WARNING; |
1388 | status = STATE_WARNING; | 1390 | status = STATE_WARNING; |
1389 | host->jitter_status=STATE_WARNING; | 1391 | host->jitter_status=STATE_WARNING; |
1390 | } | 1392 | } |
1391 | } | 1393 | } |
1394 | |||
1392 | if (mos_mode) { | 1395 | if (mos_mode) { |
1393 | if(host->mos <= crit.mos) { | 1396 | if(host->mos <= crit.mos) { |
1394 | this_status = STATE_CRITICAL; | 1397 | this_status = STATE_CRITICAL; |
1395 | status = STATE_CRITICAL; | 1398 | status = STATE_CRITICAL; |
1396 | host->mos_status=STATE_CRITICAL; | 1399 | host->mos_status=STATE_CRITICAL; |
1397 | } | 1400 | } else if(status!=STATE_CRITICAL && (host->mos <= warn.mos)) { |
1398 | else if(status!=STATE_CRITICAL && (host->mos <= warn.mos)) { | ||
1399 | THIS_STATUS_WARNING; | 1401 | THIS_STATUS_WARNING; |
1400 | status = STATE_WARNING; | 1402 | status = STATE_WARNING; |
1401 | host->mos_status=STATE_WARNING; | 1403 | host->mos_status=STATE_WARNING; |
1402 | } | 1404 | } |
1403 | } | 1405 | } |
1406 | |||
1404 | if (score_mode) { | 1407 | if (score_mode) { |
1405 | if(host->score <= crit.score) { | 1408 | if(host->score <= crit.score) { |
1406 | this_status = STATE_CRITICAL; | 1409 | this_status = STATE_CRITICAL; |
1407 | status = STATE_CRITICAL; | 1410 | status = STATE_CRITICAL; |
1408 | host->score_status=STATE_CRITICAL; | 1411 | host->score_status=STATE_CRITICAL; |
1409 | } | 1412 | } else if(status!=STATE_CRITICAL && (host->score <= warn.score)) { |
1410 | else if(status!=STATE_CRITICAL && (host->score <= warn.score)) { | ||
1411 | THIS_STATUS_WARNING; | 1413 | THIS_STATUS_WARNING; |
1412 | status = STATE_WARNING; | 1414 | status = STATE_WARNING; |
1413 | host->score_status=STATE_WARNING; | 1415 | host->score_status=STATE_WARNING; |
@@ -1416,8 +1418,7 @@ finish(int sig) | |||
1416 | 1418 | ||
1417 | if (this_status == STATE_WARNING) { | 1419 | if (this_status == STATE_WARNING) { |
1418 | hosts_warn++; | 1420 | hosts_warn++; |
1419 | } | 1421 | } else if (this_status == STATE_OK) { |
1420 | else if (this_status == STATE_OK) { | ||
1421 | hosts_ok++; | 1422 | hosts_ok++; |
1422 | } | 1423 | } |
1423 | 1424 | ||