[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;
[shell]
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.
[/shell]
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;
[bash]
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
[/bash]
This worked like a charm and the web interface began accepting commands.

Advertisements
Tagged , ,

6 thoughts on “[Nagios] Error: Could not stat() command file '/var/lib/nagios3/rw/nagios.cmd'!

  1. kub says:

    on ubunto 10.4

    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

  2. Alex Yarochkin says:

    Works for me!

  3. Love C4 says:

    I tried given above cmd but it is not working, it is showing error as command not found.

  4. Love C4 says:

    I need on CENTOS 5.5

    • Anonymous says:

      I assume the command you are referring to is dpkg-statoverride. Haven’t needed to do this on a CENTOS (or any other Red Hat derived) machine. Can you install from yum? Is it include in the dpkg package? I did do a quick Google for dpkg-statoverride and got a ton of results.

      When I get sometime I will spin up a CentOS VM and see if I can figure out what package you need.

  5. Niraj8241 says:

    works for me

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: