Check port versions - NRPE pkg version check: Difference between revisions

From TykWiki
Jump to navigationJump to search
No edit summary
Line 2: Line 2:
[[category:nagios]]
[[category:nagios]]
[[category:Ports_Management]]
[[category:Ports_Management]]
A nagios plugin I wrote, which checks the number of outdated ports on a system. If the number exceeds the configured limits, WARNING or CRITICAL is returned. The plugin depends on the file <code>/tmp/check_portmaster.tmp</code> which should contain the output from the <code>portmaster -L</code> command. Obviously, this also means that portmaster is required for this to make any sense.
A nagios plugin I wrote, which checks the number of outdated ports on a system. If the number exceeds the configured limits, WARNING or CRITICAL is returned. The plugin runs <code>pkg_info -o</code> and thus only needs the ports INDEX-x file to be up to date.


== Download the plugin ==
== Download the plugin ==
The plugin can be downloaded to the correct place (and made executable) with the following commands:
The plugin can be downloaded to the correct place (and made executable) with the following commands:
<pre>
<pre>
sudo fetch -o /usr/local/libexec/nagios/check_portmaster http://www.gibfest.dk/check_portmaster
sudo fetch -o /usr/local/libexec/nagios/check_port_versions http://www.gibfest.dk/check_port_versions
sudo chmod +x /usr/local/libexec/nagios/check_portmaster
sudo chmod +x /usr/local/libexec/nagios/check_port_versions
</pre>
</pre>


Feel free to check the source code to see what it does, it is pretty simple and well commented.
Feel free to check the source code to see what it does, it is very simple and well commented.


== Configuring NRPE ==
== Configuring NRPE ==
Add the following line to <code>/usr/local/etc/nrpe.cfg</code>:
Add the following line to <code>/usr/local/etc/nrpe.cfg</code>:
<pre>
<pre>
command[check_portmaster]=/usr/local/libexec/nagios/check_portmaster
command[check_port_versions]=/usr/local/libexec/nagios/check_port_versions
</pre>
</pre>


Line 24: Line 24:
</pre>
</pre>


== Updating the portmaster output file ==
== Updating ports ==
I add the following line to <code>/etc/crontab</code> to create an hourly updated <code>/tmp/check_portmaster.tmp</code> file:
I add the following line to <code>/etc/crontab</code> to create an hourly updated <code>/tmp/check_portmaster.tmp</code> file:
<pre>
<pre>

Revision as of 23:25, 9 March 2010

A nagios plugin I wrote, which checks the number of outdated ports on a system. If the number exceeds the configured limits, WARNING or CRITICAL is returned. The plugin runs pkg_info -o and thus only needs the ports INDEX-x file to be up to date.

Download the plugin

The plugin can be downloaded to the correct place (and made executable) with the following commands:

sudo fetch -o /usr/local/libexec/nagios/check_port_versions http://www.gibfest.dk/check_port_versions
sudo chmod +x /usr/local/libexec/nagios/check_port_versions

Feel free to check the source code to see what it does, it is very simple and well commented.

Configuring NRPE

Add the following line to /usr/local/etc/nrpe.cfg:

command[check_port_versions]=/usr/local/libexec/nagios/check_port_versions

Remember to restart NRPE after changing the config:

sudo /usr/local/etc/rc.d/nrpe2 restart

Updating ports

I add the following line to /etc/crontab to create an hourly updated /tmp/check_portmaster.tmp file:

0	*	*	*	*	root	/usr/local/sbin/portmaster -L > /tmp/check_portmaster.tmp

To make the NRPE check work right away, run the following command manually:

/usr/local/sbin/portmaster -L > /tmp/check_portmaster.tmp