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

Posted by on April 17, 2010 at 2:55 am.

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.

  • kub

    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

  • Alex Yarochkin

    Works for me!

  • Love C4

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

  • Love C4

    I need on CENTOS 5.5

  • Anonymous

    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.

  • Niraj8241

    works for me

Secured for spam by MLW and Associates, LLP's Super CAPTCHASecured by Super-CAPTCHA © 2009-2010 MLW & Associates, LLP. All rights reserved.

More in Geek Stuff, Linux (6 of 52 articles)