diff --git a/ykval-common.php b/ykval-common.php index c93ab40..bfff702 100644 --- a/ykval-common.php +++ b/ykval-common.php @@ -329,33 +329,13 @@ if (function_exists('hash_equals') === FALSE) * Return the total time taken to receive a response from a URL. * * @argument $url string - * @argument $ipresolve string whatever|ipv4|ipv6 * * @return float|bool seconds or false on failure */ -function total_time ($url, $ipresolve = 'whatever') +function total_time ($url) { - switch ($ipresolve) - { - case 'whatever': - $ipresolve = CURL_IPRESOLVE_WHATEVER; - break; - - case 'ipv4': - $ipresolve = CURL_IPRESOLVE_V4; - break; - - case 'ipv6': - $ipresolve = CURL_IPRESOLVE_V6; - break; - - default: - return false; - } - $opts = array( CURLOPT_URL => $url, - CURLOPT_IPRESOLVE => $ipresolve, CURLOPT_TIMEOUT => 3, CURLOPT_FORBID_REUSE => TRUE, CURLOPT_FRESH_CONNECT => TRUE, diff --git a/ykval-munin-vallatency.php b/ykval-munin-vallatency.php index eef706b..437b749 100755 --- a/ykval-munin-vallatency.php +++ b/ykval-munin-vallatency.php @@ -67,17 +67,11 @@ if ($argc == 2 && strcmp($argv[1], "config") == 0) foreach ($shortnames as $shortname) { - echo "ipv4${shortname}_avgwait.label IPv4-${shortname}\n"; - echo "ipv4${shortname}_avgwait.type GAUGE\n"; - echo "ipv4${shortname}_avgwait.info Average VAL round-trip latency\n"; - echo "ipv4${shortname}_avgwait.min 0\n"; - echo "ipv4${shortname}_avgwait.draw LINE1\n"; - - echo "ipv6${shortname}_avgwait.label IPv6-${shortname}\n"; - echo "ipv6${shortname}_avgwait.type GAUGE\n"; - echo "ipv6${shortname}_avgwait.info Average VAL round-trip latency\n"; - echo "ipv6${shortname}_avgwait.min 0\n"; - echo "ipv6${shortname}_avgwait.draw LINE1\n"; + echo "${shortname}_avgwait.label ${shortname}\n"; + echo "${shortname}_avgwait.type GAUGE\n"; + echo "${shortname}_avgwait.info Average VAL round-trip latency\n"; + echo "${shortname}_avgwait.min 0\n"; + echo "${shortname}_avgwait.draw LINE1\n"; } exit(0); @@ -88,11 +82,8 @@ foreach ($urls as $url) { $shortname = url2shortname($url); - foreach (array('ipv4', 'ipv6') as $ipv) - { - if (($total_time = total_time($url, $ipv)) === FALSE) - $total_time = 'error'; + if (($total_time = total_time($url)) === FALSE) + $total_time = 'error'; - echo "$ipv${shortname}_avgwait.value $total_time\n"; - } + echo "${shortname}_avgwait.value $total_time\n"; }