mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 02:51:03 +00:00
Initial version
This commit is contained in:
parent
45fd9c154b
commit
6773191cc0
1 changed files with 52 additions and 0 deletions
52
plugins/other/nsr_device_writing
Executable file
52
plugins/other/nsr_device_writing
Executable file
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/perl
|
||||
use strict;
|
||||
|
||||
my $magic = `echo -e "show name;message\nprint type: nsr device" |nsradmin -i -`;
|
||||
# name: /dev/nst0;
|
||||
# message: "writing at 57 MB/s, 4063 GB";
|
||||
#
|
||||
# name: /dev/nst1;
|
||||
# message: "reading, data ";
|
||||
|
||||
my %hash = ();
|
||||
|
||||
while ($magic =~ m! name: (\S+?);\s+message: "(.+?)";!sg) {
|
||||
my ($dev,$mess) = ($1,$2);
|
||||
$hash{$dev} ||= {};
|
||||
$mess =~ m!writing at (\d+) (.?B)/s!;
|
||||
if ($2 eq 'B') {
|
||||
$hash{$dev}->{writing} = $1+0;
|
||||
}
|
||||
elsif ($2 eq 'KB') {
|
||||
$hash{$dev}->{writing} = $1*1024;
|
||||
}
|
||||
elsif ($2 eq 'MB') {
|
||||
$hash{$dev}->{writing} = $1*1024*1024;
|
||||
}
|
||||
elsif ($2 eq 'GB') {
|
||||
$hash{$dev}->{writing} = $1*1024*1024*1024;
|
||||
}
|
||||
}
|
||||
|
||||
if ($ARGV[0] eq "config") {
|
||||
print <<_EOM;
|
||||
graph_title NSR Device write speed (bytes/s)
|
||||
graph_args -l 0 --base 1000
|
||||
graph_vlabel bytes/s
|
||||
graph_category Networker
|
||||
graph_info Shows how much writing each device is doing.
|
||||
_EOM
|
||||
foreach my $d (sort keys %hash) {
|
||||
my ($l) = ($d =~ m!([A-Za-z0-9]+)$!);
|
||||
print "$l.label $d\n"
|
||||
# print $l.warning ??\n";
|
||||
# print "$l.critical ??\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
foreach my $d (sort keys %hash) {
|
||||
my ($l) = ($d =~ m!([A-Za-z0-9]+)$!);
|
||||
print "$l.value ".$hash{$d}->{writing}."\n";
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue