NDOutils SQL Request to get notifications historic?


#1

Hello,

I’m using Nagios 3.2x with NDOUtils to save data in a mysql database(hosts, services, notifications).

I would like to analyze sent notifications to help my minimyze notifications but am unable to construct correct SQL query to return same data as original nagios CGI like :

Host Service Type Time Contact Notification Command Information 
CRM-01 NRPE_SWAP WARNING 24-09-2011 00:32:15 user1@MYDOMAIN.LOCAL notify-service-by-email SWAP WARNING - 79% free (16023 MB out of 20415 MB) 
CRM-01 NRPE_SWAP WARNING 24-09-2011 00:32:14 user2@MYDOMAIN.LOCAL notify-service-by-email SWAP WARNING - 79% free (16023 MB out of 20415 MB) 
CRM-01 NRPE_SWAP WARNING 24-09-2011 00:32:13 user3@MYDOMAIN.LOCAL notify-service-by-email-info SWAP WARNING - 79% free (16023 MB out of 20415 MB) 
NFS-01 NRPE_CPU_USAGE OK 24-09-2011 00:28:57 user4@MYDOMAIN.LOCAL notify-service-by-email-info CPU OK : user=0% system=1% iowait=19% idle=80% 
NFS-01 NRPE_CPU_USAGE OK 24-09-2011 00:28:55 user1@MYDOMAIN.LOCAL notify-service-by-email CPU OK : user=0% system=1% iowait=19% idle=80% 
NFS-01 NRPE_CPU_USAGE OK 24-09-2011 00:28:54 user2@MYDOMAIN.LOCAL notify-service-by-email CPU OK : user=0% system=1% iowait=19% idle=80% 
NFS-01 NRPE_CPU_USAGE OK 24-09-2011 00:28:53 user3@MYDOMAIN.LOCAL notify-service-by-email-info CPU OK : user=0% system=1% iowait=19% idle=80% 
STORAGE01 CPU_LOAD WARNING 24-09-2011 00:26:42 user4@MYDOMAIN.LOCAL notify-service-by-email-info CPULOAD WARNING - CPU load: 96% 
STORAGE01 CPU_LOAD WARNING 24-09-2011 00:26:40 user1@MYDOMAIN.LOCAL notify-service-by-email CPULOAD WARNING - CPU load: 96% 
STORAGE01 CPU_LOAD WARNING 24-09-2011 00:26:39 user2@MYDOMAIN.LOCAL notify-service-by-email CPULOAD WARNING - CPU load: 96% 

Thanks for your help

i found few things about it, but not what i need : http://wiki.monitoring-fr.org/nagios/addons/ndoutils-sql-request

Here is an example of how to get complete list of nagios hosts :

SELECT nagios_hosts.display_name
FROM nagios_hosts
LEFT JOIN nagios_hostgroup_members ON nagios_hosts.host_object_id = nagios_hostgroup_members.host_object_id
ORDER BY `nagios_hosts`.`display_name`ASC

FG


#2

up ;-))