Check port versions - NRPE pkg version check: Difference between revisions
No edit summary |
No edit summary |
||
(10 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:check_port_versions - NRPE pkg_version check}} | |||
[[category:nagios]] | |||
[[category:Ports_Management]] | |||
check_port_versions is a nagios plugin I wrote, which checks the number of outdated ports installed on a FreeBSD system, compared to what is in <code>/usr/ports</code>. 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/ | sudo fetch -o /usr/local/libexec/nagios/check_port_versions http://www.gibfest.dk/check_port_versions | ||
sudo chmod +x /usr/local/libexec/nagios/ | 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 | Feel free to check the source code to see what it does, it is very simple and well commented. | ||
== NRPE | == Configuring NRPE == | ||
Add the following line to | Add the following line to <code>/usr/local/etc/nrpe.cfg</code>: | ||
<pre> | |||
command[check_port_versions]=/usr/local/libexec/nagios/check_port_versions | |||
</pre> | |||
Remember to restart NRPE after changing the config: | |||
<pre> | <pre> | ||
sudo /usr/local/etc/rc.d/nrpe2 restart | |||
</pre> | </pre> | ||
== Updating | == Updating ports == | ||
I update ports daily from <code>/etc/crontab</code> with the following <code>portsnap</code> commands: | |||
<pre> | <pre> | ||
0 | #update ports | ||
0 12 * * * root /usr/sbin/portsnap cron && /usr/sbin/portsnap -I update | |||
</pre> | </pre> | ||
'''Note:''' The above <code>/etc/crontab</code> line will download the latest snapsnot and update the ports index files. The ports themselves will not be extracted. As explained in the portsnap manpage, it is a bad idea to automatically update /etc/ports - bad things will happen if you accidently update while installing something. This means that you should run <code>portsnap update</code> before installing/upgrading any ports. |
Latest revision as of 23:38, 9 March 2010
check_port_versions is a nagios plugin I wrote, which checks the number of outdated ports installed on a FreeBSD system, compared to what is in /usr/ports
. 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 update ports daily from /etc/crontab
with the following portsnap
commands:
#update ports 0 12 * * * root /usr/sbin/portsnap cron && /usr/sbin/portsnap -I update
Note: The above /etc/crontab
line will download the latest snapsnot and update the ports index files. The ports themselves will not be extracted. As explained in the portsnap manpage, it is a bad idea to automatically update /etc/ports - bad things will happen if you accidently update while installing something. This means that you should run portsnap update
before installing/upgrading any ports.