From b8e98e6049d0e0b38092a57a9515a831a137e41a Mon Sep 17 00:00:00 2001 From: Jean Paul Galea Date: Tue, 8 Sep 2015 14:47:34 +0200 Subject: [PATCH] Add shortname failure checks for munin plugins. --- ykval-munin-ksmlatency.php | 8 ++++++++ ykval-munin-queuelength.php | 9 +++++++++ ykval-munin-vallatency.php | 4 ++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ykval-munin-ksmlatency.php b/ykval-munin-ksmlatency.php index b33731f..621c5ef 100755 --- a/ykval-munin-ksmlatency.php +++ b/ykval-munin-ksmlatency.php @@ -42,6 +42,14 @@ require_once 'ykval-common.php'; $urls = otp2ksmurls('ccccccccfnkjtvvijktfrvvginedlbvudjhjnggndtck', 16); $shortnames = array_map('shortname', $urls); +foreach($shortnames as $shortname) +{ + if ($shortname === FALSE) + { + echo "Cannot parse URL from ksm url list\n"; + exit(1); + } +} if ($argc == 2 && strcmp($argv[1], 'autoconf') == 0) { diff --git a/ykval-munin-queuelength.php b/ykval-munin-queuelength.php index b5ab29e..dbfdc85 100755 --- a/ykval-munin-queuelength.php +++ b/ykval-munin-queuelength.php @@ -38,7 +38,16 @@ require_once 'ykval-config.php'; require_once 'ykval-db.php'; $urls = $baseParams['__YKVAL_SYNC_POOL__']; + $shortnames = array_map("shortname", $urls); +foreach($shortnames as $shortname) +{ + if ($shortname === FALSE) + { + echo "Cannot parse URL from sync pool list\n"; + exit(1); + } +} if ($argc == 2 && strcmp($argv[1], "autoconf") == 0) { diff --git a/ykval-munin-vallatency.php b/ykval-munin-vallatency.php index 4c466ef..3d5b225 100755 --- a/ykval-munin-vallatency.php +++ b/ykval-munin-vallatency.php @@ -40,9 +40,9 @@ require_once 'ykval-common.php'; $urls = $baseParams['__YKVAL_SYNC_POOL__']; $shortnames = array_map('shortname', $urls); -foreach($shortnames as $val) +foreach($shortnames as $shortname) { - if ($val === FALSE) + if ($shortname === FALSE) { echo "Cannot parse URL from sync pool list\n"; exit(1);