how to list all HOST added without SERVICE

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
zaji_nms
Posts: 616
Joined: Tue Oct 16, 2012 12:28 am

how to list all HOST added without SERVICE

Post by zaji_nms »

Dear Expert

NagiosXI 5.2.x
CENTOS 6.x.x.x

is there any quick way to find all HOST added without any SERVICE ?

List of all HOSTs added without any single SERVICE.

and same way, all HOSTs added with SERVICE

if there is some script of AWK or SED or anything show as below then very good.

HOST Name ,, SERVICEs=0
HOST Name ,, SERVICEs=20
HOST Name ,, SERVICEs=5

please provide hint to pull the report from WEB and from CLI# (Linux# root)

Regards
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: how to list all HOST added without SERVICE

Post by ssax »

This should do it:

Code: Select all

mysql -h 127.0.0.1 -uroot -pnagiosxi nagios -e 'select a.name1 as "HOST", CONCAT_WS(" ", "SERVICES:", (select count(*) from nagios_objects as b where b.name1 = a.name1 and b.objecttype_id = 2 and b.is_active = 1)) as "SERVICE COUNT" from nagios_objects as a where a.objecttype_id = 1 and a.is_active = 1;'
Locked