nagios.cmd command failure

SCHAER Frederic frederic.schaer at cea.fr
Thu Jan 3 11:17:51 CET 2008


Or : you may be running SElinux... In any way, nagios is happy if you
provide it with an already created pipe, which correct rights.

I've been getting hard time having nagios running on a SElinux server,
because at each beta/RC update file and directories permissions had to
be added again so that SELinux allows apache to read/write files. 

So if this is an SELinux problem (check /var/log/messages for weird
errors about context things), you can try what follows.

In my case, I'm running a Scientific Linux box (RHEL), which already has
SELinux policies for httpd - you can try :
man httpd_selinux

(man page was installed with selinux-policy-targeted rpm)

In my case again, I have to do such things in order to get write access
granted to httpd (I added this in the %post specfile macro):

if [ -x /usr/bin/chcon ]; then
        [ -d /var/spool/nagios ] && /usr/bin/chcon -R -t
httpd_sys_content_t /var/spool/nagios
        [ -d /var/log/nagios ] && /usr/bin/chcon -R -t
httpd_sys_content_t /var/log/nagios
        FIFO=/var/spool/nagios/nagios.cmd
        [ ! -p $FIFO ] && mkfifo -m 660 $FIFO && chown
%{nsusr}:%{cmdgrp} $FIFO
        [ -p $FIFO ] && /usr/bin/chcon -t httpd_sys_script_rw_t $FIFO
fi

(following goes in the %post www)
if [ -x /usr/bin/chcon ]; then
        [ -d /usr/lib/nagios/cgi ] && /usr/bin/chcon -R -t
httpd_sys_script_exec_t /usr/lib/nagios/cgi
fi

Magic command is chcon, but it's hard to find about the
httpd_sys_blahblah stuff...

Regards

P.S : to check existing SELinux rights, try ls -lZ ;)

> -----Original Message-----
> From: nagios-users-bounces at lists.sourceforge.net [mailto:nagios-users-
> bounces at lists.sourceforge.net] On Behalf Of Patrick Morris
> Sent: Thursday, January 03, 2008 3:35 AM
> To: Nate Tompkins
> Cc: nagios-users at lists.sourceforge.net
> Subject: Re: [Nagios-users] nagios.cmd command failure
> 
> On Thu, 03 Jan 2008, Nate Tompkins wrote:
> 
> > When trying to update anything on the website i get this error
message:
> >
> > Error: Could not open command file
'/usr/local/nagios/var/rw/nagios.cmd' for update!
> > The permissions on the external command file and/or directory may be
incorrect. Read the FAQs on
> how to setup proper permissions.
> > An error occurred while attempting to commit your command for
processing.
> >
> > Return from whence you came<javascript:window.history.go(-2)>
> >
> > I have tried everything with the permissions, restarted the service
and web service.. From what i
> read the nagios.cmd is made upon start up. Is there away to create a
new nagios.cmd or copy and
> past one in?
> 
> Nope... though the good news is that if the permissions on
> /usr/local/nagios/var/rw are correct, Nagios *will* create the pipe
for
> you when it starts.
> 
> You just need to make sure that the file it creates is writeable by
the
> user your webserver runs as. If it's not, chances are you compiled
> Nagios yourself and used incorrect configure flags for how your
> webserver is configured.  At that point your options are to either
> recompile with the correct flags, or to modify the user your webserver
> runs as so that it has write privileges to that file.
> 
>
------------------------------------------------------------------------
-
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when
reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list