mirror of
https://github.com/Yubico/yubikey-val.git
synced 2025-02-08 03:54:20 +01:00
Rewrite ykval-munin-ksmlatency plugin.
- same as 1e4da5dac66210a85cf0e3bee739a6839edeeb46, but for ksm latency plugin.
This commit is contained in:
parent
1e4da5dac6
commit
f566a75dcd
@ -41,14 +41,10 @@ require_once 'ykval-common.php';
|
|||||||
# otp and client ID should be moved to a munin environment variable
|
# otp and client ID should be moved to a munin environment variable
|
||||||
$urls = otp2ksmurls('ccccccccfnkjtvvijktfrvvginedlbvudjhjnggndtck', 16);
|
$urls = otp2ksmurls('ccccccccfnkjtvvijktfrvvginedlbvudjhjnggndtck', 16);
|
||||||
|
|
||||||
$shortnames = array_map('shortname', $urls);
|
if (($endpoints = endpoints($urls)) === FALSE)
|
||||||
foreach($shortnames as $shortname)
|
|
||||||
{
|
{
|
||||||
if ($shortname === FALSE)
|
echo "Cannot parse URLs from ksm url list\n";
|
||||||
{
|
exit(1);
|
||||||
echo "Cannot parse URL from ksm url list\n";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($argc == 2 && strcmp($argv[1], 'autoconf') == 0)
|
if ($argc == 2 && strcmp($argv[1], 'autoconf') == 0)
|
||||||
@ -65,25 +61,30 @@ if ($argc == 2 && strcmp($argv[1], 'config') == 0)
|
|||||||
echo "graph_category ykval\n";
|
echo "graph_category ykval\n";
|
||||||
echo "graph_width 400\n";
|
echo "graph_width 400\n";
|
||||||
|
|
||||||
foreach ($shortnames as $shortname)
|
foreach ($endpoints as $endpoint)
|
||||||
{
|
{
|
||||||
echo "${shortname}_avgwait.label ${shortname}\n";
|
list ($internal, $label, $url) = $endpoint;
|
||||||
echo "${shortname}_avgwait.type GAUGE\n";
|
|
||||||
echo "${shortname}_avgwait.info Average wait time for KSM decrypt\n";
|
echo "${internal}_avgwait.label ${label}\n";
|
||||||
echo "${shortname}_avgwait.min 0\n";
|
echo "${internal}_avgwait.type GAUGE\n";
|
||||||
echo "${shortname}_avgwait.draw LINE1\n";
|
echo "${internal}_avgwait.info Average wait time for KSM decrypt\n";
|
||||||
|
echo "${internal}_avgwait.min 0\n";
|
||||||
|
echo "${internal}_avgwait.draw LINE1\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "multigraph ykval_ksmlatency\n";
|
echo "multigraph ykval_ksmlatency\n";
|
||||||
foreach ($urls as $url)
|
|
||||||
|
foreach ($endpoints as $endpoint)
|
||||||
{
|
{
|
||||||
$shortname = shortname($url);
|
list ($internal, $label, $url) = $endpoint;
|
||||||
|
|
||||||
if (($total_time = total_time($url)) === FALSE)
|
if (($total_time = total_time($url)) === FALSE)
|
||||||
$total_time = 'error';
|
$total_time = 'error';
|
||||||
|
|
||||||
echo "${shortname}_avgwait.value ${total_time}\n";
|
echo "${internal}_avgwait.value ${total_time}\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user