mirror of
https://github.com/Yubico/yubikey-val.git
synced 2025-02-20 21:54:20 +01:00
simple munin plugin for response types
This commit is contained in:
parent
0f0a23694a
commit
42e13cd43b
48
ykval-munin-responses.pl
Executable file
48
ykval-munin-responses.pl
Executable file
@ -0,0 +1,48 @@
|
||||
#!/usr/bin/perl
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my @types = qw/OK BAD_OTP MISSING_PARAMETER BACKEND_ERROR BAD_SIGNATURE DELAYED_OTP NO_SUCH_CLIENT NOT_ENOUGH_ANSWERS REPLAYED_REQUEST REPLAYED_OTP OPERATION_NOT_ALLOWED/;
|
||||
my $logfile = "/var/log/yubikey-val-server-php.log";
|
||||
|
||||
if(@ARGV > 0) {
|
||||
if($ARGV[0] eq "autoconf") {
|
||||
print "yes\n";
|
||||
exit 0;
|
||||
} elsif($ARGV[0] eq "config") {
|
||||
print "multigraph yk_responses\n";
|
||||
print "graph_title YK-VAL response types\n";
|
||||
print "graph_vlabel responses\n";
|
||||
print "graph_category ykval\n";
|
||||
|
||||
foreach my $type (@types) {
|
||||
print "${type}.label ${type}\n";
|
||||
print "${type}.type DERIVE\n";
|
||||
print "${type}.info Responses\n";
|
||||
print "${type}.min 0\n";
|
||||
print "${type}.draw LINE1\n";
|
||||
}
|
||||
exit 0
|
||||
}
|
||||
print "unknown command '${ARGV[0]}'\n";
|
||||
exit 1
|
||||
}
|
||||
|
||||
my %statuses = map { $_ => 0 } @types;
|
||||
|
||||
my $reg = qr/status=([A-Z_]+)/;
|
||||
open (LOGFILE, "grep 'ykval-verify.*Response' $logfile |");
|
||||
while(<LOGFILE>) {
|
||||
next unless /$reg/;
|
||||
$statuses{$1}++;
|
||||
}
|
||||
close LOGFILE;
|
||||
|
||||
print "multigraph yk_responses\n";
|
||||
foreach my $type (@types) {
|
||||
print "${type}.value ${statuses{$type}}\n";
|
||||
}
|
||||
exit 0
|
Loading…
x
Reference in New Issue
Block a user