[Nagios] Error: Could not stat() command file ‘/var/lib/nagios3/rw/nagios.cmd’!

System: Ubuntu 9.10 | Nagios 3.x

This is another post that is more of a note to myself than anything else. Been doing a lot of Nagios configuring and decided to implement the ability to push commands from the web interface. I followed the basic instructions to configure "External Commands" but after doing and going to the web interface to test it, I got the following error message;

Error: Could not stat() command file '/var/lib/nagios3/rw/nagios.cmd'!

The external command file may be missing, Nagios may not be running, and/or Nagios may not be checking external commands. An error occurred while attempting to commit your command for processing.

The file was there so I did what any good geek should do, I did a quick google search. The closet thing I could find was some commands to fix the issue on Debian systems. Since I was running Ubuntu, which is for all intensive purposes Debian, I figured I would try it.  So I ran the following set of command;

sudo /etc/init.d/nagios3 stop
sudo dpkg-statoverride --update --add nagios www-data 2710 /var/lib/nagios3/rw
sudo dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3
sudo /etc/init.d/nagios3 start

This worked like a charm and the web interface began accepting commands.

Fatal error: Call to undefined function: pn_dbmsgerror()

Had a strange error message on one of the sites I manage. It said "Fatal error: Call to undefined function: pn_dbmsgerror()". This is a Post Nuke CMS system and the error occurred after a reboot to the physical server and we made some space on a partition that had filled up.

Turned out the problem was a corrupted table in the Post Nuke database. The table _referer got twisted and didn't know what it wanted to do with itself. This table is only used for tracking where people come from who visit your site, so since I had a back up of the database, I just nuked the table and copied over the table from the back up database. That got everything up and running again perfectly.