Nagios monitoring problem

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
LPTFabio
Posts: 8
Joined: Thu Jan 22, 2015 4:40 am

Nagios monitoring problem

Post by LPTFabio »

Hi there i have installed nagios about a month ago i'm a new user/administrator of nagios :D .
S.O: CentOS release 6.5 (Final)
Nagios: Nagios® Core™ 4.0.2

Problem:
Nagios stopped monitoring/checking host and services and when i try to "Re-schedule the next check of this host" this shows:



Error: Could not stat() command file '/usr/local/nagios/var/rw/nagios.cmd'!

The external command file may be missing, Nagios may not be running, and/or Nagios may not be checking external commands.

An error occurred while attempting to commit your command for processing.

Return from whence you came


what i already did:
http://support.nagios.com/forum/viewtop ... =7&t=27662 (everything)
and
erase the files from folder: /usr/local/nagios/var/rw //advice from personal friends
didnt work :x :x

dont know what more to do and i need to finish this before 7 july (deadline) :? .
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Nagios monitoring problem

Post by jdalrymple »

Green-field install?
Why 4.0.2? :?
Why 6.5? :?

Either way... things we need:

Code: Select all

getenforce
/etc/init.d/nagios status
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
ls -l /usr/local/nagios/var
ls -l /usr/local/nagios/var/rw
tail /usr/local/nagios/var/nagios.log
grep nag /etc/group
Adjust paths as appropriate.

Installed from source?
LPTFabio
Posts: 8
Joined: Thu Jan 22, 2015 4:40 am

Re: Nagios monitoring problem

Post by LPTFabio »

jdalrymple wrote:Green-field install?
Why 4.0.2? :?
Why 6.5? :?

Either way... things we need:

Code: Select all

getenforce
/etc/init.d/nagios status
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
ls -l /usr/local/nagios/var
ls -l /usr/local/nagios/var/rw
tail /usr/local/nagios/var/nagios.log
grep nag /etc/group
Adjust paths as appropriate.

Installed from source?
I will do that tomorrow and will post result 17h50 gtm +0

i forgot to put the logs I remember they said something about an error on file stats/status "operation not permited"

the source i can't tell EXACTLY, bad memory sorry but i 'm almost certain its:
http://pplware.sapo.pt/tutoriais/networ ... ao-nagios/
it is in my language, portuguese
about the first 3 questions yes green-field and... well because it was on tutorial /i 'm noob this is my first contact/work with servers and this is my first server :)
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: Nagios monitoring problem

Post by jdalrymple »

I can't read Portuguese, but I can see 1 thing outstanding - the dependencies prior to a source install aren't listed there. I'm not sure that's your problem, but maybe.

Here they are:

httpd php gcc glibc glibc-common gd gd-devel make net-snmp unzip automake

Also now wouldn't be a bad time to just start from scratch with 6.6 or maybe even 7.0, there is no reason to stick with 6.5. Likewise there are many good reasons to move on to Nagios core 4.0.8.
LPTFabio
Posts: 8
Joined: Thu Jan 22, 2015 4:40 am

Re: Nagios monitoring problem

Post by LPTFabio »

jdalrymple wrote:I can't read Portuguese, but I can see 1 thing outstanding - the dependencies prior to a source install aren't listed there. I'm not sure that's your problem, but maybe.

Here they are:

httpd php gcc glibc glibc-common gd gd-devel make net-snmp unzip automake

Also now wouldn't be a bad time to just start from scratch with 6.6 or maybe even 7.0, there is no reason to stick with 6.5. Likewise there are many good reasons to move on to Nagios core 4.0.8.
yes they are :

"Passo1) Como a versão usada do CentOS é uma versão minimal vamos ter de instalar a plataforma base (Apache + PHP) e as respectivas dependências necessárias para proceder à instalação do Nagios.

yum install -y httpd php gcc glibc glibc-common gd gd-devel make net-snmp wget"

Code: Select all

[root@nagiosesjal ~]# getenforce
Enforcing


[root@nagiosesjal ~]# /etc/init.d/nagios status
O nagios (pid 1772 1771 1770 1769 1768 1766 1765 1764 1763 1762 1761) está a correr...


