Monitoring FreeBSDs ports

I do manage several FreeBSD boxes, and often there are more than sysadmins than I. So I was looking for nice tool to monitor what ports are exactly installed and what have changed (application versions). I did not do extensive lookups, but I didn’t find anything suitable. So I wrote simple shell script to do this task. Now, go to details.

It just stores contents of /var/db/pkg directory, and runs diff against current version. Diff results (if any) are send to chosen email address. You can expect following entries:

  • port1 --> port2 – this means port1 was replaced by port2
  • --> port1port1 was installed
  • port1port1 was removed

Simple like that. Download it, and customize variables inside:

  • DATA – where script should store current ports list
  • TMP – temporary file
  • TO – email address which will receive reports

Choosing TMP and DATA remember about race danger, so don’t run this as root, or choose place where users have no access. You can run this periodically from cron.

An finally – fetch script from http://nhw.pl/download/portmon.sh.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.