Page 1 of 1
Find Out Services without Service group assigned
Posted: Thu Mar 07, 2019 12:59 pm
by adminskymed
Hi All,
i need to check if someone of my services has been not assigned to any servicegroup in Nagios XI.
Is there an easy way to do that? without check any single services obviously (i have 7000 services)
Basically I have some service group like:
CPU
Interface Status
Bandwidth
Memory
ecc ecc
If I make the sum of the services in all this service group, I get a number that is less of the number of all services taken from Nagiosxi Service Status Summary. So It means that I forgot to assign the service group to some services, and I need to find this services to correct my mistake.
Thanks
Alex
Re: Find Out Services without Service group assigned
Posted: Thu Mar 07, 2019 5:03 pm
by npolovenko
Hello,
@adminskymed. Unfortunately, there is no such functionality. You could build your own script that pulls services and service groups from the database and compares them, but this is something outside of the regular support scope.
You may try the following DB query to see services without service groups but it will only work in some instances(maybe worth a try anyway):
echo "SELECT service_description FROM tbl_service WHERE servicegroups=0;" | mysql -u root -pnagiosxi nagiosql
Otherwise, you'd have to come up with some more complicated query that looks at the tables, links between tables and matches them.
echo "SELECT * from tbl_lnkServicegroupToService;" | mysql -u root -pnagiosxi nagiosql
Re: Find Out Services without Service group assigned
Posted: Fri Mar 08, 2019 4:40 am
by adminskymed
Thanks for your reply.
I found out a problem in the nagiossql database.
Basically if I add a service to servicegroup from service configuration page in nagiosxi than I can see "servicegroup" number in tbl_service changes,
but if I add a service to servicegroup from service group configuration page in nagiosxi, serviegroup field in tbl_service doesn't change.
I think it is a bug. I hope it could be solved in some way.
Ale
Re: Find Out Services without Service group assigned
Posted: Fri Mar 08, 2019 4:52 pm
by npolovenko
@adminskymed, There are different tables for services assigned to service groups from the service settings and from service groups. The other table can be also found in the nagiosql database but its more complicated because it uses links and you'd need to combine information from multiple tables at once.
echo "SELECT * FROM tbl_lnkServicegroupToService;" | mysql -u root -pnagiosxi nagiosql
echo "SELECT * FROM tbl_lnkServiceToServicegroup;" | mysql -u root -pnagiosxi nagiosql