[root@nagiosesjal ~]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.0.2
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 11-25-2013
License: GPL

Website: http://www.nagios.org
Reading configuration data...
   Read main config file okay...
WARNING: Extinfo objects are deprecated and will be removed in future versions
WARNING: Extinfo objects are deprecated and will be removed in future versions
WARNING: Extinfo objects are deprecated and will be removed in future versions
WARNING: Extinfo objects are deprecated and will be removed in future versions
WARNING: Extinfo objects are deprecated and will be removed in future versions
   Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
        Checked 42 services.
        Checked 6 hosts.
        Checked 3 host groups.
        Checked 0 service groups.
        Checked 1 contacts.
        Checked 1 contact groups.
        Checked 24 commands.
        Checked 5 time periods.
        Checked 0 host escalations.
        Checked 0 service escalations.
Checking for circular paths...
        Checked 6 hosts
        Checked 0 service dependencies
        Checked 0 host dependencies
        Checked 5 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre-flight check


[root@nagiosesjal ~]# ls -l /usr/local/nagios/var/rw
total 0
prw-rw----. 1 nagios nagcmd 0 Jul  1 18:15 nagios.cmd
srw-rw----. 1 nagios nagcmd 0 Jul  2 18:09 query.sh


[root@nagiosesjal ~]# ls -l /usr/local/nagios/var/nagios.log
-rwxrwxrwt. 1 nagios nagios 6612151 Jul  2 18:19 /usr/local/nagios/var/nagios.log


[root@nagiosesjal ~]# grep nag /etc/group
nagios:x:500:apache
nagcmd:x:501:nagios
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios monitoring problem

Post by abrist »

First, disable selinux for testing reasons:

Code: Select all

setenforce 0
getenforce
Then, restart nagios:

Code: Select all

service nagios restart
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
LPTFabio
Posts: 8
Joined: Thu Jan 22, 2015 4:40 am

Re: Nagios monitoring problem

Post by LPTFabio »

abrist wrote:First, disable selinux for testing reasons:

Code: Select all

setenforce 0
getenforce
Then, restart nagios:

Code: Select all

service nagios restart

Code: Select all

[root@nagiosesjal ~]# setenforce 0
[root@nagiosesjal ~]# getenforce
Permissive
[root@nagiosesjal ~]# service nagios restart
A desligar o nagios:                                       [  OK  ]
A iniciar o nagios: 
done
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Nagios monitoring problem

Post by abrist »

Can you now submit any commands from the UI? (basically, we are checking to see it selinux was getting in the way of stating the command pipe)
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
LPTFabio
Posts: 8
Joined: Thu Jan 22, 2015 4:40 am

Re: Nagios monitoring problem

Post by LPTFabio »

abrist wrote:Can you now submit any commands from the UI? (basically, we are checking to see it selinux was getting in the way of stating the command pipe)
i can submit commads i'm using putty
LPTFabio
Posts: 8
Joined: Thu Jan 22, 2015 4:40 am

Re: Nagios monitoring problem

Post by LPTFabio »

LPTFabio wrote:
abrist wrote:Can you now submit any commands from the UI? (basically, we are checking to see it selinux was getting in the way of stating the command pipe)
i can submit commads i'm using putty
but in the web interface still the same with error on schedule check

LOGS

Code: Select all

[1435859139] wproc:   early_timeout=0; exited_ok=1; 

wait_status=32512; error_code=0;
[1435859139] wproc:   stderr line 01: /bin/sh: 

/bin/mail: No such file or directory
[1435859139] wproc:   stderr line 02: 

/usr/bin/printf: erro de escrita: Broken pipe
[1435859149] Error: Unable to rename file 

'/usr/local/nagios/var/nagios.tmpbSyMuu' to 

'/usr/local/nagios/var/status.dat': Operation not 

permitted
[1435859149] Error: Unable to update status data file 

'/usr/local/nagios/var/status.dat': Operation not 

permitted
[1435859159] Error: Unable to rename file 

'/usr/local/nagios/var/nagios.tmpvOCjgZ' to 

