LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 03-28-2006, 03:20 AM   #1
MikeFoo1
Member
 
Registered: Apr 2004
Distribution: Slackware 9.1
Posts: 72

Rep: Reputation: 15
Nagios config ?


Hi all,



I have spent most of my day trying to configure nagios and have had limited success. I got it up and running (installation, webinterface set up and authourisation) but struggling with configuration files.
I know that I need to configure a number of files: nagios.cfg, hosts.cfg, hostgroups.cfg , services.cfg, contacts.cfg, contactgroups.cfg (bare minimum). I have tried to configure them but I always get some kind of errors/warnings. Could someone post a working sample of the above files ?


Any help would be greatly appreciated :-).
 
Old 03-28-2006, 07:53 PM   #2
ckoniecny
Member
 
Registered: Oct 2005
Posts: 162

Rep: Reputation: 30
Post your config files and post the error your getting.
 
Old 03-30-2006, 11:41 PM   #3
MikeFoo1
Member
 
Registered: Apr 2004
Distribution: Slackware 9.1
Posts: 72

Original Poster
Rep: Reputation: 15
Hi there,

I got it working but still have a small problem. The only thing that I can't do is to use web interface to start/stop/reschedule nagios. The error I am gettin is
Quote:
Error: Could not stat() command file '/usr/local/nagios/var/rw/nagios.cmd'!
.

I think I have setup my permissions correclty:




Quote:
drwxrws--- 2 nagios nagcmd 4.0K Mar 29 10:25 rw


prw-rw---- 1 nagios nagcmd 0 Mar 29 10:25 nagios.cmd
and

Quote:
nagios:x:501:
nagcmd:x:502:apache,nagios

any suggestions ?
 
Old 03-31-2006, 04:27 AM   #4
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
Are you sure nagios.cmd doesn't need to be an executable file rather than a FIFO pipe (hence "p" at the beginning of permissions)?
But that probably isn't the problem, since "stat()" should work anyways probably.

Under what user is your web interface running? Does this user have access to the nagios.cmd file and execute permission on all directories above? (so all dirs in /usr/local/nagios/var/rw/nagios.cmd)?
Also, does the web interface use a chroot environment?
 
Old 08-12-2007, 12:18 AM   #5
natter
LQ Newbie
 
Registered: Aug 2007
Posts: 1

Rep: Reputation: 0
resolution

I came across this thread and thought I post post to anyone who is getting this error and is certain their permissions are set correctly.

I played with this for hours and hours and hours and RTFM helped me. (I am on CentOS)

The following fixed my problem: (this is right from the Nagios docs)

8) Modify SELinux Settings

Fedora ships with SELinux (Security Enhanced Linux) installed and in Enforcing mode by default. This can result in "Internal Server Error" messages when you attempt to access the Nagios CGIs.

See if SELinux is in Enforcing mode.

getenforce

Put SELinux into Permissive mode.

setenforce 0

To make this change permanent, you'll have to modify the settings in /etc/selinux/config and reboot.

Instead of disabling SELinux or setting it to permissive mode, you can use the following command to run the CGIs under SELinux enforcing/targeted mode:

chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/
chcon -R -t httpd_sys_content_t /usr/local/nagios/share/
 
Old 11-06-2008, 10:50 PM   #6
junaid18183
Member
 
Registered: Mar 2005
Location: India
Distribution: RedHat 9.0 and EL
Posts: 31

Rep: Reputation: 15
still not working for me

I got the same error, I tried with disabling the se linux setting also tried

chcon -R -t httpd_sys_content_t /usr/local/nagios/sbin/ and
chcon -R -t httpd_sys_content_t /usr/local/nagios/share/


but still not working for me

Juned
 
Old 12-22-2008, 06:05 PM   #7
fngreno
LQ Newbie
 
Registered: Dec 2008
Distribution: CentOS
Posts: 3

Rep: Reputation: 0
I'm having a very similar problems on CentOS. If I "setenforce 0" then I can run external Nagios commands. I tried the chcon command above without success. The problem is SELinux but configuring SELinux is more cryptic then Sendmail. Any help or suggestions is appreciated.

Thanks!
 
Old 10-08-2009, 02:15 AM   #8
jkoo
LQ Newbie
 
Registered: Oct 2009
Posts: 1

Rep: Reputation: 1
Solution

Hi, i have had the same problem for a long time.

This might be a bit late now since the thread is over a year old but still, maybe it helps other people.

for me i made an error during the starting,

if you follow the nagios quick start guide (which most of you did i assume) at the end of the installation you have to start nagios with the following command: "/etc/init.d/nagios start" and if you do this twice for some reason it loads nagios twice and runs into an error because it doesnt know which of the two to restart.

so just stop and start it

1. /etc/init.d/nagios stop
2. /etc/init.d/nagios start

