Added munin plugins for OpenBSD.
This commit is contained in:
parent
1d260a4997
commit
87afaeb059
11 changed files with 885 additions and 0 deletions
132
munin/files/plugins/cpu
Executable file
132
munin/files/plugins/cpu
Executable file
|
@ -0,0 +1,132 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor CPU usage.
|
||||
#
|
||||
# Usage: Place in /etc/munin/node.d/ (or link it there using ln -s)
|
||||
#
|
||||
# Parameters understood:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.8.2.3 2005/02/03 13:28:50 lupe
|
||||
# correct field.info
|
||||
#
|
||||
# Revision 1.8.2.2 2005/01/28 14:51:22 lupe
|
||||
# Add graph_info and some filed.info
|
||||
#
|
||||
# Revision 1.10 2005/01/28 14:47:31 lupe
|
||||
# Add graph_info and some filed.info
|
||||
#
|
||||
# Revision 1.9 2005/01/25 08:48:28 lupe
|
||||
# Correct multi-CPU bugs
|
||||
#
|
||||
# Revision 1.8.2.1 2005/01/25 09:22:52 lupe
|
||||
# Correct multi-CPU bugs
|
||||
#
|
||||
# Revision 1.8 2004/12/09 22:12:55 jimmyo
|
||||
# Added "graph_period" option, to make "graph_sums" usable.
|
||||
#
|
||||
# Revision 1.7 2004/11/28 09:43:54 lupe
|
||||
# 6-CURRENT support
|
||||
#
|
||||
# Revision 1.6 2004/11/21 00:16:56 jimmyo
|
||||
# Changed a lot of plugins so they use DERIVE instead of COUNTER.
|
||||
#
|
||||
# Revision 1.5 2004/05/20 19:02:36 jimmyo
|
||||
# Set categories on a bunch of plugins
|
||||
#
|
||||
# Revision 1.4 2004/05/09 19:18:35 jimmyo
|
||||
# Added support for scaleto100-parameter (patch from Lupe Christoph).
|
||||
#
|
||||
# Revision 1.3 2004/02/18 16:39:36 jimmyo
|
||||
# Turned off scaling of values for cpu-graphs (no more nano-percentages).
|
||||
#
|
||||
# Revision 1.2 2004/02/01 18:59:54 lupe
|
||||
# FreeBSD 5 compatibility.
|
||||
#
|
||||
# Revision 1.1 2004/01/02 18:50:00 jimmyo
|
||||
# Renamed occurrances of lrrd -> munin
|
||||
#
|
||||
# Revision 1.1.1.1 2004/01/02 15:18:07 jimmyo
|
||||
# Import of LRRD CVS tree after renaming to Munin
|
||||
#
|
||||
# Revision 1.3 2003/11/07 17:43:16 jimmyo
|
||||
# Cleanups and log entries
|
||||
#
|
||||
#
|
||||
#
|
||||
# Magic markers - optional - used by installation scripts and
|
||||
# munin-config:
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ -x /sbin/sysctl ]; then
|
||||
/sbin/sysctl kern.cp_time > /dev/null
|
||||
if [ $? = "0" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo 'graph_title CPU usage'
|
||||
echo 'graph_order system interrupt user nice idle'
|
||||
echo "graph_args --base 1000 -r --lower-limit 0 --upper-limit 100 "
|
||||
echo 'graph_vlabel %'
|
||||
echo 'graph_scale no'
|
||||
echo 'graph_info This graph shows how CPU time is spent.'
|
||||
echo 'graph_category system'
|
||||
echo 'graph_period second'
|
||||
echo 'system.label system'
|
||||
echo 'system.draw AREA'
|
||||
echo 'system.max 5000'
|
||||
echo 'system.type DERIVE'
|
||||
echo 'system.min 0'
|
||||
# echo "system.warning $SYSWARNING"
|
||||
# echo "system.critical $SYSCRITICAL"
|
||||
echo 'system.info CPU time spent by the kernel in system activities'
|
||||
echo 'interrupt.label interrupt'
|
||||
echo 'interrupt.draw STACK'
|
||||
echo 'interrupt.max 5000'
|
||||
# echo "interrupt.warning $INTWARNING"
|
||||
echo 'interrupt.type DERIVE'
|
||||
echo 'interrupt.min 0'
|
||||
echo 'interrupt.info CPU time spent by the kernel processing interrupts'
|
||||
echo 'user.label user'
|
||||
echo 'user.draw STACK'
|
||||
echo 'user.max 5000'
|
||||
# echo "user.warning $USRWARNING"
|
||||
echo 'user.type DERIVE'
|
||||
echo 'user.info CPU time spent by normal programs and daemons'
|
||||
echo 'user.min 0'
|
||||
echo 'nice.label nice'
|
||||
echo 'nice.draw STACK'
|
||||
echo 'nice.max 5000'
|
||||
echo 'nice.type DERIVE'
|
||||
echo 'nice.info CPU time spent by nice(1)d programs'
|
||||
echo 'nice.min 0'
|
||||
echo 'idle.label idle'
|
||||
echo 'idle.draw STACK'
|
||||
echo 'idle.max 5000'
|
||||
echo 'idle.type DERIVE'
|
||||
echo 'idle.info Idle CPU time'
|
||||
echo 'idle.min 0'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
/sbin/sysctl -n kern.cp_time | awk -F ',' '{ print "user.value " $1 "\nnice.value " $2 "\nsystem.value " $3 "\ninterrupt.value " $4 "\nidle.value " $5 }'
|
||||
|
78
munin/files/plugins/df
Executable file
78
munin/files/plugins/df
Executable file
|
@ -0,0 +1,78 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Script to monitor disk usage.
|
||||
#
|
||||
# Parameters understood:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.5 2004/12/09 20:27:45 jimmyo
|
||||
# Sort fields in df*-plugins alphabetically.
|
||||
#
|
||||
# Revision 1.4 2004/05/18 22:04:29 jimmyo
|
||||
# Use "sed 1d" instead of "tail +2" in df plugins (patch by Olivier Delhomme).
|
||||
#
|
||||
# Revision 1.3 2004/01/29 19:39:00 jimmyo
|
||||
# Generic plugins now use printf instead of echo -n, as this is more portable (SF#885564)
|
||||
#
|
||||
# Revision 1.2 2004/01/29 18:57:39 jimmyo
|
||||
# Disabled plugins df and df_inode on Solaris (SF#882274).
|
||||
#
|
||||
# Revision 1.1 2004/01/02 18:50:00 jimmyo
|
||||
# Renamed occurrances of lrrd -> munin
|
||||
#
|
||||
# Revision 1.1.1.1 2004/01/02 15:18:07 jimmyo
|
||||
# Import of LRRD CVS tree after renaming to Munin
|
||||
#
|
||||
# Revision 1.6 2003/11/07 17:43:16 jimmyo
|
||||
# Cleanups and log entries
|
||||
#
|
||||
#
|
||||
#
|
||||
# Magic markers (optional - used by munin-config and installation
|
||||
# scripts):
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
MAXLABEL=20
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ `uname -s` = SunOS ]; then
|
||||
echo no
|
||||
exit 1
|
||||
else
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo 'graph_title Filesystem usage (in %)'
|
||||
echo 'graph_category disk'
|
||||
echo 'graph_args --upper-limit 100 -l 0'
|
||||
echo 'graph_vlabel %'
|
||||
df -l | sed 1d | grep -v "//" | sort | while read i; do
|
||||
name=`echo $i | sed 's/[\/.-]/_/g'| awk '{ print $1 }'`
|
||||
printf "$name.label "
|
||||
echo $i | awk "{
|
||||
dir=\$6
|
||||
if (length(dir) <= $MAXLABEL)
|
||||
print dir
|
||||
else
|
||||
printf (\"...%s\n\", substr (dir, length(dir)-$MAXLABEL+4, $MAXLABEL-3))
|
||||
}"
|
||||
echo "$name.warning 92"
|
||||
echo "$name.critical 98"
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
df -P -l | sed 1d | grep -v "//" | while read i; do
|
||||
name=`echo $i | sed 's/[\/.-]/_/g'| awk '{ print $1 ".value " }'`
|
||||
printf "$name "
|
||||
echo $i | awk '{ print $5 }' | cut -f1 -d%
|
||||
done
|
94
munin/files/plugins/df_inode
Executable file
94
munin/files/plugins/df_inode
Executable file
|
@ -0,0 +1,94 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor inode-usage.
|
||||
#
|
||||
# Parameters understood:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.5 2004/12/09 20:27:45 jimmyo
|
||||
# Sort fields in df*-plugins alphabetically.
|
||||
#
|
||||
# Revision 1.4 2004/05/18 22:04:29 jimmyo
|
||||
# Use "sed 1d" instead of "tail +2" in df plugins (patch by Olivier Delhomme).
|
||||
#
|
||||
# Revision 1.3 2004/01/29 19:39:00 jimmyo
|
||||
# Generic plugins now use printf instead of echo -n, as this is more portable (SF#885564)
|
||||
#
|
||||
# Revision 1.2 2004/01/29 18:57:39 jimmyo
|
||||
# Disabled plugins df and df_inode on Solaris (SF#882274).
|
||||
#
|
||||
# Revision 1.1 2004/01/02 18:50:00 jimmyo
|
||||
# Renamed occurrances of lrrd -> munin
|
||||
#
|
||||
# Revision 1.1.1.1 2004/01/02 15:18:07 jimmyo
|
||||
# Import of LRRD CVS tree after renaming to Munin
|
||||
#
|
||||
# Revision 1.6 2003/11/07 17:43:16 jimmyo
|
||||
# Cleanups and log entries
|
||||
#
|
||||
#
|
||||
#
|
||||
# Magic markers (optional - used by munin-config and installation
|
||||
# scripts):
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
MAXLABEL=20
|
||||
|
||||
fs() {
|
||||
local escaped_mntpt=`echo "$*" | awk '{ print $NF }' | sed 's|/|\\\\/|g'`
|
||||
}
|
||||
|
||||
print_values() {
|
||||
df -l -i | sed 1d | grep -v "//" | while read i; do
|
||||
if [ "`fs $i`" = "reiserfs" ] ; then continue ; fi
|
||||
name=`echo $i | sed 's/[\/.]/_/g'| awk '{ print $1 ".value " }'`
|
||||
printf "$name "
|
||||
echo $i | awk '{ print $8 }' | cut -f1 -d%
|
||||
done
|
||||
}
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ "`print_values`" = "" ] ; then
|
||||
echo no
|
||||
exit 1
|
||||
else
|
||||
if [ `uname -s` = SunOS ]; then
|
||||
echo no
|
||||
exit 1
|
||||
else
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo 'graph_title Inode usage (in %)'
|
||||
echo 'graph_category disk'
|
||||
echo 'graph_args --upper-limit 100 -l 0'
|
||||
echo 'graph_vlabel %'
|
||||
df -l -i | sed 1d | grep -v "//" | sort | while read i; do
|
||||
if [ "`fs $i`" = "reiserfs" ] ; then continue ; fi
|
||||
name=`echo $i | sed 's/[\/.]/_/g'| awk '{ print $1 }'`
|
||||
printf "$name.label "
|
||||
echo $i | awk "{
|
||||
dir=\$9
|
||||
if (length(dir) <= $MAXLABEL)
|
||||
print dir
|
||||
else
|
||||
printf (\"...%s\n\", substr (dir, length(dir)-$MAXLABEL+4, $MAXLABEL-3))
|
||||
}"
|
||||
echo "$name.warning 92"
|
||||
echo "$name.critical 98"
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
print_values
|
73
munin/files/plugins/interfaces
Executable file
73
munin/files/plugins/interfaces
Executable file
|
@ -0,0 +1,73 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Plugin to monitor individual interrupts
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.7.2.1 2005/02/24 17:33:22 jimmyo
|
||||
# linux/irqstats should no longer fail on some systems (Deb#296452).
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
use strict;
|
||||
|
||||
if (defined $ARGV[0] && $ARGV[0] eq 'autoconf') {
|
||||
if(-e '/usr/bin/netstat') {
|
||||
print "yes\n";
|
||||
exit(0);
|
||||
} else {
|
||||
print "no\n";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
open my $in, "/usr/bin/netstat -bin |"
|
||||
or die "Can't run netstat -bin: $!\n";
|
||||
|
||||
my @ifstats;
|
||||
|
||||
while (my $line = <$in>) {
|
||||
if ($line =~ /<Link>/) {
|
||||
my @values = split(' ', $line);
|
||||
my $ifname = $values[0];
|
||||
$ifname =~ s/\*/_/g;
|
||||
my ($ibytes, $obytes);
|
||||
if ($values[3] =~ /\:/) {
|
||||
$ibytes = $values[4];
|
||||
$obytes = $values[5];
|
||||
} else {
|
||||
$ibytes = $values[3];
|
||||
$obytes = $values[4];
|
||||
}
|
||||
push @ifstats, {
|
||||
ifname => $ifname,
|
||||
ibytes => $ibytes,
|
||||
obytes => $obytes
|
||||
};
|
||||
}
|
||||
}
|
||||
close $in;
|
||||
|
||||
if (defined $ARGV[0] && $ARGV[0] eq 'config') {
|
||||
print "graph_title interface traffic (bytes) \n";
|
||||
print <<EOM;
|
||||
graph_args --base 1000
|
||||
graph_vlabel bytes in(-) / out(+) per \${graph_period}
|
||||
graph_category network
|
||||
EOM
|
||||
print join(' ', 'graph_order', map {$_->{ifname}."_in ".$_->{ifname}."_out"} @ifstats), "\n";
|
||||
for my $if (@ifstats) {
|
||||
print $if->{ifname}, '_in.label ', $if->{ifname}, "\n";
|
||||
print $if->{ifname}, '_out.label ', $if->{ifname}, "\n";
|
||||
print $if->{ifname}, '_in.info bytes in on: ', $if->{ifname}, "\n";
|
||||
print $if->{ifname}, '_out.info bytes out on: ', $if->{ifname}, "\n";
|
||||
print $if->{ifname}, "_in.type COUNTER\n";
|
||||
print $if->{ifname}, "_out.type COUNTER\n";
|
||||
print $if->{ifname}, "_in.min 0\n";
|
||||
print $if->{ifname}, "_out.min 0\n";
|
||||
print $if->{ifname}, "_in.graph no\n";
|
||||
print $if->{ifname}, "_out.negative ", $if->{ifname}, "_in\n";
|
||||
}
|
||||
} else {
|
||||
print $_->{ifname}, '_in.value ', $_->{ibytes}, "\n" for @ifstats;
|
||||
print $_->{ifname}, '_out.value ', $_->{obytes}, "\n" for @ifstats;
|
||||
}
|
||||
|
58
munin/files/plugins/irqstats
Executable file
58
munin/files/plugins/irqstats
Executable file
|
@ -0,0 +1,58 @@
|
|||
#!/usr/bin/perl -w
|
||||
#
|
||||
# Plugin to monitor individual interrupts
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.7.2.1 2005/02/24 17:33:22 jimmyo
|
||||
# linux/irqstats should no longer fail on some systems (Deb#296452).
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
use strict;
|
||||
|
||||
if (defined $ARGV[0] && $ARGV[0] eq 'autoconf') {
|
||||
if(-e '/usr/bin/vmstat -zi') {
|
||||
print "yes\n";
|
||||
exit(0);
|
||||
} else {
|
||||
print "no\n";
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
open my $in, "/usr/bin/vmstat -zi |"
|
||||
or die "Can't run vmstat -zi: $!\n";
|
||||
|
||||
my $header = <$in>; # throw away header line
|
||||
my @irqs;
|
||||
|
||||
while (my $line = <$in>) {
|
||||
my ($irq, $total, $rate) = split(' ', $line);
|
||||
chomp $irq;
|
||||
$irq =~ s/\//_/g;
|
||||
chomp $total;
|
||||
push @irqs, {
|
||||
irq => $irq,
|
||||
total => $total,
|
||||
};
|
||||
}
|
||||
close $in;
|
||||
|
||||
if (defined $ARGV[0] && $ARGV[0] eq 'config') {
|
||||
print "graph_title Individual interrupts \n";
|
||||
print <<EOM;
|
||||
graph_args --base 1000 -l 0;
|
||||
graph_vlabel interrupts / \${graph_period}
|
||||
graph_category system
|
||||
EOM
|
||||
print join(' ', 'graph_order', map {"i" . $_->{irq}} @irqs), "\n";
|
||||
for my $irq (@irqs) {
|
||||
my $f = ($irq->{irq} || $irq->{total});
|
||||
print "i", $irq->{irq}, '.label ', $f, "\n";
|
||||
print "i", $irq->{irq}, '.info Interrupt for device(s): ', $irq->{irq}, "\n";
|
||||
print "i", $irq->{irq}, ".type DERIVE\n";
|
||||
print "i", $irq->{irq}, ".min 0\n";
|
||||
}
|
||||
} else {
|
||||
print "i", $_->{irq}, '.value ', $_->{total}, "\n" for @irqs;
|
||||
}
|
||||
|
127
munin/files/plugins/load
Executable file
127
munin/files/plugins/load
Executable file
|
@ -0,0 +1,127 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor the load average on a system.
|
||||
#
|
||||
# Usage: Link or copy into /etc/munin/node.d/
|
||||
#
|
||||
# Magic markers (optional - only used by munin-config and some
|
||||
# installation scripts):
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.3.2.1 2005/01/28 14:51:22 lupe
|
||||
# Add graph_info and some filed.info
|
||||
#
|
||||
# Revision 1.4 2005/01/28 14:47:31 lupe
|
||||
# Add graph_info and some filed.info
|
||||
#
|
||||
# Revision 1.3 2004/05/20 19:02:36 jimmyo
|
||||
# Set categories on a bunch of plugins
|
||||
#
|
||||
# Revision 1.2 2004/01/15 16:58:10 jimmyo
|
||||
# FreeBSD-plugin load bugfix from Robert Lindgren (SF#865928).
|
||||
#
|
||||
# Revision 1.1 2004/01/02 18:50:00 jimmyo
|
||||
# Renamed occurrances of lrrd -> munin
|
||||
#
|
||||
# Revision 1.1.1.1 2004/01/02 15:18:07 jimmyo
|
||||
# Import of LRRD CVS tree after renaming to Munin
|
||||
#
|
||||
# Revision 1.3 2003/11/07 17:43:16 jimmyo
|
||||
# Cleanups and log entries
|
||||
#
|
||||
#
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
|
||||
|
||||
# If run with the "autoconf"-parameter, give our opinion on wether we
|
||||
# should be run on this system or not. This is optinal, and only used by
|
||||
# munin-config. In the case of this plugin, we should most probably
|
||||
# always be included.
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ -x /sbin/sysctl ]; then
|
||||
/sbin/sysctl vm.loadavg > /dev/null
|
||||
if [ $? = "0" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# If run with the "config"-parameter, give out information on how the
|
||||
# graphs should look.
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
# The host name this plugin is for. (Can be overridden to have
|
||||
# one machine answer for several)
|
||||
|
||||
# The title of the graph
|
||||
echo 'graph_title Load average'
|
||||
# Arguments to "rrdtool graph". In this case, tell it that the
|
||||
# lower limit of the graph is '0', and that 1k=1000 (not 1024)
|
||||
echo 'graph_args --base 1000 -l 0'
|
||||
# The Y-axis label
|
||||
echo 'graph_vlabel load'
|
||||
# We want Cur/Min/Avg/Max unscaled (i.e. 0.42 load instead of
|
||||
# 420 milliload)
|
||||
echo 'graph_noscale true'
|
||||
# The category of the plugin. Defaults to "other".
|
||||
echo 'graph_category system'
|
||||
# The fields. "label" is used in the legend. "label" is the only
|
||||
# required subfield.
|
||||
echo 'load.label load'
|
||||
# These two are optional. They are only used if you have
|
||||
# configured your munin to tell a Nagios-server about any
|
||||
# problems
|
||||
echo 'load.warning 10'
|
||||
echo 'load.critical 120'
|
||||
# This one is purely to add an explanation to the web page. The first
|
||||
# one is for the graph itself, while the second one is for the field
|
||||
# "load".
|
||||
echo 'graph_info The load average of the machine describes how many processes are in the run-queue (scheduled to run "immediately").'
|
||||
echo 'load.info Average load for the five minutes.'
|
||||
|
||||
# Last, if run with the "config"-parameter, quit here (don't
|
||||
# display any data)
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# If not run with any parameters at all (or only unknown ones), do the
|
||||
# real work - i.e. display the data. Almost always this will be
|
||||
# "value" subfield for every data field.
|
||||
|
||||
echo -n "load.value "
|
||||
/sbin/sysctl vm.loadavg | cut -f3 -d' '
|
||||
|
||||
# How could this plugin have been written in its simplest form?
|
||||
# Something like this:
|
||||
#
|
||||
# ---------------------
|
||||
# #!/bin/sh
|
||||
|
||||
#
|
||||
# if [ "$1" = "config" ]; then
|
||||
|
||||
# echo "graph_title Load average"
|
||||
# echo 'graph_args --base 1000 -l 0'
|
||||
# echo 'graph_vlabel load'
|
||||
# echo "load.label load"
|
||||
# exit 0
|
||||
# fi
|
||||
# echo -n "load.value "
|
||||
# cut -f1 -d' ' < /proc/loadavg
|
||||
# ---------------------
|
||||
#
|
||||
# Except for the Nagios-warnings (which most people don't have any need
|
||||
# for) and things used by installation scripts and munin-config (which
|
||||
# you don't need if you don't plan on submitting your plugin to the
|
||||
# pacakge), the two versions will work identically.
|
100
munin/files/plugins/netstat
Executable file
100
munin/files/plugins/netstat
Executable file
|
@ -0,0 +1,100 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor network connections.
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - only used by munin-config)
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.5.2.1 2005/01/28 14:51:22 lupe
|
||||
# Add graph_info and some filed.info
|
||||
#
|
||||
# Revision 1.6 2005/01/28 14:47:31 lupe
|
||||
# Add graph_info and some filed.info
|
||||
#
|
||||
# Revision 1.5 2004/12/10 10:47:49 jimmyo
|
||||
# Change name from ${scale} to ${graph_period}, to be more consistent.
|
||||
#
|
||||
# Revision 1.4 2004/12/09 22:12:55 jimmyo
|
||||
# Added "graph_period" option, to make "graph_sums" usable.
|
||||
#
|
||||
# Revision 1.3 2004/11/21 00:16:56 jimmyo
|
||||
# Changed a lot of plugins so they use DERIVE instead of COUNTER.
|
||||
#
|
||||
# Revision 1.2 2004/05/20 19:02:36 jimmyo
|
||||
# Set categories on a bunch of plugins
|
||||
#
|
||||
# Revision 1.1 2004/01/02 18:50:00 jimmyo
|
||||
# Renamed occurrances of lrrd -> munin
|
||||
#
|
||||
# Revision 1.1.1.1 2004/01/02 15:18:07 jimmyo
|
||||
# Import of LRRD CVS tree after renaming to Munin
|
||||
#
|
||||
# Revision 1.3 2003/11/07 17:43:16 jimmyo
|
||||
# Cleanups and log entries
|
||||
#
|
||||
#
|
||||
#
|
||||
# Magic markers (optional - used by munin-config and some installation
|
||||
# scripts):
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if ( netstat -s 2>/dev/null >/dev/null ); then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
if [ $? -eq 127 ]
|
||||
then
|
||||
echo "no (netstat program not found)"
|
||||
exit 1
|
||||
else
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo 'graph_title Netstat'
|
||||
echo 'graph_args -l 0 --base 1000'
|
||||
echo 'graph_vlabel active connections per ${graph_period}'
|
||||
echo 'graph_category network'
|
||||
echo 'graph_period second'
|
||||
echo 'graph_info This graph shows the TCP activity of all the network interfaces combined.'
|
||||
echo 'active.label active'
|
||||
echo 'active.type DERIVE'
|
||||
echo 'active.min 0'
|
||||
echo 'active.max 50000'
|
||||
echo 'active.info The number of active TCP openings per second.'
|
||||
echo 'passive.label passive'
|
||||
echo 'passive.type DERIVE'
|
||||
echo 'passive.min 0'
|
||||
echo 'passive.max 50000'
|
||||
echo 'passive.info The number of passive TCP openings per second.'
|
||||
echo 'failed.label failed'
|
||||
echo 'failed.type DERIVE'
|
||||
echo 'failed.min 0'
|
||||
echo 'failed.max 50000'
|
||||
echo 'failed.info The number of failed TCP connection attempts per second.'
|
||||
echo 'resets.label resets'
|
||||
echo 'resets.type DERIVE'
|
||||
echo 'resets.min 0'
|
||||
echo 'resets.max 50000'
|
||||
echo 'resets.info The number of TCP connection resets.'
|
||||
echo 'established.label established'
|
||||
echo 'established.type DERIVE'
|
||||
echo 'established.min 0'
|
||||
echo 'established.max 50000'
|
||||
echo 'established.info The number of currently open connections.'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
netstat -s | awk '/connection requests/ { print "active.value " $1 } /connection accepts/ { print "passive.value " $1 } /bad connection/ { print "failed.value " $1 } /reset/ { print "resets.value " $1 } /connections established/ { print "established.value " $1 }'
|
||||
|
74
munin/files/plugins/open_files
Executable file
74
munin/files/plugins/open_files
Executable file
|
@ -0,0 +1,74 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor the number of open files in the system.
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.2.2.1 2005/01/28 14:51:22 lupe
|
||||
# Add graph_info and some filed.info
|
||||
#
|
||||
# Revision 1.3 2005/01/28 14:47:31 lupe
|
||||
# Add graph_info and some filed.info
|
||||
#
|
||||
# Revision 1.2 2004/05/20 19:02:36 jimmyo
|
||||
# Set categories on a bunch of plugins
|
||||
#
|
||||
# Revision 1.1 2004/01/02 18:50:00 jimmyo
|
||||
# Renamed occurrances of lrrd -> munin
|
||||
#
|
||||
# Revision 1.1.1.1 2004/01/02 15:18:07 jimmyo
|
||||
# Import of LRRD CVS tree after renaming to Munin
|
||||
#
|
||||
# Revision 1.3 2003/11/07 17:43:16 jimmyo
|
||||
# Cleanups and log entries
|
||||
#
|
||||
#
|
||||
#
|
||||
# Magic markers (Used by munin-config and some installation scripts.
|
||||
# Optional):
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if [ -x /sbin/sysctl ]; then
|
||||
/sbin/sysctl kern.openfiles > /dev/null
|
||||
if [ $? = "0" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo 'graph_title File table usage'
|
||||
echo 'graph_args --base 1000 -l 0'
|
||||
echo 'graph_vlabel number of open files'
|
||||
echo 'graph_category system'
|
||||
echo 'graph_info This graph monitors the Linux open files table.'
|
||||
echo 'used.label open files'
|
||||
echo 'used.info The number of currently open files.'
|
||||
echo 'max.label max open files'
|
||||
echo 'max.info The maximum supported number of open files.'
|
||||
/sbin/sysctl -n kern.maxfiles | awk '{printf "used.warning %d\nused.critical %d\n",$1*0.92,$1*0.98}'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#awk '{print "used.value " $1-$2 "\nmax.value " $3}' < /proc/sys/fs/file-nr
|
||||
echo -n 'max.value '
|
||||
/sbin/sysctl -n kern.maxfiles
|
||||
echo -n 'used.value '
|
||||
/sbin/sysctl -n kern.nfiles
|
55
munin/files/plugins/sensors_temp
Executable file
55
munin/files/plugins/sensors_temp
Executable file
|
@ -0,0 +1,55 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor temperature readings
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - only used by munin-config)
|
||||
#
|
||||
# Magic markers (optional - used by munin-config and some installation
|
||||
# scripts):
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if ( sysctl -a hw.sensors 2>/dev/null >/dev/null ); then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
if [ $? -eq 127 ]
|
||||
then
|
||||
echo "no (sysctl program not found)"
|
||||
exit 1
|
||||
else
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo 'graph_title temperature readings'
|
||||
echo 'graph_args -l 0 --base 1000'
|
||||
echo 'graph_vlabel degC ${graph_period}'
|
||||
echo 'graph_category sensors'
|
||||
echo 'graph_period second'
|
||||
echo 'graph_info Temperature readings on mainboard and CPU'
|
||||
echo 'mb.label mainboard'
|
||||
echo 'mb.type GAUGE'
|
||||
echo 'mb.min 15'
|
||||
echo 'mb.max 150'
|
||||
echo 'mb.info mainboard temperature (TSENS1).'
|
||||
echo 'cpu.label CPU'
|
||||
echo 'cpu.type GAUGE'
|
||||
echo 'cpu.min 15'
|
||||
echo 'cpu.max 150'
|
||||
echo 'cpu.info CPU temperature (TSENS2).'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
sysctl -a | awk '/TSENS1/ { print "mb.value " $4 } /TSENS2/ { print "cpu.value " $4 }'
|
||||
|
79
munin/files/plugins/vmstat
Executable file
79
munin/files/plugins/vmstat
Executable file
|
@ -0,0 +1,79 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Plugin to monitor the number of procs in io-sleep and other wait
|
||||
# states. Uses `vmstat`.
|
||||
#
|
||||
# Parameters:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
#
|
||||
# $Log$
|
||||
# Revision 1.4 2004/05/20 13:57:12 jimmyo
|
||||
# Set categories to some of the plugins.
|
||||
#
|
||||
# Revision 1.3 2004/01/30 14:40:08 jimmyo
|
||||
# Added max value to generic/vmstat plugin (Deb#225489).
|
||||
#
|
||||
# Revision 1.2 2004/01/29 19:00:42 jimmyo
|
||||
# Make vmstat plugin more portable (SF#882352).
|
||||
#
|
||||
# Revision 1.1 2004/01/02 18:50:00 jimmyo
|
||||
# Renamed occurrances of lrrd -> munin
|
||||
#
|
||||
# Revision 1.1.1.1 2004/01/02 15:18:07 jimmyo
|
||||
# Import of LRRD CVS tree after renaming to Munin
|
||||
#
|
||||
# Revision 1.3 2003/12/06 16:32:29 jimmyo
|
||||
# Better names. Idea from Mike Fedyk.
|
||||
#
|
||||
# Revision 1.2 2003/11/07 17:43:16 jimmyo
|
||||
# Cleanups and log entries
|
||||
#
|
||||
#
|
||||
#
|
||||
# Magick markers (optional):
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf
|
||||
|
||||
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
if ( vmstat 1 1 >/dev/null 2>&1 ); then
|
||||
echo yes
|
||||
exit 0
|
||||
else
|
||||
if [ $? -eq 127 ]; then
|
||||
echo "no (could not run \"vmstat\")"
|
||||
exit 1
|
||||
else
|
||||
echo no
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo 'graph_title VMstat'
|
||||
echo 'graph_args --base 1000 -l 0'
|
||||
echo 'graph_vlabel process states'
|
||||
echo 'graph_category processes'
|
||||
echo 'total.label total'
|
||||
echo 'total.type GAUGE'
|
||||
echo 'total.max 500000'
|
||||
echo 'run.label runq'
|
||||
echo 'run.type GAUGE'
|
||||
echo 'run.max 500000'
|
||||
echo 'iowait.label iowait'
|
||||
echo 'iowait.type GAUGE'
|
||||
echo 'iowait.max 500000'
|
||||
echo 'sleep.label sleep/swapped'
|
||||
echo 'sleep.type GAUGE'
|
||||
echo 'sleep.max 500000'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "total.value `sysctl -n kern.nprocs`"
|
||||
vmstat 1 2 | awk '{run = $1; iowait = $2; sleep = $3} END { print "run.value " run "\niowait.value " iowait "\nsleep.value " sleep }'
|
||||
|
|
@ -55,6 +55,21 @@ class munin::node {
|
|||
|
||||
munin::plugin { "vmware_vms": config => "vmware" }
|
||||
|
||||
case $operatingsystem {
|
||||
OpenBSD: {
|
||||
munin::plugin { "cpu": }
|
||||
munin::plugin { "df": }
|
||||
munin::plugin { "df_inode": }
|
||||
munin::plugin { "interfaces": }
|
||||
munin::plugin { "irqstats": }
|
||||
munin::plugin { "load": }
|
||||
munin::plugin { "netstat": }
|
||||
munin::plugin { "open_files": }
|
||||
munin::plugin { "sensors_temp": }
|
||||
munin::plugin { "vmstat": }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue