Page 1 of 2

Send Custom Notification Error

Posted: Thu Jan 21, 2016 9:59 am
by rlinux57
Please find attached screenshot, I have getting error while getting custom notification via email.
I have disabled selinux moreover below are the more details:

Code: Select all

[root@monitor ~]# ll /usr/local/nagios/var/rw
total 0
prw-rw---- 1 nagios nagcmd 0 Jan 20 09:54 nagios.cmd
srw-rw---- 1 nagios nagcmd 0 Jan 20 09:54 nagios.qh

Code: Select all

[root@monitor ~]# ll /usr/local/nagios/var
total 1716
drwxrwxr-x 2 nagios nagios   4096 Jan 20 23:59 archives
-rw-r--r-- 1 nagios nagios     34 Jan 20 09:54 nagios.configtest
-rw-r--r-- 1 apache root        0 Dec  4 09:32 nagiosgraph-cgi.log
-rw-r--r-- 1 nagios root    10164 Dec  4 10:29 nagiosgraph.log
-rw-r--r-- 1 nagios nagios      6 Jan 20 09:54 nagios.lock
-rw-r--r-- 1 nagios nagios  89294 Jan 21 09:54 nagios.log
-rw-r--r-- 1 nagios nagios 337406 Jan 20 09:54 objects.cache
-rw-r--r-- 1 nagios nagios 337406 Jan 20 09:54 objects.precache
-rw------- 1 nagios nagios 472460 Jan 21 09:54 retention.dat
drwxr-xr-x 2 nagios apache   4096 Dec  4 09:30 rrd
drwxrwsr-x 2 nagios nagcmd   4096 Jan 20 09:54 rw
drwxr-xr-x 3 root   root     4096 Nov 17 10:42 spool
-rw-rw-r-- 1 nagios nagios 470171 Jan 21 09:57 status.dat

Re: Send Custom Notification Error

Posted: Thu Jan 21, 2016 11:46 am
by hsmith
What's the output of these commands?

Code: Select all

grep apache /etc/passwd
grep nag /etc/passwd
chage -l nagios

Re: Send Custom Notification Error

Posted: Fri Jan 22, 2016 5:01 am
by rlinux57
Below are the output:

Code: Select all

[root@monitor ~]# grep apache /etc/passwd
apache:x:48:48:Apache:/var/www:/sbin/nologin
[/color]

Code: Select all

[root@monitor ~]# grep nag /etc/passwd
nagios:x:500:500::/home/nagios:/bin/bash
[/color]

Code: Select all

[root@monitor ~]# chage -l nagios
Last password change					: Nov 17, 2015
Password expires					: never
Password inactive					: never
Account expires						: never
Minimum number of days between password change		: 0
Maximum number of days between password change		: 99999
Number of days of warning before password expires	: 7
[/color]

Re: Send Custom Notification Error

Posted: Fri Jan 22, 2016 1:07 pm
by hsmith
What's the output of this command?

Code: Select all

ps -ef | grep nag

Re: Send Custom Notification Error

Posted: Fri Jan 22, 2016 1:51 pm
by rlinux57

Code: Select all

nagios     939 19601  0 13:48 ?        00:00:00 /usr/local/nagios/libexec/check_smtp -H IP Address -t 30
nagios     940 19598  0 13:48 ?        00:00:00 python /usr/local/nagios/libexec/check_rbl.py -w 1 -c 1 -h IP Address
nagios     966 19599  0 13:48 ?        00:00:00 python /usr/local/nagios/libexec/check_rbl.py -w 1 -c 1 -h IP Address
root       994   980  0 13:48 pts/0    00:00:00 grep nag
nagios   19596     1  0 Jan20 ?        00:01:20 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg
nagios   19598 19596  0 Jan20 ?        00:00:15 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios   19599 19596  0 Jan20 ?        00:00:21 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios   19600 19596  0 Jan20 ?        00:00:18 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios   19601 19596  0 Jan20 ?        00:00:24 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios   19602 19596  0 Jan20 ?        00:00:15 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios   19603 19596  0 Jan20 ?        00:00:23 /usr/local/nagios/bin/nagios --worker /usr/local/nagios/var/rw/nagios.qh
nagios   19604 19596  0 Jan20 ?        00:00:07 /usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios.cfg

Re: Send Custom Notification Error

Posted: Fri Jan 22, 2016 2:09 pm
by hsmith
What's the output of a service nagios status command?

Is there anything in the logs?

Code: Select all

tail /var/log/httpd/error_log
tail /var/log/httpd/access_log
tail /usr/local/nagios/var/nagios.log
Is apache in the correct group?

Code: Select all

cat /etc/group | grep nag

Re: Send Custom Notification Error

Posted: Fri Jan 22, 2016 2:31 pm
by rlinux57
It is is running...

Code: Select all

[root@monitor ~]# tail /var/log/httpd/error_log
[Fri Jan 22 07:59:17 2016] [error] [client 184.168.114.197] File does not exist: /var/www/html/phpMyAdmin-4.2.1-english
[Fri Jan 22 07:59:18 2016] [error] [client 184.168.114.197] File does not exist: /var/www/html/sqlite
[Fri Jan 22 07:59:18 2016] [error] [client 184.168.114.197] File does not exist: /var/www/html/SQLite
[Fri Jan 22 07:59:18 2016] [error] [client 184.168.114.197] File does not exist: /var/www/html/SQLiteManager-1.2.4
[Fri Jan 22 07:59:19 2016] [error] [client 184.168.114.197] File does not exist: /var/www/html/sqlitemanager
[Fri Jan 22 07:59:20 2016] [error] [client 184.168.114.197] File does not exist: /var/www/html/SQlite
[Fri Jan 22 07:59:20 2016] [error] [client 184.168.114.197] File does not exist: /var/www/html/SQLiteManager
[Fri Jan 22 09:05:17 2016] [error] [client 51.254.85.253] client sent HTTP/1.1 request without hostname (see RFC2616 section 14.23): /w00tw00t.at.ISC.SANS.DFind:)
[Fri Jan 22 09:11:22 2016] [error] [client 95.213.177.123] script '/var/www/html/azenv.php' not found or unable to stat, referer: https://proxyradar.com/
[Fri Jan 22 13:21:33 2016] [error] [client 95.213.177.123] script '/var/www/html/azenv.php' not found or unable to stat, referer: https://proxyradar.com/
[Fri Jan 22 09:11:22 2016] [error] [client 95.213.177.123] script '/var/www/html/azenv.php' not found or unable to stat, referer: https://proxyradar.com/
[Fri Jan 22 13:21:33 2016] [error] [client 95.213.177.123] script '/var/www/html/azenv.php' not found or unable to stat, referer: https://proxyradar.com/
[Fri Jan 22 14:34:09 2016] [error] [client 182.178.221.172] File does not exist: /var/www/html/usr, referer: http://c/nagios/cgi-bin/status.cgi?host=all
[Fri Jan 22 14:34:24 2016] [error] [client 182.178.221.172] File does not exist: /var/www/html/usr, referer: http://ServerIP/nagios/cgi-bin/extinfo.cgi?type=2&host=700rdns2&service=Black+List+Alert
[Fri Jan 22 14:34:27 2016] [error] [client 182.178.221.172] File does not exist: /var/www/html/usr, referer: http://ServerIP/nagios/cgi-bin/cmd.cgi?cmd_typ=160&host=700rdns2&service=Black+List+Alert
[Fri Jan 22 14:34:40 2016] [error] [client 182.178.221.172] File does not exist: /var/www/html/usr, referer: http://ServerIP/nagios/cgi-bin/cmd.cgi

Code: Select all

