Hello,
We are using Nagios XI 2009R1.3 on CentOS 5.4.
I was just wondering if there are any command line tools to add/remove a host from monitoring server and do similar administration stuff or are there any documents which gives a brief idea of how Nagios XI manages hosts and services.
For example, I could delete a host and it's associated services in Nagios core by just deleting the corrosponding configuration files and do service nagios reload. But in Nagios XI this doesn't seem to work.
Any pointers or ideas are appreciated.
Thanks
Managing hosts/services from command line
Re: Managing hosts/services from command line
We've got a doc for the CCM on host management that walks through host management in XI in detail. It should hopefully cover what you need.
http://assets.nagios.com/downloads/nagi ... cm.php#ccm
Because XI stores host and service data in a database, hosts can't be removed until after their dependencies are removed. The easiest way to delete a host is do a filtered search in CCM for all of it's services, check all, then delete. Then go to the host management page and delete the host. The doc above covers this in better detail. Hope that helps!
http://assets.nagios.com/downloads/nagi ... cm.php#ccm
Because XI stores host and service data in a database, hosts can't be removed until after their dependencies are removed. The easiest way to delete a host is do a filtered search in CCM for all of it's services, check all, then delete. Then go to the host management page and delete the host. The doc above covers this in better detail. Hope that helps!
Re: Managing hosts/services from command line
Thank you for your response.
This document tells me what I have been doing so far. But then again, I am looking for something which would help me doing basic administration work from the command line.
Is there not a document which has all the information how a host is added/delete from Nagios behind the scene, for example:
1. how the object_ids are created
2. which database table does what
3. how a host is added/deleted behind the scene
4. how dependencies are stored in the database
5. what role does .cfg files play when everything is driven by db, and so on.
The worst thing is if you have over 1000 dependencies list you are doomed due to lack of search box in service dependencies page. You have no choice but to start clicking random links at pagination menu and then slowly figure out where it would be.
I hope you understand my point.
**Knock Knock**
are there any nagios developers to enlighten me?
This document tells me what I have been doing so far. But then again, I am looking for something which would help me doing basic administration work from the command line.
Is there not a document which has all the information how a host is added/delete from Nagios behind the scene, for example:
1. how the object_ids are created
2. which database table does what
3. how a host is added/deleted behind the scene
4. how dependencies are stored in the database
5. what role does .cfg files play when everything is driven by db, and so on.
The worst thing is if you have over 1000 dependencies list you are doomed due to lack of search box in service dependencies page. You have no choice but to start clicking random links at pagination menu and then slowly figure out where it would be.
I hope you understand my point.
**Knock Knock**
are there any nagios developers to enlighten me?
-
- Posts: 1128
- Joined: Wed Mar 03, 2010 12:38 pm
- Location: St. Paul, MN, USA
- Contact:
Re: Managing hosts/services from command line
I've heard of command line tools for checking Nagios service statuses, but I'm not aware of any for what you're looking for. I think you'll be writing your own thing to interface with the MySQL database used by XI.
All of that stuff pretty much is managed by NagiosQL, an open-source project that is integrated into XI. Their documentation and/or developers will probably be the best resources for finding out how to do this. You can of course figure out some parts by just poking around on the MySQL command line, but that might not be the most effective. The NagiosQL project can be found at http://www.nagiosql.org/.
All of that stuff pretty much is managed by NagiosQL, an open-source project that is integrated into XI. Their documentation and/or developers will probably be the best resources for finding out how to do this. You can of course figure out some parts by just poking around on the MySQL command line, but that might not be the most effective. The NagiosQL project can be found at http://www.nagiosql.org/.
Re: Managing hosts/services from command line
The NagiosQL development team is small and NagiosQL itself is provided as part of our product. We are attempting to keep the NagiosXI community isolated some what from the NagiosQL community because we don't wish to overwhelm them. Ordinarily any bug reports pass though us first, however if you are truly wanting to implement this on your own then it might be best for you to contact the NagiosQL community directly with your proposal.
There are a number of improvements that could be made to NagiosQL and it would be far better to see these implemented then it would be to explain it's inner workings. It would be possible for someone to take a look at the MySQL database and figure out what would be needed to delete a host and all of it's foreign keys.
It would be vary easy to turn this knowledge into a patch to NagiosQL and it would be a great first project for any one wanting to become a NagiosQL developer. However development of NagiosQL is outside of our current business model.
There are a number of improvements that could be made to NagiosQL and it would be far better to see these implemented then it would be to explain it's inner workings. It would be possible for someone to take a look at the MySQL database and figure out what would be needed to delete a host and all of it's foreign keys.
It would be vary easy to turn this knowledge into a patch to NagiosQL and it would be a great first project for any one wanting to become a NagiosQL developer. However development of NagiosQL is outside of our current business model.
Re: Managing hosts/services from command line
Thanks for the pointers, that really helped
Cheers

Cheers
Re: Managing hosts/services from command line
I've written a perl script for adding (but not deleting) hosts into the NagiosQL database for NagiosXI. I puzzled out the schema a little bit, at least enough to get the job done. If people are interested, I can post the script - is there an appropriate place to post it, or should I just put it in a code block?
Cheers,
kjamieson
Cheers,
kjamieson
Re: Managing hosts/services from command line
Nagios Exchange would be my first guess.
Re: Managing hosts/services from command line
kjamieson wrote:I've written a perl script for adding (but not deleting) hosts into the NagiosQL database for NagiosXI. I puzzled out the schema a little bit, at least enough to get the job done. If people are interested, I can post the script - is there an appropriate place to post it, or should I just put it in a code block?
Cheers,
kjamieson
perhaps you can upload it as an attachment

Re: Managing hosts/services from command line
NagiosXI has a method for adding hosts. There is a folder, I forget where but it shouldn't be too hard to find, that proper config files are dropped into. I'm not clear on the details, but I believe any file placed here will get processed. There is a php script(currently launched from cron) that feeds these to NagiosQL's config importer via http://127.0.0.1/.kjamieson wrote:I've written a perl script for adding (but not deleting) hosts into the NagiosQL database for NagiosXI. I puzzled out the schema a little bit.
Check some of our getting started/config import documentation for more details.