'/usr/local/nagios/var/status.dat': Operation not 

permitted
[1435859159] Error: Unable to update status data file 

'/usr/local/nagios/var/status.dat': Operation not 

permitted
[1435859168] Error: Unable to rename file 

'/usr/local/nagios/var/nagios.tmpRDsAe6' to 

'/usr/local/nagios/var/status.dat': Operation not 

permitted
[1435859168] Error: Unable to update status data file 

'/usr/local/nagios/var/status.dat': Operation not 

permitted
[1435859169] SERVICE NOTIFICATION: nagiosadmin;lptf-

PC;NSClient++ Version;CRITICAL;notify-service-by-

email;Connection refused
[1435859169] wproc: NOTIFY job 6 from worker Core 

Worker 2489 is a non-check helper but exited with 

return code 127
[1435859169] wproc:   command: /usr/bin/printf "%b" 

"***** Nagios *****\n\nNotification Type: PROBLEM\n

\nService: NSClient++ Version\nHost: My Windows 

Server\nAddress: 192.168.1.1\nState: CRITICAL\n

\nDate/Time: Thu Jul 2 18:46:09 WEST 2015\n

\nAdditional Info:\n\nConnection refused\n" | 

/bin/mail -s "** PROBLEM Service Alert: My Windows 

Server/NSClient++ Version is CRITICAL **" 

dinis.jose@gmail.com
[1435859169] wproc:   host=lptf-PC; service=NSClient

++ Version; contact=nagiosadmin
[1435859169] wproc:   early_timeout=0; exited_ok=1; 

wait_status=32512; error_code=0;
[1435859169] wproc:   stderr line 01: /bin/sh: 

/bin/mail: No such file or directory
[1435859169] wproc:   stderr line 02: 

/usr/bin/printf: erro de escrita: Broken pipe
[1435859179] Error: Unable to rename file 

'/usr/local/nagios/var/nagios.tmpjHTBpP' to 

'/usr/local/nagios/var/status.dat': Operation not 

permitted
[1435859179] Error: Unable to update status data file 

'/usr/local/nagios/var/status.dat': Operation not 

permitted
[1435859189] Error: Unable to rename file 

'/usr/local/nagios/var/nagios.tmp2mlqNa' to 

'/usr/local/nagios/var/status.dat': Operation not 

permitted
[1435859189] Error: Unable to update status data file 

'/usr/local/nagios/var/status.dat': Operation not 

permitted
[1435859199] Error: Unable to rename file 

'/usr/local/nagios/var/nagios.tmpKbVHn8' to 

'/usr/local/nagios/var/status.dat': Operation not 

permitted
[1435859199] Error: Unable to update status data file 

'/usr/local/nagios/var/status.dat': Operation not 

permitted
[1435859209] Error: Unable to rename file 

'/usr/local/nagios/var/nagios.tmp0YWyaI' to 

'/usr/local/nagios/var/status.dat': Operation not 

permitted
[1435859209] Error: Unable to update status data file 

'/usr/local/nagios/var/status.dat': Operation not 

permitted
[1435859219] Error: Unable to rename file 

'/usr/local/nagios/var/nagios.tmpSxddaU' to 

'/usr/local/nagios/var/status.dat': Operation not 

permitted
[1435859219] Error: Unable to update status data file 

'/usr/local/nagios/var/status.dat': Operation not 

permitted
[1435859229] Error: Unable to rename file 

'/usr/local/nagios/var/nagios.tmpqDZhmI' to 

'/usr/local/nagios/var/status.dat': Operation not 

permitted
[1435859229] Error: Unable to update status data file 

'/usr/local/nagios/var/status.dat': Operation not 

permitted
[1435859230] SERVICE NOTIFICATION: nagiosadmin;lptf-

PC;Uptime;CRITICAL;notify-service-by-email;Connection 

refused
[1435859230] wproc: NOTIFY job 8 from worker Core 

Worker 2483 is a non-check helper but exited with 

return code 127
[1435859230] wproc:   command: /usr/bin/printf "%b" 

"***** Nagios *****\n\nNotification Type: PROBLEM\n

\nService: Uptime\nHost: My Windows Server\nAddress: 