[root@monitor ~]# tail /var/log/httpd/access_log
182.178.221.172 - nagiosadmin [22/Jan/2016:14:25:25 -0500] "GET /nagios/cgi-bin/status.cgi?host=all&servicestatustypes=253&serviceprops=262144&limit=0 HTTP/1.1" 200 10696 "-" "Python-urllib/2.7"
182.178.221.172 - nagiosadmin [22/Jan/2016:14:25:25 -0500] "GET /nagios/cgi-bin/status.cgi?host=all&servicestatustypes=253&serviceprops=524288&limit=0 HTTP/1.1" 200 9253 "-" "Python-urllib/2.7"
182.178.221.172 - nagiosadmin [22/Jan/2016:14:26:27 -0500] "GET /nagios/cgi-bin/status.cgi?hostgroup=all&style=hostdetail&hoststatustypes=12&hostprops=262144&limit=0 HTTP/1.1" 200 8657 "-" "Python-urllib/2.7"
182.178.221.172 - nagiosadmin [22/Jan/2016:14:26:27 -0500] "GET /nagios/cgi-bin/status.cgi?hostgroup=all&style=hostdetail&hoststatustypes=12&hostprops=524288&limit=0 HTTP/1.1" 200 8657 "-" "Python-urllib/2.7"
182.178.221.172 - nagiosadmin [22/Jan/2016:14:26:28 -0500] "GET /nagios/cgi-bin/status.cgi?host=all&servicestatustypes=253&serviceprops=262144&limit=0 HTTP/1.1" 200 10696 "-" "Python-urllib/2.7"
182.178.221.172 - nagiosadmin [22/Jan/2016:14:26:28 -0500] "GET /nagios/cgi-bin/status.cgi?host=all&servicestatustypes=253&serviceprops=524288&limit=0 HTTP/1.1" 200 9253 "-" "Python-urllib/2.7"
182.178.221.172 - nagiosadmin [22/Jan/2016:14:27:30 -0500] "GET /nagios/cgi-bin/status.cgi?hostgroup=all&style=hostdetail&hoststatustypes=12&hostprops=262144&limit=0 HTTP/1.1" 200 8657 "-" "Python-urllib/2.7"
182.178.221.172 - nagiosadmin [22/Jan/2016:14:27:30 -0500] "GET /nagios/cgi-bin/status.cgi?hostgroup=all&style=hostdetail&hoststatustypes=12&hostprops=524288&limit=0 HTTP/1.1" 200 8657 "-" "Python-urllib/2.7"
182.178.221.172 - nagiosadmin [22/Jan/2016:14:27:31 -0500] "GET /nagios/cgi-bin/status.cgi?host=all&servicestatustypes=253&serviceprops=262144&limit=0 HTTP/1.1" 200 10696 "-" "Python-urllib/2.7"
182.178.221.172 - nagiosadmin [22/Jan/2016:14:27:31 -0500] "GET /nagios/cgi-bin/status.cgi?host=all&servicestatustypes=253&serviceprops=524288&limit=0 HTTP/1.1" 200 9253 "-" "Python-urllib/2.7"

Code: Select all

[root@monitor ~]# tail /usr/local/nagios/var/nagios.log
[1453489694] wproc:   early_timeout=0; exited_ok=1; wait_status=256; error_code=0;
[1453489694] wproc:   stderr line 01: Could not open input file: /usrlocal/nagios/sms/sendsms.php
[1453490044] SERVICE ALERT: moviefisher;CPU Load;OK;HARD;3;OK - load average: 3.28, 3.83, 4.50
[1453490044] SERVICE NOTIFICATION: nagiosadmin;moviefisher;CPU Load;OK;notify-service-by-sms;OK - load average: 3.28, 3.83, 4.50
[1453490044] SERVICE NOTIFICATION: nagiosadmin;moviefisher;CPU Load;OK;notify-service-by-email;OK - load average: 3.28, 3.83, 4.50
[1453490044] wproc: NOTIFY job 21505 from worker Core Worker 19603 is a non-check helper but exited with return code 1
[1453490044] wproc:   host=moviefisher; service=CPU Load; contact=nagiosadmin
[1453490044] wproc:   early_timeout=0; exited_ok=1; wait_status=256; error_code=0;
[1453490044] wproc:   stderr line 01: Could not open input file: /usrlocal/nagios/sms/sendsms.php

Code: Select all

[root@monitor ~]# cat /etc/group | grep nag
nagios:x:500:apache
nagcmd:x:501:nagios

Re: Send Custom Notification Error

Posted: Fri Jan 22, 2016 2:36 pm
by hsmith
Can you run these commands?

Code: Select all

useradd -G nagios apache
useradd -G nagcmd apache
service nagios restart
service httpd restart
Try once more.

Re: Send Custom Notification Error

Posted: Fri Jan 22, 2016 2:43 pm
by rlinux57
User already exists, please look into the error logs in previous post contains:

Code: Select all

File does not exist: /var/www/html/usr, referer: http://ServerIP/nagios/cgi-bin/cmd.cgi

Re: Send Custom Notification Error

Posted: Fri Jan 22, 2016 2:50 pm
by hsmith
Oops.

Code: Select all

usermod -a -G nagcmd apache
Give that a shot.