[Nagiosplug-help] HELP please! newbie to nagios

Andreas Ericsson ae at op5.se
Fri Apr 29 16:03:34 CEST 2005


HP Geeza wrote:
> Hi
> 
> Ok i have finally managed to fix the problem!!!!! - thanks for your help.
> 
> However i now face a different problem: I can't seem to monitor a 
> windows machine for things like
> Uptime, Disk Space C, CPU Load, Memuse and a service.  Its the 
> check_command parameter i am having troble with.  I dont quiet 
> understand how nagios handles the commands and how i tell it to run 
> different commands/checks
> 
> FYI here's one service which i tried but it dont seem to work:
> 
> define service{
> use generic-service ; Name of service template to use
> hostgroup_name windows-server
> service_description C: Drive
> is_volatile 0
> check_period 24x7
> max_check_attempts 4
> normal_check_interval 5
> retry_check_interval 1
> contact_groups windows-admin
> notification_interval 960
> notification_period 24x7
> check_command check_local_disk!20%!10%!C
> }
> 
> PLEASE NOTE: this is a remote windows 2003 machine which i want to 
> monitor (i have got nsclient installed and the nagios service is 
> register and running). I have tried both 'check_local_disk' and 
> 'check_disk' (as i thought you can't use check_local_disk command for 
> remote machines??

You thought correct.

> BUT they dont work
> 

No wonder.

Read the manual section covering commands. Then read the manual section 
covering services. Connect the two and you should be good to go.

Hint: You need to make a check-command using the check_nt plugin where 
the first argument (to the plugin) is -H $HOSTADDRESS$

> When i run: #/usr/local/nagios/bin/nagios -v nagios.cfg
> i get:
> Error: Service check command 'check_disk' specified in service 'C: 
> Drive' for host 'windowsbox' not defined anywhere!
>        Checked 8 services.
> 
> Here is a sample host definition:
> define host{
>        use                     generic-host            ; Name of host 
> template to use
>        host_name               windowsbox
>        alias                   Windows Server
>        address                 <ip address>
>        check_command           check-host-alive
>        max_check_attempts      10
>        notification_interval   120
>        notification_period     24x7
>        notification_options    d,u,r
>        contact_groups          windows-admins
>        }
> 
> Where else do i need to define this service??
> 
> Im nearlly there, just a little more configuration to do..
> 
> 
>> From: Andreas Ericsson <ae at op5.se>
>> To: Nagios Users List <Nagios-users at lists.sourceforge.net>
>> Subject: Re: [Nagios-users] Re: [Nagiosplug-help] HELP please! newbie 
>> to nagios
>> Date: Wed, 27 Apr 2005 20:34:10 +0200
>>
>> Please direct your replies to nagios-users at lists.sourceforge.net so 
>> that others may benefit from the responses.
>>
>> HP Geeza wrote:
>>
>>> I am running Fedora Core 3...after doing: 
>>> #system-config-securitylevel - I see the firewall setting is disabled
>>>
>>
>> What does the httpd targeted policy look like?  It should reside in a 
>> file in /etc/selinux/targeted/src/policy/domains/ and be named either 
>> httpd or apache, or possibly apache.te.
>>
>>> After doing: #grep ^apache: /etc/passwd
>>> i get: apache:x:48:48:Apache:/var/www:/sbin/nologin   - Sooo no shell 
>>> shown there!
>>>
>>
>> This is the reason you can't su to the apache user. man chsh, or edit 
>> /etc/passwd manually.
>>
>>> After doing: #ls -la /usr/local/nagios/{,sbin}
>>> i get:
>>> drwxrwxr-x  2 nagios nagcmd   4096 Apr 27 13:33 .
>>> drwxr-xr-x  8 nagios nagcmd   4096 Apr 26 16:35 ..
>>> -rwxrwxrwx  1 nagios nagcmd 158200 Apr 25 14:57 avail.cgi
>>> -rwxrwxrwx  1 nagios nagcmd 159040 Apr 25 14:57 cmd.cgi
>>> -rwxrwxrwx  1 nagios nagcmd 121240 Apr 25 14:57 config.cgi
>>> -rwxrwxrwx  1 nagios nagcmd 174624 Apr 25 14:57 extinfo.cgi
>>> -rwxrwxrwx  1 nagios nagcmd 111512 Apr 25 14:57 history.cgi
>>> -rw-r--r--  1 nagios nagcmd    109 Apr 25 16:17 .htaccess
>>> -rwxrwxrwx  1 nagios nagcmd 107384 Apr 25 14:57 notifications.cgi
>>> -rwxrwxrwx  1 nagios nagcmd 105660 Apr 25 14:57 outages.cgi
>>> -rwxrwxrwx  1 nagios nagcmd 105912 Apr 25 14:57 showlog.cgi
>>> -rwxrwxrwx  1 nagios nagcmd 157436 Apr 25 14:57 status.cgi
>>> -rwxrwxrwx  1 nagios nagcmd 120280 Apr 25 14:57 statuswml.cgi
>>> -rwxrwxrwx  1 nagios nagcmd 107416 Apr 25 14:57 statuswrl.cgi
>>> -rwxrwxrwx  1 nagios nagcmd 126104 Apr 25 14:57 summary.cgi
>>> -rwxrwxrwx  1 nagios nagcmd 124444 Apr 25 14:57 tac.cgi
>>>
>>
>> That's weird. It should also show the permissions of /usr/local/nagios
>> Ok, first of all, do
>>
>> # chmod -R 755 /usr/local/nagios/sbin
>> # chown -R root:root /usr/local/nagios/sbin
>>
>> because there's no reason what so ever to have those files 
>> world-writable.
>>
>> Then do
>> ls -ld /usr /usr/local /usr/local/nagios
>> and send me the output.
>>
>>>
>>> Arghhhh Nagios seems like such a hard system!!!! I haven't even began 
>>> to monitor anything....jus trying to view the cgi pages seems hard 
>>> enough
>>>
>>
>> Actually, you're having problems with apache, not nagios. You would 
>> have  exactly this same problem if you were trying to install any 
>> other cgi-based web-app (although other apps might come with better 
>> documentation).
>>
>> Your problems with Nagios will come later. ;)
>>
>> Another thing that would really help is if you could attach the 
>> relevant parts of your apache config.
>>
>> sed -n /\/usr\/local\/nagios\/,/^</p /etc/httpd/{conf,conf.d}/*
>>
>> should extract it for you. Mind the backslashes. They are 
>> unfortunately required in address regexes as implemented by sed up to 
>> and including version 4.1.1.
>>
>>>
>>>> From: Andreas Ericsson <ae at op5.se>
>>>> To: Nagios Users List <Nagios-users at lists.sourceforge.net>
>>>> Subject: Re: [Nagios-users] Re: [Nagiosplug-help] HELP please! 
>>>> newbie to nagios
>>>> Date: Wed, 27 Apr 2005 17:57:04 +0200
>>>>
>>>> HP Geeza wrote:
>>>>
>>>>>
>>>>> Ermmm when i do: (apache is the user my webserver is running as)
>>>>> #su - apache /usr/local/nagios/sbin/status.cgi
>>>>> I get:
>>>>> This account is currently not available
>>>>>
>>>>
>>>> Are you running Fedora Core or some RHEL with SELinux? If so, turn 
>>>> it off.
>>>> Otherwise,
>>>> grep ^apache: /etc/passwd
>>>> check what the shell is and make sure it's not /bin/false or some such.
>>>>
>>>>> I dont understand how this is possible since i can log into the web 
>>>>> interface? - Thus this proves that apache is running becuase it is 
>>>>> servering the web pages for nagios.
>>>>>
>>>>
>>>> Yes. Programs have nicer ways of dropping privileges than invoking 
>>>> an external program.
>>>>
>>>>> FYI i have a group called nagcmd (suggested by the docs) which 
>>>>> apache is a memeber.
>>>>> After doing: #ls -l /usr/local/nagios/
>>>>>
>>>>> I get:
>>>>> drwxrwxr-x  2 nagios nagcmd 4096 Apr 25 14:57 bin
>>>>> drwxr-xr-x  4 nagios nagcmd 4096 Apr 27 16:05 etc
>>>>> drwxr-xr-x  2 nagios nagcmd 4096 Apr 26 16:35 libexec
>>>>> drwxrwxr-x  2 nagios nagcmd 4096 Apr 27 13:33 sbin
>>>>> drwxrwxr-x  9 nagios nagcmd 4096 Apr 27 12:35 share
>>>>> drwxrwxr-x  3 nagios nagcmd 4096 Apr 27 16:16 var
>>>>>
>>>>> So i can't see anything wrong on that front!
>>>>>
>>>>> Any ideas??? sorry to keep on hassling you!
>>>>>
>>>>
>>>> ls -la /usr/local/nagios/{,sbin}
>>>>
>>>> If that turns out to be a dead end, try this clumsier but more 
>>>> revealing version instead.
>>>>
>>>> path=""
>>>> for i in usr local nagios sbin; do
>>>>   path="$path/$i"
>>>>   ls -ld $path
>>>> done
>>>>
>>>>> P.S
>>>>>
>>>>> I also noticed this when i try to access a cgi page from the web 
>>>>> interface:
>>>>> Whoops!
>>>>> Error: Could not open CGI config file 
>>>>> '/usr/local/nagios/etc/cgi.cfg' for reading!
>>>>>
>>>>> Here are some things you should check in order to resolve this error:
>>>>> Make sure you've installed a CGI config file in its proper 
>>>>> location. See the error message about for details on where the CGI 
>>>>> is expecting to find the configuration file. A sample CGI 
>>>>> configuration file (named cgi.cfg) can be found in the 
>>>>> sample-config/ subdirectory of the Nagios source code distribution.
>>>>> Make sure the user your web server is running as has permission to 
>>>>> read the CGI config file.
>>>>>
>>>>>
>>>>>
>>>>> Sooo this obviously suggests that there is a permissions problem 
>>>>> with apache trying to read the cgi files....am i correct?
>>>>>
>>>>
>>>> Yes, that is also what I said a few minutes ago in the last email I 
>>>> sent you.
>>>>
>>>>>
>>>>>> From: Andreas Ericsson <ae at op5.se>
>>>>>> To: Nagios Users List <Nagios-users at lists.sourceforge.net>
>>>>>> Subject: [Nagios-users] Re: [Nagiosplug-help] HELP please! newbie 
>>>>>> to nagios
>>>>>> Date: Wed, 27 Apr 2005 17:13:20 +0200
>>>>>>
>>>>>> HP Geeza wrote:
>>>>>>
>>>>>>> ok fair enuff i will....but at the moment i am really at a dead end.
>>>>>>>
>>>>>>> After looking in the apache logs I see:
>>>>>>> (13)Permission denied: exec of 
>>>>>>> '/usr/local/nagios/sbin/status.cgi' failed, referer: http://<ip 
>>>>>>> address>/nagios/side.html
>>>>>>> [Wed Apr 27 13:33:18 2005] [error] [client <ip address>] 
>>>>>>> Premature end of script headers: status.cgi, referer: http://<ip 
>>>>>>> address>/nagios/side.html
>>>>>>>
>>>>>>
>>>>>> su - <webuser>
>>>>>> /usr/local/nagios/sbin/status.cgi
>>>>>>
>>>>>> when that fails, read the man-page for chmod, exit the sub-shell 
>>>>>> and, as root, fix permissions until you can run the command 
>>>>>> manually while acting as the user the webserver is running as.
>>>>>>
>>>>>>> I appreciate your help! - yes i agree i would much rather someone 
>>>>>>> help me so that i can fix the problem my self.   At the moment 
>>>>>>> becuase im a
>>>>>>> newbie im not to sure of whats going on.
>>>>>>>
>>>>>>
>>>>>> Which is why I'm pointing you to the next step of the problem 
>>>>>> solving process instead of just sending you a five-line script to 
>>>>>> do the work for you.
>>>>>>
>>>>>> Metaphorically speaking, I'm teaching you how to use bow and arrow 
>>>>>> instead of cooking the deer for you.
>>>>>>
>>>>>>>> From: Andreas Ericsson <ae at op5.se>
>>>>>>>> To: nagiosplug-help at lists.sourceforge.net
>>>>>>>> Subject: Re: [Nagiosplug-help] HELP please! newbie to nagios
>>>>>>>> Date: Wed, 27 Apr 2005 13:50:10 +0200
>>>>>>>>
>>>>>>>> http://www.catb.org/~esr/faqs/smart-questions.html
>>>>>>>>
>>>>>>>> You need to read the sections covering the subject line, proper 
>>>>>>>> forum and just about everything else. Twice, preferrably.
>>>>>>>>
>>>>>>>> More comments below.
>>>>>>>>
>>>>>>>> HP Geeza wrote:
>>>>>>>>
>>>>>>>>> Hi!
>>>>>>>>>
>>>>>>>>> PLEASE can somebody help! - I have just installed nagios (in an 
>>>>>>>>> atempt to upgrade from netsaint..which at the moment we have 
>>>>>>>>> running).  However i am facing extreme confusion and difficulties!
>>>>>>>>>
>>>>>>>>> I think i have managed to install everything ok...i can get to 
>>>>>>>>> the web interface BUT i can't do anything from there because 
>>>>>>>>> other then the default (first page) when you log into the web 
>>>>>>>>> interface i can't see anything else.  For example i get the 
>>>>>>>>> following error when i try to go to one of the pages:
>>>>>>>>>
>>>>>>>>> Internal Server Error
>>>>>>>>> The server encountered an internal error or misconfiguration 
>>>>>>>>> and was unable to complete your request.
>>>>>>>>> Please contact the server administrator, root at localhost and 
>>>>>>>>> inform them of the time the error occurred, and anything you 
>>>>>>>>> might have done that may have caused the error.
>>>>>>>>> More information about this error may be available in the 
>>>>>>>>> server error log.
>>>>>>>>>
>>>>>>>>> Obviously this is an internal error but i can't debug the 
>>>>>>>>> problem! And i am not sure where to begin.
>>>>>>>>>
>>>>>>>>
>>>>>>>> Did you READ the error log that it tells you to do?
>>>>>>>>
>>>>>>>>> ALSO i have my old netsaint config (.cfg) files which i would 
>>>>>>>>> like to import into nagios BUT again i am not to sure how to do 
>>>>>>>>> this!!!! At the moment i am trying to just use the default 
>>>>>>>>> minimal.cfg and other .cfg files which were created when i 
>>>>>>>>> installed nagios BUT these dont seem to be working either
>>>>>>>>>
>>>>>>>>> PLEASE help!
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Nopes. I can possibly help you help yourself, but I won't fix 
>>>>>>>> your problems for you.
>>>>>>>>
>>>>>>>>> Sanj
>>>>>>>>>
>>>>>>>>> _________________________________________________________________
>>>>>>>>> Be the first to hear what's new at MSN - sign up to our free 
>>>>>>>>> newsletters! http://www.msn.co.uk/newsletters
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> -------------------------------------------------------
>>>>>>>>> SF.Net email is sponsored by: Tell us your software development 
>>>>>>>>> plans!
>>>>>>>>> Take this survey and enter to win a one-year sub to 
>>>>>>>>> SourceForge.net
>>>>>>>>> Plus IDC's 2005 look-ahead and a copy of this survey
>>>>>>>>> Click here to start!  
>>>>>>>>> http://www.idcswdc.com/cgi-bin/survey?id=105hix
>>>>>>>>> _______________________________________________
>>>>>>>>> Nagiosplug-help mailing list
>>>>>>>>> Nagiosplug-help at lists.sourceforge.net
>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/nagiosplug-help
>>>>>>>>> ::: Please include plugins version (-v) and OS when reporting 
>>>>>>>>> any issue. ::: Messages without supporting info will risk being 
>>>>>>>>> sent to /dev/null
>>>>>>>>>
>>>>>>>>
>>>>>>>> -- 
>>>>>>>> Andreas Ericsson                   andreas.ericsson at op5.se
>>>>>>>> OP5 AB                             www.op5.se
>>>>>>>> Lead Developer
>>>>>>>>
>>>>>>>>
>>>>>>>> -------------------------------------------------------
>>>>>>>> SF.Net email is sponsored by: Tell us your software development 
>>>>>>>> plans!
>>>>>>>> Take this survey and enter to win a one-year sub to SourceForge.net
>>>>>>>> Plus IDC's 2005 look-ahead and a copy of this survey
>>>>>>>> Click here to start!  
>>>>>>>> http://www.idcswdc.com/cgi-bin/survey?id=105hix
>>>>>>>> _______________________________________________
>>>>>>>> Nagiosplug-help mailing list
>>>>>>>> Nagiosplug-help at lists.sourceforge.net
>>>>>>>> https://lists.sourceforge.net/lists/listinfo/nagiosplug-help
>>>>>>>> ::: Please include plugins version (-v) and OS when reporting 
>>>>>>>> any issue. ::: Messages without supporting info will risk being 
>>>>>>>> sent to /dev/null
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> _________________________________________________________________
>>>>>>> Be the first to hear what's new at MSN - sign up to our free 
>>>>>>> newsletters! http://www.msn.co.uk/newsletters
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> -- 
>>>>>> Andreas Ericsson                   andreas.ericsson at op5.se
>>>>>> OP5 AB                             www.op5.se
>>>>>> Lead Developer
>>>>>>
>>>>>>
>>>>>> -------------------------------------------------------
>>>>>> SF.Net email is sponsored by: Tell us your software development 
>>>>>> plans!
>>>>>> Take this survey and enter to win a one-year sub to SourceForge.net
>>>>>> Plus IDC's 2005 look-ahead and a copy of this survey
>>>>>> Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id=105hix
>>>>>> _______________________________________________
>>>>>> 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
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _________________________________________________________________
>>>>> Winks & nudges are here - download MSN Messenger 7.0 today! 
>>>>> http://messenger.msn.co.uk
>>>>>
>>>>>
>>>>
>>>> -- 
>>>> Andreas Ericsson                   andreas.ericsson at op5.se
>>>> OP5 AB                             www.op5.se
>>>> Lead Developer
>>>>
>>>>
>>>> -------------------------------------------------------
>>>> SF.Net email is sponsored by: Tell us your software development plans!
>>>> Take this survey and enter to win a one-year sub to SourceForge.net
>>>> Plus IDC's 2005 look-ahead and a copy of this survey
>>>> Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id=105hix
>>>> _______________________________________________
>>>> 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
>>>
>>>
>>>
>>> _________________________________________________________________
>>> Be the first to hear what's new at MSN - sign up to our free 
>>> newsletters! http://www.msn.co.uk/newsletters
>>>
>>>
>>
>> -- 
>> Andreas Ericsson                   andreas.ericsson at op5.se
>> OP5 AB                             www.op5.se
>> Lead Developer
>>
>>
>> -------------------------------------------------------
>> SF.Net email is sponsored by: Tell us your software development plans!
>> Take this survey and enter to win a one-year sub to SourceForge.net
>> Plus IDC's 2005 look-ahead and a copy of this survey
>> Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id=105hix
>> _______________________________________________
>> 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
> 
> 
> _________________________________________________________________
> Be the first to hear what's new at MSN - sign up to our free 
> newsletters! http://www.msn.co.uk/newsletters
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by: Tell us your software development plans!
> Take this survey and enter to win a one-year sub to SourceForge.net
> Plus IDC's 2005 look-ahead and a copy of this survey
> Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id=105hix
> _______________________________________________
> 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
> 

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Lead Developer


-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start!  http://www.idcswdc.com/cgi-bin/survey?id=105hix
_______________________________________________
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