192.168.1.1\nState: CRITICAL\n\nDate/Time: Thu Jul 2 

18:47:10 WEST 2015\n\nAdditional Info:\n\nConnection 

refused\n" | /bin/mail -s "** PROBLEM Service Alert: 

My Windows Server/Uptime is CRITICAL **" 

dinis.jose@gmail.com
[1435859230] wproc:   host=lptf-PC; service=Uptime; 

contact=nagiosadmin
[1435859230] wproc:   early_timeout=0; exited_ok=1; 

wait_status=32512; error_code=0;
[1435859230] wproc:   stderr line 01: /bin/sh: 

/bin/mail: No such file or directory
[1435859230] wproc:   stderr line 02: 

/usr/bin/printf: erro de escrita: Broken pipe
[1435859239] Error: Unable to rename file 

'/usr/local/nagios/var/nagios.tmpNEJ1K8' to 

'/usr/local/nagios/var/status.dat': Operation not 

permitted
[1435859239] Error: Unable to update status data file 

'/usr/local/nagios/var/status.dat': Operation not 

permitted
after cleaning logs and restarting nagios this shows on logs:

Code: Select all

[1435863274] Error: Unable to rename file '/usr/local/nagios/var/nagios.tmpRKmbkT' to '/usr/local/nagios/var/status.dat': Operation not permitted
[1435863274] Error: Unable to update status data file '/usr/local/nagios/var/status.dat': Operation not permitted
[1435863284] Error: Unable to rename file '/usr/local/nagios/var/nagios.tmp91sloz' to '/usr/local/nagios/var/status.dat': Operation not permitted
[1435863284] Error: Unable to update status data file '/usr/local/nagios/var/status.dat': Operation not permitted
[1435863286] Caught SIGTERM, shutting down...
[1435863286] Error: Unable to rename file '/usr/local/nagios/var/nagios.tmpfz8cLn' to '/usr/local/nagios/var/retention.dat': Operation not permitted
[1435863286] Error: Unable to update retention file '/usr/local/nagios/var/retention.dat': Operation not permitted
[1435863286] Successfully shutdown... (PID=4566)
[1435863286] Event broker module 'NERD' deinitialized successfully.
[1435863286] Nagios 4.0.2 starting... (PID=4875)
[1435863286] Local time is Thu Jul 02 19:54:46 WEST 2015
[1435863286] LOG VERSION: 2.0
[1435863286] qh: Socket '/usr/local/nagios/var/rw/query.sh' successfully initialized
[1435863286] qh: core query handler registered
[1435863286] nerd: Channel hostchecks registered successfully
[1435863286] nerd: Channel servicechecks registered successfully
[1435863286] nerd: Channel opathchecks registered successfully
[1435863286] nerd: Fully initialized and ready to rock!
[1435863286] wproc: Successfully registered manager as @wproc with query handler
[1435863286] wproc: Registry request: name=Core Worker 4876;pid=4876
[1435863286] wproc: Registry request: name=Core Worker 4878;pid=4878
[1435863286] wproc: Registry request: name=Core Worker 4877;pid=4877
[1435863286] wproc: Registry request: name=Core Worker 4883;pid=4883
[1435863286] wproc: Registry request: name=Core Worker 4884;pid=4884
[1435863286] wproc: Registry request: name=Core Worker 4881;pid=4881
[1435863286] wproc: Registry request: name=Core Worker 4882;pid=4882
[1435863286] wproc: Registry request: name=Core Worker 4879;pid=4879
[1435863286] wproc: Registry request: name=Core Worker 4885;pid=4885
[1435863286] WARNING: Extinfo objects are deprecated and will be removed in future versions
[1435863286] WARNING: Extinfo objects are deprecated and will be removed in future versions
[1435863286] WARNING: Extinfo objects are deprecated and will be removed in future versions
[1435863286] WARNING: Extinfo objects are deprecated and will be removed in future versions
[1435863286] WARNING: Extinfo objects are deprecated and will be removed in future versions
Last edited by LPTFabio on Thu Jul 02, 2015 2:07 pm, edited 1 time in total.
Locked