Page 2 of 3

Re: Notifications for Windows disk usage are not sent out

Posted: Wed Oct 26, 2016 7:26 pm
by genmais
Here you are:
[root@nagiosxi ~]# echo "\d xi_usermeta;" | psql nagiosxi nagiosxi
Table "public.xi_usermeta"
Column | Type | Modifiers
-------------+------------------------+-------------------------------------------------------------------
usermeta_id | integer | not null default nextval('xi_usermeta_usermeta_id_seq'::regclass)
user_id | integer | not null
keyname | character varying(255) | not null
keyvalue | text |
autoload | smallint | default (0)::smallint
Indexes:
"xi_usermeta_pkey" PRIMARY KEY, btree (usermeta_id)
"xi_usermeta_user_id_key" UNIQUE, btree (user_id, keyname)
"xi_usermeta_autoload_idx" btree (autoload)

[root@nagiosxi ~]# tail -50 /var/lib/pgsql/data/pg_log/postgresql-Wed.log
ERROR: relation "xi_notifications" does not exist
STATEMENT: VACUUM ANALYZE xi_notifications;
ERROR: relation "xi_notifications" does not exist
STATEMENT: VACUUM ANALYZE xi_notifications;
ERROR: relation "xi_notifications" does not exist
STATEMENT: VACUUM ANALYZE xi_notifications;
ERROR: relation "xi_notifications" does not exist
STATEMENT: VACUUM ANALYZE xi_notifications;
ERROR: relation "xi_notifications" does not exist
STATEMENT: VACUUM ANALYZE xi_notifications;
ERROR: relation "xi_notifications" does not exist
STATEMENT: VACUUM ANALYZE xi_notifications;
ERROR: relation "xi_notifications" does not exist
STATEMENT: VACUUM ANALYZE xi_notifications;
ERROR: relation "xi_notifications" does not exist
STATEMENT: VACUUM ANALYZE xi_notifications;
ERROR: relation "xi_notifications" does not exist
STATEMENT: VACUUM ANALYZE xi_notifications;
ERROR: relation "xi_notifications" does not exist
STATEMENT: VACUUM ANALYZE xi_notifications;
ERROR: relation "xi_notifications" does not exist
STATEMENT: VACUUM ANALYZE xi_notifications;
ERROR: relation "xi_notifications" does not exist
STATEMENT: VACUUM ANALYZE xi_notifications;
ERROR: relation "xi_notifications" does not exist
STATEMENT: VACUUM ANALYZE xi_notifications;
ERROR: relation "xi_notifications" does not exist
STATEMENT: VACUUM ANALYZE xi_notifications;
ERROR: relation "xi_notifications" does not exist
STATEMENT: VACUUM ANALYZE xi_notifications;
ERROR: relation "xi_notifications" does not exist
STATEMENT: VACUUM ANALYZE xi_notifications;
ERROR: relation "xi_notifications" does not exist
STATEMENT: VACUUM ANALYZE xi_notifications;
ERROR: relation "xi_notifications" does not exist
STATEMENT: VACUUM ANALYZE xi_notifications;
ERROR: relation "xi_notifications" does not exist
STATEMENT: VACUUM ANALYZE xi_notifications;
ERROR: relation "xi_notifications" does not exist
STATEMENT: VACUUM ANALYZE xi_notifications;
ERROR: relation "xi_notifications" does not exist
STATEMENT: VACUUM ANALYZE xi_notifications;
ERROR: relation "xi_notifications" does not exist
STATEMENT: VACUUM ANALYZE xi_notifications;
[root@nagiosxi ~]# tail -f /usr/local/nagiosxi/var/e*
==> /usr/local/nagiosxi/var/event_handler.lock <==

==> /usr/local/nagiosxi/var/event_handler.log <==
LOCKFILE '/usr/local/nagiosxi/var/event_handler.lock' CREATED

==> /usr/local/nagiosxi/var/event_handler.log-20161023 <==
LOCKFILE '/usr/local/nagiosxi/var/event_handler.lock' CREATED
DELETED LOCKFILE '/usr/local/nagiosxi/var/event_handler.lock'
EVENT HANDLER EXITING

==> /usr/local/nagiosxi/var/eventman.log <==
...
PROCESSED 0 EVENTS

==> /usr/local/nagiosxi/var/eventman.log-20161002 <==
....................
PROCESSED 0 EVENTS

==> /usr/local/nagiosxi/var/eventman.log-20161010 <==
....................
PROCESSED 0 EVENTS

==> /usr/local/nagiosxi/var/eventman.log-20161016 <==
....................
PROCESSED 0 EVENTS

==> /usr/local/nagiosxi/var/eventman.log-20161023 <==
....................
PROCESSED 0 EVENTS

==> /usr/local/nagiosxi/var/eventman.log <==

==> /usr/local/nagiosxi/var/event_handler.log <==
Array
(
[0] => 187
[eventqueue_id] => 187
[1] => 1477526544
[event_time] => 1477526544
[2] => 2
[event_source] => 2
[3] => 2
[event_type] => 2
[4] => a:26:{s:17:"notification-type";s:7:"service";s:7:"contact";s:11:"nagiosadmin";s:12:"contactemail";s:16:"nagios@localhost"
;s:4:"type";s:6:"CUSTOM";s:9:"escalated";s:1:"0";s:6:"author";s:20:"Nagios Administrator";s:8:"comments";s:4:"Test";s:4:"host";s:21:
"sepp.mum.schorsch.net";s:11:"hostaddress";s:12:"192.168.2.10";s:9:"hostalias";s:55:"MuM Familienserver (Windows Small Business Serv
er 2011)";s:15:"hostdisplayname";s:21:"sepp.mum.schorsch.net";s:7:"service";s:19:"Drive C: Disk Usage";s:9:"hoststate";s:2:"UP";s:11
:"hoststateid";s:1:"0";s:12:"servicestate";s:2:"OK";s:14:"servicestateid";s:1:"0";s:16:"lastservicestate";s:2:"OK";s:18:"lastservice
stateid";s:1:"0";s:16:"servicestatetype";s:4:"HARD";s:14:"currentattempt";s:1:"1";s:11:"maxattempts";s:1:"5";s:14:"serviceeventid";s
:5:"20479";s:16:"serviceproblemid";s:1:"0";s:13:"serviceoutput";s:77:"C: Label:System Serial Number e28c2a7c: 69%used(42482MB/61440
MB) (70%) : OK";s:17:"longserviceoutput";b:0;s:8:"datetime";s:29:"Thu Oct 27 02:02:24 CEST 2016";}
[event_meta] => a:26:{s:17:"notification-type";s:7:"service";s:7:"contact";s:11:"nagiosadmin";s:12:"contactemail";s:16:"nagios@l
ocalhost";s:4:"type";s:6:"CUSTOM";s:9:"escalated";s:1:"0";s:6:"author";s:20:"Nagios Administrator";s:8:"comments";s:4:"Test";s:4:"ho
st";s:21:"sepp.mum.schorsch.net";s:11:"hostaddress";s:12:"192.168.2.10";s:9:"hostalias";s:55:"MuM Familienserver (Windows Small Busi
ness Server 2011)";s:15:"hostdisplayname";s:21:"sepp.mum.schorsch.net";s:7:"service";s:19:"Drive C: Disk Usage";s:9:"hoststate";s:2:
"UP";s:11:"hoststateid";s:1:"0";s:12:"servicestate";s:2:"OK";s:14:"servicestateid";s:1:"0";s:16:"lastservicestate";s:2:"OK";s:18:"la
stservicestateid";s:1:"0";s:16:"servicestatetype";s:4:"HARD";s:14:"currentattempt";s:1:"1";s:11:"maxattempts";s:1:"5";s:14:"servicee
ventid";s:5:"20479";s:16:"serviceproblemid";s:1:"0";s:13:"serviceoutput";s:77:"C: Label:System Serial Number e28c2a7c: 69%used(4248
2MB/61440MB) (70%) : OK";s:17:"longserviceoutput";b:0;s:8:"datetime";s:29:"Thu Oct 27 02:02:24 CEST 2016";}
)

