mirror of
https://github.com/Yubico/yubikey-val.git
synced 2025-03-03 18:29:18 +01:00
Drop half baked functionality in ykval-munin-vallatency.
- plugin assumed URL uses a hostname (no static ips) and that hostname resolves to both ipv4 and ipv6. - if we want to differentiate stats between ipv4 and ipv6, we need to re-think this and do it in a smart way. - for now we prefer to allow cURL to pick whatever IP it resolves, and run the latency test on that. - signed off by Klas Lindfors.
This commit is contained in:
parent
2272f33659
commit
58ba93d35f
@ -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,
|
||||
|
@ -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";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user