forked from Lainports/freebsd-ports
PR: ports/175331 Submitted by: Christoph Mallon Approved by: No objections within three weeks from any maintainer While here, style and duplicate phrase fixes in bsdcflow pkg-descr Submitted by: mi
106 lines
3.9 KiB
HTML
106 lines
3.9 KiB
HTML
<html>
|
|
<head><title>check_netsnmp plugin for Nagios</title>
|
|
</head>
|
|
<body>
|
|
<center><h1>check_netsnmp plugin for Nagios</h1>(<a
|
|
href="check_netsnmp">download</a>)</center>
|
|
<p><b>Motivation.</b> There are several common parameters we want to
|
|
monitor for (almost) every computer in our network:
|
|
<ul>
|
|
<li>Free disk space
|
|
<li>Free swap space
|
|
<li>Average loads
|
|
<li>That important processes are running on the machine
|
|
<li>Total number of processes and a number of processes in
|
|
<em>zombie</em> state
|
|
<li>A number of free mbuf clusters available (most our servers run
|
|
FreeBSD, thus the notion of mbuf clusters)
|
|
</ul>
|
|
<code>snmpd</code>, provided by free <a
|
|
href="http://net-snmp.sourceforge.net/">net-snmp</a> package, provides
|
|
a convenient way to collect this information and export it by means of
|
|
SNMP protocol. It also allows one to specify the critical values for
|
|
the above parameters and automatically sets error flag to indicate the
|
|
error occurred and provides error message which describes it.
|
|
Using <code>snmpd</code> it is also possible to execute custom scripts
|
|
which allows to monitor parameters which are not available in standard
|
|
mibs.
|
|
<p>check_netsnmp plugin for <a
|
|
href="http://www.nagios.org/">Nagios</a> is written in perl, uses no
|
|
external commands and
|
|
requires <code>utils</code> module, available from <a
|
|
href="http://www.nagios.org/">Naguios-plugins</a>
|
|
distribution, and <code>Net::SNMP</code> module, available from <a
|
|
href="http://www.cpan.org">CPAN</a>.
|
|
<p><b>Usage.</b> Put <code>check_netsnmp</code> plugin to the
|
|
directory in which you installed nagios-plugins (typically $USER1$
|
|
variable points to it).
|
|
<ol>
|
|
<li><b>Monitoring free disk space.</b> Used in conjunction with
|
|
<code>disk</code> keyword in <code>snmpd.conf</code>. Imagine that
|
|
you have two mount points on the monitored machine: <code>/</code> and
|
|
<code>/var</code> and you want to be sure <code>/</code> has more than
|
|
<code>20%</code> free space and <code>/var</code> has more that
|
|
<code>30%</code> free space. Put the following lines to the
|
|
<code>snmpd.conf</code>:
|
|
<pre>
|
|
disk / 20%
|
|
disk /var 30%
|
|
</pre>
|
|
Next, define the following command in your Nagios configuration:
|
|
<pre>
|
|
define command{
|
|
command_name check_disk
|
|
command_line $USER1$/check_netsnmp -H $HOSTADDRESS$ -o disk
|
|
}
|
|
</pre>
|
|
and add the relevant service:
|
|
<pre>
|
|
define service{
|
|
use generic-service
|
|
host_name host.name.ru
|
|
service_description disks
|
|
check_command check_disk
|
|
}
|
|
</pre>
|
|
|
|
The same procedure applies to checking swap, processes and load averages
|
|
(use with <code>swap</code>, <code>proc</code> and <code>load</code>
|
|
keywords in <code>snmpd.conf</code>).
|
|
|
|
<li><b>Monitoring free mbuf clusters.</b> This is a bit harder since
|
|
there are no corresponding mibs in snmpd. Here is where snmpd's
|
|
<code>exec</code> keyword may be used. Write your own script which
|
|
checks for mbuf clusters and returns 0 if there are enough of them
|
|
free, and 1 if there are not. An example may be found <a
|
|
href="mbufmon.sh">here</a>. Then put the folowing line in your
|
|
snmpd.conf:
|
|
<pre>
|
|
exec .1.3.6.1.4.1.2021.8.3 MBufMon /usr/local/share/snmp/exec/mbufmon.sh
|
|
</pre>
|
|
|
|
Define the following command in your Nagios configuration:
|
|
<pre>
|
|
define command{
|
|
command_name check_mbufmon
|
|
command_line $USER1$/check_netsnmp -H $HOSTADDRESS$ -o 3
|
|
}
|
|
</pre>
|
|
You may use the full OID instead of just 3 here, if you export the
|
|
result of mbufmon.sh under nonstandard OID.
|
|
<code>.1.3.6.1.4.1.2021.8.</code> is prepended to 3 in this example
|
|
automatically. Finally, add the service to check for mbufs:
|
|
<pre>
|
|
define service{
|
|
use generic-service
|
|
host_name host.name.ru
|
|
service_description MBufMon
|
|
check_command check_mbufmon
|
|
}
|
|
</pre>
|
|
</ol>
|
|
<hr>
|
|
Please send your comments and suggestions to <a
|
|
href="mailto:trtrmitya@gmail.com">me</a>.
|
|
</body>
|
|
</html>
|