==> /usr/local/nagiosxi/var/eventman.log <==
=2, TYPE=2, TIME=2016-10-27 02:02:24
PHP Notice: unserialize(): Error at offset 928 of 1011 bytes in /usr/local/nagiosxi/cron/eventman.php on line 145
*** GLOBAL HANDLER...
Array
(
[event_id] => 50101
[event_source] => 2
[event_type] => 2
[event_time] => 2016-10-27 02:02:24
[event_meta] =>
[logging_enabled] => 1
)
*** GLOBAL HANDLER (snmptrapsender)...
Array
(
[event_id] => 50101
[event_source] => 2
[event_type] => 2
[event_time] => 2016-10-27 02:02:24
[event_meta] =>
[logging_enabled] => 1
)
ERROR: Could not find user_id for contact ''
.........

Re: Notifications for Windows disk usage are not sent out

Posted: Thu Oct 27, 2016 8:50 am
by tgriep
One thing I see is that it is trying to email using the nagiosadmin contact using nagios@localhost for the email address which isn't valid unless you only read the email while logged in to the XI server.
Try fixing that and see if it helps.

The could not find user_id may be it also, can you run the following and post the output?

Code: Select all

echo "select * from xi_users;" | psql nagiosxi nagiosxi
echo 'select * from xi_meta;' | psql nagiosxi nagiosxi

Re: Notifications for Windows disk usage are not sent out

Posted: Thu Oct 27, 2016 2:19 pm
by genmais
Mmh, not sure what to fix regarding the email address. All services are configured with the same contact for notifications. If I send a custom notification for the well-working Linux disk usage service, I get the following log outputs:
[root@nagiosxi ~]# tail -f /usr/local/nagiosxi/var/e*
==> /usr/local/nagiosxi/var/event_handler.lock <==

==> /usr/local/nagiosxi/var/event_handler.log <==
LOCKFILE '/usr/local/nagiosxi/var/event_handler.lock' CREATED

==> /usr/local/nagiosxi/var/event_handler.log-20161023 <==
LOCKFILE '/usr/local/nagiosxi/var/event_handler.lock' CREATED
DELETED LOCKFILE '/usr/local/nagiosxi/var/event_handler.lock'
EVENT HANDLER EXITING

==> /usr/local/nagiosxi/var/eventman.log <==
......
PROCESSED 0 EVENTS

==> /usr/local/nagiosxi/var/eventman.log-20161002 <==
....................
PROCESSED 0 EVENTS

==> /usr/local/nagiosxi/var/eventman.log-20161010 <==
....................
PROCESSED 0 EVENTS

==> /usr/local/nagiosxi/var/eventman.log-20161016 <==
....................
PROCESSED 0 EVENTS

==> /usr/local/nagiosxi/var/eventman.log-20161023 <==
....................
PROCESSED 0 EVENTS

==> /usr/local/nagiosxi/var/eventman.log <==

