mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
Plugin-Gallery: Better 2nd level headings
This commit is contained in:
parent
349edaf819
commit
6ffdebec0d
17 changed files with 9 additions and 9 deletions
101
plugins/darwin/dar_cpuusage
Executable file
101
plugins/darwin/dar_cpuusage
Executable file
|
@ -0,0 +1,101 @@
|
|||
#!/usr/bin/perl -w
|
||||
# -*- perl -*-
|
||||
|
||||
=head1 NAME
|
||||
|
||||
dar_cpuusage - Munin plugin to monitor darwin cpu usage.
|
||||
|
||||
=head1 APPLICABLE SYSTEMS
|
||||
|
||||
Should work on any darwin (Mac OS X) system with the 'top' command.
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
None needed
|
||||
|
||||
=head1 INTERPRETATION
|
||||
|
||||
The plugin runs the top command and shows the CPU usage for the machine.
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
The stats are a snapshot at the time of the command - a 5 minute average would
|
||||
be better.
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
v.0.0.1
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Copyright (C) 2010.
|
||||
|
||||
Original version by J.T.Sage (at) gmail (dot) com.
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
GPLv2
|
||||
|
||||
=cut
|
||||
|
||||
use Munin::Plugin;
|
||||
|
||||
if ( defined($ARGV[0])) {
|
||||
if ($ARGV[0] eq 'autoconf') {
|
||||
$uname = `uname`;
|
||||
if ( not ( $uname =~ /Darwin/ ) ) { print "no (not a Darwin System)\n"; }
|
||||
else {
|
||||
if ( not -x "/usr/bin/top" ) { print "no (top not found)\n"; }
|
||||
else {
|
||||
print "yes\n";
|
||||
}
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ( $ARGV[0] eq "config" ) {
|
||||
print "graph_title CPU usage\n";
|
||||
print "graph_args --base 1000 -r --lower-limit 0 --upper-limit 100\n";
|
||||
print "graph_vlabel %\n";
|
||||
print "graph_scale no\n";
|
||||
print "graph_category system\n";
|
||||
print "sys.label system\n";
|
||||
print "sys.type GAUGE\n";
|
||||
print "sys.min 0\nsys.draw AREA\n";
|
||||
print "user.label user\n";
|
||||
print "user.type GAUGE\n";
|
||||
print "user.min 0\nuser.draw STACK\n";
|
||||
print "idle.label idle\n";
|
||||
print "idle.type GAUGE\n";
|
||||
print "idle.min 0\nidle.draw STACK\n";
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
|
||||
@top = `top -l1 -n0 -u`;
|
||||
$quit = 0;
|
||||
for ( $i = 1; ($i < $#top and $quit == 0); $i++ ) {
|
||||
if ( $top[$i] =~ /^CPU/ ) {
|
||||
$usr = $sys = $idl = $top[$i];
|
||||
$usr =~ s/^.+?: (\d+\.\d+)\% user.+$/$1/;
|
||||
chomp($usr);
|
||||
$sys =~ s/^.+?, (\d+\.\d+)\% sys.+$/$1/;
|
||||
chomp($sys);
|
||||
$idl =~ s/^.+?, (\d+\.\d+)\% idle.+$/$1/;
|
||||
chomp($idl);
|
||||
print "sys.value " . $sys . "\n";
|
||||
print "user.value " . $usr . "\n";
|
||||
print "idle.value " . $idl . "\n";
|
||||
$quit = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
# vim:syntax=perl
|
104
plugins/darwin/dar_memusage
Executable file
104
plugins/darwin/dar_memusage
Executable file
|
@ -0,0 +1,104 @@
|
|||
#!/usr/bin/perl -w
|
||||
# -*- perl -*-
|
||||
|
||||
=head1 NAME
|
||||
|
||||
dar_mumusage - Munin plugin to monitor darwin physical memory usage.
|
||||
|
||||
=head1 APPLICABLE SYSTEMS
|
||||
|
||||
Should work on any darwin (Mac OS X) system with the 'top' command.
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
None needed
|
||||
|
||||
=head1 INTERPRETATION
|
||||
|
||||
The plugin runs the top command and shows the physical memory for the machine.
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
The stats are a snapshot at the time of the command - a 5 minute average would
|
||||
be better.
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
v.0.0.1
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Copyright (C) 2010.
|
||||
|
||||
Original version by J.T.Sage (at) gmail (dot) com.
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
GPLv2
|
||||
|
||||
=cut
|
||||
|
||||
use Munin::Plugin;
|
||||
|
||||
if ( defined($ARGV[0])) {
|
||||
if ($ARGV[0] eq 'autoconf') {
|
||||
$uname = `uname`;
|
||||
if ( not ( $uname =~ /Darwin/ ) ) { print "no (not a Darwin System)\n"; }
|
||||
else {
|
||||
if ( not -x "/usr/bin/top" ) { print "no (top not found)\n"; }
|
||||
else {
|
||||
print "yes\n";
|
||||
}
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ( $ARGV[0] eq "config" ) {
|
||||
$maxmemcmd = `hostinfo | grep memory`;
|
||||
$maxmemcmd =~ m/^.+?: (\d+\.\d+) (\w).+$/;
|
||||
$memline = $1;
|
||||
if ( $2 eq "m" ) { $memline = $memline * 1024 * 1024; }
|
||||
if ( $2 eq "g" ) { $memline = $memline * 1024 * 1024 * 1024; }
|
||||
|
||||
print "graph_title Memory usage\n";
|
||||
print "graph_args --base 1024 --lower-limit 0 --upper-limit ".$memline." --rigid\n";
|
||||
print "graph_vlabel Bytes\n";
|
||||
print "graph_scale yes\n";
|
||||
print "graph_category system\n";
|
||||
print "wired.label wired\nwired.type GAUGE\nwired.draw AREA\n";
|
||||
print "active.label active\nactive.type GAUGE\nactive.draw STACK\n";
|
||||
print "inactive.label inactive\ninactive.type GAUGE\ninactive.draw STACK\n";
|
||||
print "free.label free\nfree.type GAUGE\nfree.draw STACK\n";
|
||||
print "used.label used\nused.type GAUGE\nused.draw LINE2\n";
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
|
||||
@top = `top -l1 -n0 -u`;
|
||||
$quit = 0;
|
||||
for ( $i = 1; ($i < $#top and $quit == 0); $i++ ) {
|
||||
if ( $top[$i] =~ /^PhysMem/ ) {
|
||||
$wired = $active = $inactive = $free = $used = $top[$i];
|
||||
$wired =~ s/^.+?: (\d+)M wired.+$/$1/; chomp $wired; $wired = $wired * 1024 * 1024;
|
||||
$active =~ s/^.+?, (\d+)M active.+$/$1/; chomp $active; $active = $active * 1024 * 1024;
|
||||
$inactive =~ s/^.+?, (\d+)M inactive.+$/$1/; chomp $inactive; $inactive = $inactive * 1024 * 1024;
|
||||
$free =~ s/^.+?, (\d+)([M|K]) free.+$/$1/; chomp $free; $free = $free * 1024 * 1024; if ( $2 eq "K" ) { $free = $free / 1024; }
|
||||
$used =~ s/^.+?, (\d+)([M|G]) used.+$/$1/; chomp $used; $used = $used * 1024 * 1024; if ( $2 eq "G" ) { $used = $used * 1024; }
|
||||
print "wired.value " . $wired . "\n";
|
||||
print "active.value " . $active . "\n";
|
||||
print "inactive.value " . $inactive . "\n";
|
||||
print "free.value " . $free . "\n";
|
||||
print "used.value " . $used . "\n";
|
||||
$quit = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
# vim:syntax=perl
|
97
plugins/darwin/dar_swap
Executable file
97
plugins/darwin/dar_swap
Executable file
|
@ -0,0 +1,97 @@
|
|||
#!/usr/bin/perl -w
|
||||
# -*- perl -*-
|
||||
|
||||
=head1 NAME
|
||||
|
||||
dar_swap - Munin plugin to monitor darwin swap in/out.
|
||||
|
||||
=head1 APPLICABLE SYSTEMS
|
||||
|
||||
Should work on any darwin (Mac OS X) system with the 'vm_stat' command.
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
None needed
|
||||
|
||||
=head1 INTERPRETATION
|
||||
|
||||
The plugin runs the vm_stat command a shows the number of pages swapped
|
||||
in/out per second.
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
None right now.
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
v.0.0.1
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Copyright (C) 2010.
|
||||
|
||||
Original version by J.T.Sage (at) gmail (dot) com.
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
GPLv2
|
||||
|
||||
=cut
|
||||
|
||||
use Munin::Plugin;
|
||||
|
||||
if ( defined($ARGV[0])) {
|
||||
if ($ARGV[0] eq 'autoconf') {
|
||||
$uname = `uname`;
|
||||
if ( not ( $uname =~ /Darwin/ ) ) { print "no (not a Darwin System)\n"; }
|
||||
else {
|
||||
if ( not -x "/usr/bin/vm_stat" ) { print "no (vm_stat not found)\n"; }
|
||||
else {
|
||||
print "yes\n";
|
||||
}
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ( $ARGV[0] eq "config" ) {
|
||||
print "graph_title Swap in/out\n";
|
||||
print "graph_args -l 0 --base 1000\n";
|
||||
print "graph_vlabel pages per \${graph_period} in (-) / out (+)\n";
|
||||
print "graph_category system\n";
|
||||
print "swap_in.label swap\nswap_in.type DERIVE\nswap_in.max 100000\nswap_in.min 0\nswap_in.graph no\n";
|
||||
print "swap_out.label swap\nswap_out.type DERIVE\nswap_out.max 100000\nswap_out.min 0\nswap_out.negative swap_in\n";
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
|
||||
@vmstat = `vm_stat`;
|
||||
for ( $i = 1; $i < $#vmstat; $i++ ) {
|
||||
$line = $vmstat[$i];
|
||||
$label = $line;
|
||||
$label =~ s/"//g;
|
||||
$label =~ s/(\w+)\:.+$/$1/;
|
||||
$label =~ s/\n//g;
|
||||
$name = $label;
|
||||
$name =~ tr/A-Z/a-z/;
|
||||
$name =~ s/[^A-Za-z0-9_]/_/g;
|
||||
$data = $line;
|
||||
$data =~ s/.+?(\d+)\./$1/;
|
||||
$data =~ s/\n//g;
|
||||
$data = int(($data / 1000) + .5);
|
||||
if ( $name eq "pageins" ) {
|
||||
print "swap_in.value " . $data . "\n";
|
||||
}
|
||||
if ( $name eq "pageouts" ) {
|
||||
print "swap_out.value " . $data . "\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
# vim:syntax=perl
|
96
plugins/darwin/dar_uptime
Executable file
96
plugins/darwin/dar_uptime
Executable file
|
@ -0,0 +1,96 @@
|
|||
#!/usr/bin/perl
|
||||
# -*- perl -*-
|
||||
|
||||
=head1 NAME
|
||||
|
||||
dar_uptime - Munin plugin to monitor darwin system uptime.
|
||||
|
||||
=head1 APPLICABLE SYSTEMS
|
||||
|
||||
Should work on any darwin (Mac OS X) system with the 'uptime' command.
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
None needed
|
||||
|
||||
=head1 INTERPRETATION
|
||||
|
||||
The plugin runs the uptime command, and parses the value into days.
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
Limited test data set, probably fails some of the time - very likely
|
||||
on systems with a very low uptime.
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
v.0.0.1
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Copyright (C) 2010.
|
||||
|
||||
Original version by J.T.Sage (at) gmail (dot) com.
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
GPLv2
|
||||
|
||||
=cut
|
||||
|
||||
use Munin::Plugin;
|
||||
|
||||
if ( defined($ARGV[0])) {
|
||||
if ($ARGV[0] eq 'autoconf') {
|
||||
$uname = `uname`;
|
||||
if ( not ( $uname =~ /Darwin/ ) ) { print "no (not a Darwin System)\n"; }
|
||||
else {
|
||||
if ( not -x "/usr/bin/uptime" ) { print "no (uptime not found)\n"; }
|
||||
else {
|
||||
print "yes\n";
|
||||
}
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ( $ARGV[0] eq "config" ) {
|
||||
print "graph_title Uptime\n";
|
||||
print "graph_args --base 1000 -l 0 \n";
|
||||
print "graph_vlabel uptime in days\n";
|
||||
print "graph_category system\n";
|
||||
print "uptime.label uptime\n";
|
||||
print "uptime.draw AREA\n";
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
|
||||
@uptime = `/usr/bin/uptime`;
|
||||
foreach(@uptime) {
|
||||
$_ =~ m/^.+up (.+?), \d+ us.+$/;
|
||||
$timestr = $1;
|
||||
if ( $timestr =~ m/^(\d+) day.+?$/ ) {
|
||||
$days = $1;
|
||||
} else { $days = 0; }
|
||||
if ( $timestr =~ m/(\d+) h/ ) {
|
||||
$hrs = $1;
|
||||
} else { $hrs = 0; }
|
||||
if ( $timestr =~ m/(\d+)\:(\d+)/ ) {
|
||||
$hours = $1; $min = $2;
|
||||
} else { $hours = 0; $min = 0; }
|
||||
if ( $timestr =~ m/(\d+) m/ ) {
|
||||
$mint = $1;
|
||||
} else {
|
||||
$mint = 0;
|
||||
}
|
||||
$total = ( $days * 24 * 60 * 60 ) + ( ( $hrs + $hours ) * 60 * 60 ) + ( ( $min + $mint ) * 60 );
|
||||
$daysf = $total / ( 24 * 60 * 60 );
|
||||
$daysi = ( int( $daysf * 1000 ) / 1000 );
|
||||
print "uptime.value " . $daysi . "\n";
|
||||
}
|
||||
|
||||
# vim:syntax=perl
|
110
plugins/darwin/dar_vmstat
Executable file
110
plugins/darwin/dar_vmstat
Executable file
|
@ -0,0 +1,110 @@
|
|||
#!/usr/bin/perl -w
|
||||
# -*- perl -*-
|
||||
|
||||
=head1 NAME
|
||||
|
||||
dar_vmstat - Munin plugin to monitor darwin virtual memory usage.
|
||||
|
||||
=head1 APPLICABLE SYSTEMS
|
||||
|
||||
Should work on any darwin (Mac OS X) system with the 'vm_stat' command.
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
None needed
|
||||
|
||||
=head1 INTERPRETATION
|
||||
|
||||
The plugin runs the vm_stat command a shows the results. Consult the
|
||||
vm_stat man page for more information on the output.
|
||||
|
||||
=head1 BUGS
|
||||
|
||||
None right now.
|
||||
|
||||
=head1 MAGIC MARKERS
|
||||
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
v.0.0.1
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Copyright (C) 2010.
|
||||
|
||||
Original version by J.T.Sage (at) gmail (dot) com.
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
GPLv2
|
||||
|
||||
=cut
|
||||
|
||||
use Munin::Plugin;
|
||||
|
||||
if ( defined($ARGV[0])) {
|
||||
if ($ARGV[0] eq 'autoconf') {
|
||||
$uname = `uname`;
|
||||
if ( not ( $uname =~ /Darwin/ ) ) { print "no (not a Darwin System)\n"; }
|
||||
else {
|
||||
if ( not -x "/usr/bin/vm_stat" ) { print "no (vm_stat not found)\n"; }
|
||||
else {
|
||||
print "yes\n";
|
||||
}
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
|
||||
if ( $ARGV[0] eq "config" ) {
|
||||
print "graph_title Virtual Memory Statiscs\n";
|
||||
print "graph_args --base 1000 -l 0\n";
|
||||
print "graph_vlabel bytes\n";
|
||||
print "graph_scale yes\n";
|
||||
print "graph_category system\n";
|
||||
@vmstat = `vm_stat`;
|
||||
for ( $i = 1; $i < $#vmstat; $i++ ) {
|
||||
$line = $vmstat[$i];
|
||||
$label = $line;
|
||||
$label =~ s/"//g;
|
||||
$label =~ s/(\w+)\:.+$/$1/;
|
||||
$label =~ s/\n//g;
|
||||
$name = $label;
|
||||
$name =~ tr/A-Z/a-z/;
|
||||
$name =~ s/[^A-Za-z0-9_]/_/g;
|
||||
if ( $name eq "pages_free" || $name eq "pages_active" || $name eq "pages_inactive" || $name eq "pages_speculative" || $name eq "pages_wired_down" ) {
|
||||
$label =~ s/Pages //;
|
||||
print $name, ".label ", $label, "\n";
|
||||
print $name, ".type GAUGE\n";
|
||||
print $name, ".cdef ", $name, ",4096,*\n";
|
||||
}
|
||||
}
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
|
||||
@vmstat = `vm_stat`;
|
||||
for ( $i = 1; $i < $#vmstat; $i++ ) {
|
||||
$line = $vmstat[$i];
|
||||
$label = $line;
|
||||
$label =~ s/"//g;
|
||||
$label =~ s/(\w+)\:.+$/$1/;
|
||||
$label =~ s/\n//g;
|
||||
$name = $label;
|
||||
$name =~ tr/A-Z/a-z/;
|
||||
$name =~ s/[^A-Za-z0-9_]/_/g;
|
||||
$data = $line;
|
||||
$data =~ s/.+?(\d+)\./$1/;
|
||||
$data =~ s/\n//g;
|
||||
#$data = int(($data / 1000) + .5);
|
||||
if ( $name eq "pages_free" || $name eq "pages_active" || $name eq "pages_inactive" || $name eq "pages_speculative" || $name eq "pages_wired_down" ) {
|
||||
print $name, ".value ", $data, "\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
# vim:syntax=perl
|
44
plugins/darwin/dar_vpnd
Executable file
44
plugins/darwin/dar_vpnd
Executable file
|
@ -0,0 +1,44 @@
|
|||
#!/usr/bin/env perl
|
||||
# -*- perl -*-
|
||||
|
||||
=head1 NAME
|
||||
|
||||
dar_vpnd a Plugin for displaying VPN Stats for the Darwin (MacOS) vpnd Service.
|
||||
|
||||
=head1 INTERPRETATION
|
||||
|
||||
The Plugin displays the number of active VPN connections.
|
||||
|
||||
=head1 CONFIGURATION
|
||||
|
||||
No Configuration necessary!
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Philipp Haussleiter <philipp@haussleiter.de> (email)
|
||||
|
||||
=head1 LICENSE
|
||||
|
||||
GPLv2
|
||||
|
||||
=cut
|
||||
|
||||
# MAIN
|
||||
use warnings;
|
||||
use strict;
|
||||
|
||||
|
||||
my $cmd = "ps -ef | awk '/[p]ppd/ {print substr(\$NF,2);}' | wc -l";
|
||||
|
||||
if ( exists $ARGV[0] and $ARGV[0] eq "config" ) {
|
||||
print "graph_category network\n";
|
||||
print "graph_args --base 1024 -r --lower-limit 0\n";
|
||||
print "graph_title Number of VPN Connections\n";
|
||||
print "graph_vlabel VPN Connections\n";
|
||||
print "graph_info The Graph shows the Number of VPN Connections\n";
|
||||
print "connections.label Number of VPN Connections\n";
|
||||
print "connections.type GAUGE\n";
|
||||
} else {
|
||||
my $output = `$cmd`;
|
||||
print "connections.value $output";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue