I experienced this problem recently with a long standing instance of Nagios which had recently been updated. The is was that
Error: Could not open command file ‘/usr/local/nagios/var/rw/nagios.cmd’ for update!
was displayed when trying to change the properties for a host – such as enabling alerts or acknowledging alerts.
The solution was to check and change the permissions on the folder holding the file in question
chown nagios.nagiocmd /usr/local/nagios/var/rw
chmod g+rwx /usr/local/nagios/var/rw
chmod g+s /usr/local/nagios/var/rw
Restart Nagios and test to ensure you can make changes to the checks.