==> /usr/local/nagiosxi/var/event_handler.log <==
Array
(
[0] => 189
[eventqueue_id] => 189
[1] => 1477594646
[event_time] => 1477594646
[2] => 2
[event_source] => 2
[3] => 2
[event_type] => 2
[4] => a:26:{s:17:"notification-type";s:7:"service";s:7:"contact";s:11:"nagiosadmin";s:12:"contactemail";s:16:"nagios@localhost"
;s:4:"type";s:6:"CUSTOM";s:9:"escalated";s:1:"0";s:6:"author";s:20:"Nagios Administrator";s:8:"comments";s:4:"Test";s:4:"host";s:18:
"zenzi.schorsch.net";s:11:"hostaddress";s:12:"192.168.2.60";s:9:"hostalias";s:20:"VMware Host (Ubuntu)";s:15:"hostdisplayname";s:18:
"zenzi.schorsch.net";s:7:"service";s:14:"Root Partition";s:9:"hoststate";s:2:"UP";s:11:"hoststateid";s:1:"0";s:12:"servicestate";s:2
:"OK";s:14:"servicestateid";s:1:"0";s:16:"lastservicestate";s:2:"OK";s:18:"lastservicestateid";s:1:"0";s:16:"servicestatetype";s:4:"
HARD";s:14:"currentattempt";s:1:"1";s:11:"maxattempts";s:1:"5";s:14:"serviceeventid";s:5:"20314";s:16:"serviceproblemid";s:1:"0";s:1
3:"serviceoutput";s:38:"/: 38%used(14385MB/37416MB) (80%) : OK";s:17:"longserviceoutput";b:0;s:8:"datetime";s:29:"Thu Oct 27 20:57:2
6 CEST 2016";}
[event_meta] => a:26:{s:17:"notification-type";s:7:"service";s:7:"contact";s:11:"nagiosadmin";s:12:"contactemail";s:16:"nagios@l
ocalhost";s:4:"type";s:6:"CUSTOM";s:9:"escalated";s:1:"0";s:6:"author";s:20:"Nagios Administrator";s:8:"comments";s:4:"Test";s:4:"ho
st";s:18:"zenzi.schorsch.net";s:11:"hostaddress";s:12:"192.168.2.60";s:9:"hostalias";s:20:"VMware Host (Ubuntu)";s:15:"hostdisplayna
me";s:18:"zenzi.schorsch.net";s:7:"service";s:14:"Root Partition";s:9:"hoststate";s:2:"UP";s:11:"hoststateid";s:1:"0";s:12:"services
tate";s:2:"OK";s:14:"servicestateid";s:1:"0";s:16:"lastservicestate";s:2:"OK";s:18:"lastservicestateid";s:1:"0";s:16:"servicestatety
pe";s:4:"HARD";s:14:"currentattempt";s:1:"1";s:11:"maxattempts";s:1:"5";s:14:"serviceeventid";s:5:"20314";s:16:"serviceproblemid";s:
1:"0";s:13:"serviceoutput";s:38:"/: 38%used(14385MB/37416MB) (80%) : OK";s:17:"longserviceoutput";b:0;s:8:"datetime";s:29:"Thu Oct 2
7 20:57:26 CEST 2016";}
)

==> /usr/local/nagiosxi/var/eventman.log <==
=2, TYPE=2, TIME=2016-10-27 20:57:26
*** GLOBAL HANDLER...
Array
(
[event_id] => 50103
[event_source] => 2
[event_type] => 2
[event_time] => 2016-10-27 20:57:26
[event_meta] => Array
(
[notification-type] => service
[contact] => nagiosadmin
[contactemail] => nagios@localhost
[type] => CUSTOM
[escalated] => 0
[author] => Nagios Administrator
[comments] => Test
[host] => zenzi.schorsch.net
[hostaddress] => 192.168.2.60
[hostalias] => VMware Host (Ubuntu)
[hostdisplayname] => zenzi.schorsch.net
[service] => Root Partition
[hoststate] => UP
[hoststateid] => 0
[servicestate] => OK
[servicestateid] => 0
[lastservicestate] => OK
[lastservicestateid] => 0
[servicestatetype] => HARD
[currentattempt] => 1
[maxattempts] => 5
[serviceeventid] => 20314
[serviceproblemid] => 0
[serviceoutput] => /: 38%used(14385MB/37416MB) (80%) : OK
[longserviceoutput] =>
[datetime] => Thu Oct 27 20:57:26 CEST 2016
)

[logging_enabled] => 1
)
*** GLOBAL HANDLER (snmptrapsender)...
Array
(
[event_id] => 50103
[event_source] => 2
[event_type] => 2
[event_time] => 2016-10-27 20:57:26
[event_meta] => Array
(
[notification-type] => service
[contact] => nagiosadmin
[contactemail] => nagios@localhost
[type] => CUSTOM
[escalated] => 0
[author] => Nagios Administrator
[comments] => Test
[host] => zenzi.schorsch.net
[hostaddress] => 192.168.2.60
[hostalias] => VMware Host (Ubuntu)
[hostdisplayname] => zenzi.schorsch.net
[service] => Root Partition
[hoststate] => UP
[hoststateid] => 0
[servicestate] => OK
[servicestateid] => 0
[lastservicestate] => OK
[lastservicestateid] => 0
[servicestatetype] => HARD
[currentattempt] => 1
[maxattempts] => 5
[serviceeventid] => 20314
[serviceproblemid] => 0
[serviceoutput] => /: 38%used(14385MB/37416MB) (80%) : OK
[longserviceoutput] =>
[datetime] => Thu Oct 27 20:57:26 CEST 2016
)

[logging_enabled] => 1
)
Got XI user id for contact 'nagiosadmin': 18
An email notification will be sent...

Email Notification Data:

Array
(
[from] => Nagios XI <[email protected]>
[to] => [email protected]
[subject] => NagiosXI: CUSTOM Service Alert - zenzi.schorsch.net/Root Partition is OK
[high_priority] => 0
[message] => ***** Nagios XI Alert *****



Notification Type: CUSTOM

Service: Root Partition
Host: zenzi.schorsch.net
Address: 192.168.2.60
State: OK
Info:
/: 38%used(14385MB/37416MB) (80%) : OK
Date/Time: 27/10/2016 20:57:30

)


User has mobile text notifications disabled...

......
Here the same email address is used and email notification works properly.

The output of the second psql scripts is rather large. So I would rather send both outputs per PM than posting them. I've sent them to dwhitfield again.

Re: Notifications for Windows disk usage are not sent out

Posted: Thu Oct 27, 2016 2:52 pm
by tgriep
Thanks, for the files.

On your working exanple, it shows that it found the user_id for the contact and them generated the email.
One thing quick to try is to edit the bad service, remove the contact, save and apply the config.
Then go back and and re-add the contact and see if that fixes it.

Re: Notifications for Windows disk usage are not sent out

Posted: Fri Oct 28, 2016 12:39 am
by genmais
The test email reached me twice, both email addresses work.

Re: Notifications for Windows disk usage are not sent out

Posted: Fri Oct 28, 2016 1:09 am
by genmais
I re-configured the bad service, also trying with a contact group instead of "Myself". The issue is still there. :-(

Re: Notifications for Windows disk usage are not sent out

Posted: Fri Oct 28, 2016 11:31 am
by genmais
Again I played around with the bad service's config. I used an newly created contact for notifications, I copied the entire service, all did not make the issue disappear. Custom notifications are always generated and logged, but no email is sent out and eventman.log shows the same error.

By the way, the affected four services (all Windows disk usages) are the only services that include a backslash in the status information.
Has anybody had a closer look at my initial assumption that event manager might have a parsing issue...?

Re: Notifications for Windows disk usage are not sent out

Posted: Fri Oct 28, 2016 2:05 pm
by mcapra
We've identified internally what's happening here. This error is key:

Code: Select all

PHP Notice: unserialize(): Error at offset 928 of 1011 bytes in /usr/local/nagiosxi/cron/eventman.php on line 145
Basically, when we serialize the data for an event and plug it into the database, special characters (in your case \ in all Windows disk status info, eg C:\ ) are not being handled gracefully. This is being fixed in 5.3.2 which is scheduled to be released November 1st.

Re: Notifications for Windows disk usage are not sent out

Posted: Fri Oct 28, 2016 2:08 pm
by genmais
That's good news. Thanks a lot!

Re: Notifications for Windows disk usage are not sent out

Posted: Mon Oct 31, 2016 10:49 am
by rkennedy
I'll leave this thread open should you have any further questions - the new release should be out in the near future.