Page 1 of 1

how to list all HOST added without SERVICE

Posted: Wed Jun 16, 2021 8:51 am
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

Re: how to list all HOST added without SERVICE

Posted: Wed Jun 16, 2021 2:59 pm
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;'