mirror of
https://github.com/Yubico/yubikey-val.git
synced 2024-12-03 03:24:15 +01:00
Detect timeouts and errors in curl (such as resolver failures).
This commit is contained in:
parent
3954527d61
commit
2c9b57a0a0
@ -46,6 +46,12 @@ echo "multigraph yk_latency\n";
|
|||||||
foreach ($ksms as $ksm) {
|
foreach ($ksms as $ksm) {
|
||||||
$shortksm = url2shortname ($ksm);
|
$shortksm = url2shortname ($ksm);
|
||||||
$time = `curl --silent --write-out '%{time_total}' --max-time 3 '$ksm' -o /dev/null`;
|
$time = `curl --silent --write-out '%{time_total}' --max-time 3 '$ksm' -o /dev/null`;
|
||||||
|
if (preg_match("/^3\./", $time)) {
|
||||||
|
$time = "timeout";
|
||||||
|
}
|
||||||
|
if (preg_match("/^0\.000/", $time)) {
|
||||||
|
$time = "error";
|
||||||
|
}
|
||||||
echo "${shortksm}_avgwait.value $time\n";
|
echo "${shortksm}_avgwait.value $time\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,10 +52,16 @@ echo "multigraph ykval_latency\n";
|
|||||||
foreach ($urls as $url) {
|
foreach ($urls as $url) {
|
||||||
$shortname = url2shortname ($url);
|
$shortname = url2shortname ($url);
|
||||||
$cmd = "--user-agent ykval-munin-vallatency/1.0 --silent --write-out '%{time_total}' --max-time 3 '$url' -o /dev/null";
|
$cmd = "--user-agent ykval-munin-vallatency/1.0 --silent --write-out '%{time_total}' --max-time 3 '$url' -o /dev/null";
|
||||||
$ipv4time = `curl --ipv4 $cmd`;
|
foreach (array('ipv4', 'ipv6') as $ipv) {
|
||||||
echo "ipv4${shortname}_avgwait.value $ipv4time\n";
|
$time = `curl --$ipv $cmd`;
|
||||||
$ipv6time = `curl --ipv6 $cmd`;
|
if (preg_match("/^3\./", $time)) {
|
||||||
echo "ipv6${shortname}_avgwait.value $ipv6time\n";
|
$time = "timeout";
|
||||||
|
}
|
||||||
|
if (preg_match("/^0\.000/", $time)) {
|
||||||
|
$time = "error";
|
||||||
|
}
|
||||||
|
echo "$ipv${shortname}_avgwait.value $time\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#%# family=auto
|
#%# family=auto
|
||||||
|
Loading…
Reference in New Issue
Block a user