Error: Could not open command file ‘/usr/local/nagios/var/rw/nagios.cmd’ for update!

If you’re updating nagios, and/or you are trying to reschedule checks manually, and you get the error below:

Error: Could not open command file ‘/usr/local/nagios/var/rw/nagios.cmd’ for update!

Then it means that the permissions on the folder are messed up. Don’t bother setting up the permissions on the file itself, nagios.cmd,  since that file gets recreated very often, so:

chown nagios.nagcmd /usr/local/nagios/var/rw 
chmod g+rwx /usr/local/nagios/var/rw 
chmod g+s /usr/local/nagios/var/rw

This should get you up and running without problems.

Republished by Blog Post Promoter

About author

admin
admin 87 posts

I have been working with Linux based systems since 2002. I hope the article published on this site will be useful to those new to server administration.

You might also like

Troubleshooting 0 Comments

Exim Error: Ratelimit database not available

If you find any of the following errors below in your /var/log/exim_mainlog log file. The fix below should resolve these errors 2013-12-22 03:16:00 Failed to get write lock for /var/spool/exim/db/ratelimit.lockfile:

Troubleshooting 0 Comments

How to find out the spam mailing script’s location – Exim

The Exim mail server has a lot of options/commands to find out the details of spammers easily from the command line. We can find out the mail queue details, spam

Troubleshooting 1Comments

Find out the spam mailing script’s location – Exim

The Exim mail server has a lot of options/commands to find out the details of spammers easily from the command line. Click this link “Spam Check” to get more ideas.

  • Linbynd

    i have done the same steps over and over again.. but has not worked for me…[root@centos-64 sbin]# /usr/local/nagios/bin/nagios -V

    Nagios Core 3.2.2

    —————————–

    ll -d /usr/local/nagios/var/rw/
    drwxrwsr-x 2 nagios nagcmd 4096 May  2 02:02 /usr/local/nagios/var/rw/
    [root@centos-64 sbin]# ll /usr/local/nagios/var/rw/
    total 0
    prwxrwxrwx 1 nagios nagcmd 0 May  2 02:06 nagios.cmd

    Only works after I give full permission to nagios.cmd… after a restart…

    • jj

      not working.

      • Admin

        This does not apply to every situation since there could be other issues as well, but this is a method to try and has fixed it for our situations.

  • Babu Dhinakaran S

    Guys,

    This means the the nagios.cmd file doesn’t has a permission to execute from the WEB i.e., apache. do the following and restart the Nagios and Apache/httpd
    /etc/group

    nagios:x:500:nagios,apache
    nagcmd:x:501:nagios,apache

    your are done..

    • Aniruddha

      Thanks Babu Dhinakaran S…..Works like dream. Thanks a lot!!!! :)

    • srikanth

      Its not working

    • JohnOCFII

      Thanks Babu – some how in a partial re-installation apache was left out of the permissions in /etc/group. This fixed me right up!

  • me

    10x!

  • Pawel

    try that:
    chcon -R -t httpd_sys_script_rw_t /usr/local/nagios/var/rw

    • Ariel Rivera

      This one worked for me on RedHat 5.
      After I added the “nagios, apache, www-data ” tip it was still not working , so this “chcon” solved it.

  • Pingback: Nagios: Could not open command file '/usr/local/nagios/var/rw/nagios.cmd' for update! | FreyrLin's()

  • Andy

    That got it working for me on my Raspberry Pi. Thanks.