you might want to run the stop twice just to make sure both nagios are stopped again before restarting. (ofcourse you can use the reload or force-reload option but i'd rather try the stop)

Greetings
 
1 members found this post helpful.
Old 10-08-2009, 11:50 AM   #9
Zenaku
LQ Newbie
 
Registered: Oct 2009
Distribution: Centos 5, Fedora 11
Posts: 2

Rep: Reputation: 0
Quote:
Originally Posted by MikeFoo1 View Post
Hi there,

I got it working but still have a small problem. The only thing that I can't do is to use web interface to start/stop/reschedule nagios. The error I am gettin is
Quote:
Error: Could not stat() command file '/usr/local/nagios/var/rw/nagios.cmd'!
.
Dude, i got the same problem here, but I check the /usr/local/nagios/var/rw and the nagios.cmd doesn't exist, so much in the folder as in the whole PC.

EDIT: I got the problem. Make sure you have installed postfix.

Last edited by Zenaku; 10-08-2009 at 12:31 PM.
 
Old 09-12-2010, 12:11 PM   #10
amonamarth
Member
 
Registered: Dec 2009
Location: Los Angeles
Distribution: Fedora ,CentOS, RHEL
Posts: 59

Rep: Reputation: 17
Question Nagios: Error: Could not stat() command file '/usr/local/nagios/var/rw/nagios.cmd'!

The problem with this issue is definitely with SELinux, if you temporarily set it to permissive mode, all external commands work well. The question now is: What to do so that you can set SELinux to enforcing mode while still having Nagio's external commands working?
 
Old 10-19-2010, 09:38 AM   #11
Dave Barnett
LQ Newbie
 
Registered: Jun 2007
Location: S.F. Bay Area
Distribution: Debian / RedHat
Posts: 4

Rep: Reputation: 0
I found this thread in a search, and likewise I think the problem is related to selinux - just because I've had so many other problems with selinux. But in this case I setenforce 0 and am still seeing the issue.

I compared the permissions with a "known good" instance of Nagios & they're the same:

[root@monitor rw]# ls -lt
total 4
prw-rw---- 1 nagios nagios 0 Oct 19 07:19 nagios.cmd
[root@monitor rw]# cd /var/log/
[root@monitor log]#

Also, I see that the date on the file is updated when I execute the command - so it is doing something. Any clues?
 
Old 04-09-2011, 03:08 PM   #12
tarrall
LQ Newbie
 
Registered: Apr 2011
Posts: 1

Rep: Reputation: 0
Quote:
Originally Posted by amonamarth View Post
The problem with this issue is definitely with SELinux, if you temporarily set it to permissive mode, all external commands work well. The question now is: What to do so that you can set SELinux to enforcing mode while still having Nagio's external commands working?
This will help with the SElinux issue without disabling SElinux entirely:
Code:
sudo chcon -R -t httpd_sys_script_rw_t /usr/local/nagios/var/rw

Last edited by tarrall; 04-10-2011 at 12:58 AM. Reason: chcon whole directory so keeps working after restart
 
Old 04-28-2011, 08:26 PM   #13
vijay60
LQ Newbie
 
Registered: Apr 2011
Posts: 1

Rep: Reputation: 0
Quote:
Originally Posted by tarrall View Post
This will help with the SElinux issue without disabling SElinux entirely:
Code:
sudo chcon -R -t httpd_sys_script_rw_t /usr/local/nagios/var/rw
Hi

Thanks for your info. I was unable to modify the type to httpd_sys_script_t instead httpd_sys_script_rw_t worked. Can you let me know any other things I have to know behind this scene. I was doing this becoz errors in /var/log/messages say that it is trying to access the file as type httpd_sys_script_t
 
Old 11-13-2011, 10:16 PM   #14
vyncynt
LQ Newbie
 
Registered: Nov 2009
Location: cebu
Distribution: fedora
Posts: 4

Rep: Reputation: 0
Quote:
Originally Posted by jkoo View Post
Hi, i have had the same problem for a long time.

This might be a bit late now since the thread is over a year old but still, maybe it helps other people.

for me i made an error during the starting,

if you follow the nagios quick start guide (which most of you did i assume) at the end of the installation you have to start nagios with the following command: "/etc/init.d/nagios start" and if you do this twice for some reason it loads nagios twice and runs into an error because it doesnt know which of the two to restart.

so just stop and start it

1. /etc/init.d/nagios stop
2. /etc/init.d/nagios start

you might want to run the stop twice just to make sure both nagios are stopped again before restarting. (ofcourse you can use the reload or force-reload option but i'd rather try the stop)

Greetings

when I checked the location nagios.cmd was not even there.
after stopping and starting the service again nagios.cmd is now present and everything went back to normal.
 
Old 12-01-2011, 05:39 PM   #15
glenn.e.harrison
LQ Newbie
 
Registered: Dec 2011
Location: Elizabeth City, NC
Distribution: CentOS / Red Hat
Posts: 1

Rep: Reputation: Disabled
nagios / chcon

The problem I have found with using the chcon command is the file context being restored to the original context upon a system relabel. I think it is best to add the changes to the selinux database with:

semanage fcontext -a -f "-p" -t httpd_sys_rw_content_t '/usr/local/nagios/var/rw/nagios.cmd'

Then you can just issue: restorecon -R /usr/local/nagios/var/rw/nagios.cmd

If the system performs a relabel, the file will keep the 'httpd_sys_rw_content_t' context type.

If you can't find semanage, it is provided by the policycoreutils-python-* package. Just do a "yum whatprovides '*/semanage'" and install the correct package.

...Glenn...

Last edited by glenn.e.harrison; 12-02-2011 at 10:26 AM.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with nagios config ignus Linux - Software 4 07-26-2005 08:17 AM
Nagios Config Verification Problem creighzy Ubuntu 3 04-20-2005 12:46 PM
Nagios? suresheva31 Linux - General 2 10-13-2004 07:55 AM
Nagios VincentB Linux - Software 3 09-09-2003 09:20 AM
Nagios markus1982 Linux - Software 1 04-01-2003 06:04 AM


All times are GMT -5. The time now is 09:38 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration