Nagios XI Import Inactive Hosts
Nagios XI Import Inactive Hosts
I'm trying to monitor hosts and services that will leave one Nagios XI server and join another one. When they are active, I can see them in /usr/local/nagios/etc/hosts and /usr/local/nagios/etc/services. When I deactivate them in CCM and apply, they are no longer in /usr/local/nagios/etc/hosts and /usr/local/nagios/etc/services. Is there any way to import hosts and services that default as inactive (visible in CCM) and then activate them using CCM when they are being monitored by a Nagios XI server?
Re: Nagios XI Import Inactive Hosts
How are you importing the hosts?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: Nagios XI Import Inactive Hosts
Following the procedure outlined in "Automated Host Management In Nagios XI"
Placing .cfg files (each one has a host defined with its associated services) into /usr/local/nagios/etc/import.
Running /usr/local/nagiosxi/scripts/reconfigure_nagios.sh
Placing .cfg files (each one has a host defined with its associated services) into /usr/local/nagios/etc/import.
Running /usr/local/nagiosxi/scripts/reconfigure_nagios.sh
Re: Nagios XI Import Inactive Hosts
Well, here is one method, though it will cause all imported objects to be set to "inactive" at first. One thing to note is that this may effect wizards as well.
Edit the following file:
Change Line Number #555 From:
To:
So that the if statement reads:
This change will be overwritten by a Nagios XI upgrade.
Edit the following file:
Code: Select all
/usr/local/nagiosxi/html/includes/components/ccm/classes/import_class.phpCode: Select all
$intActive = 1;Code: Select all
$intActive = 0;Code: Select all
if (isset($arrImportData['register']) && ($arrImportData['register']['value'] == 0) && ($intIsTemplate != 1)) {
$intActive = 0;
} else {
$intActive = 0;Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: Nagios XI Import Inactive Hosts
Thanks for the reply. There are more hosts that should start as active than there are inactive. I'll keep them as all active when I import them. Is there a command line alternative to using the CCM for deactivating the services of a host and then deactivating the host? For example, I use the /usr/local/nagiosxi/scripts/nagiosql_delete_service.php and nagiosql_delete_host.php to remove a host and its associated services.
Re: Nagios XI Import Inactive Hosts
Not a scripted one like the nagiosql scripts. You could run an SQL update query to the object in nagios ql changing the object to inactive.toodaly wrote:Is there a command line alternative to using the CCM for deactivating the services of a host and then deactivating the host?
The issues with this are that after an import (which restarts nagios), the above change would essentially force another nagios restart before they are set to inactive.
Does this make sense?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: Nagios XI Import Inactive Hosts
OK. I have no experience with SQL. I'll stick to using the XI GUI unless there's an easy way to extract the information I need.
Using google:
update <table>
set <column>=<inactive keyword>
where <column>=<active keyword>
What does Nagios XI use for host or service <table>, what is the active/inactive <column> (is it different for hosts and services), is the column value 0 or 1 for active or inactive or is there a keyword (i.e. ACTIVE or INACTIVE)?
Again if it gets too complex or if I can easily corrupt the database, I'll stick with the XI GUI.
Thanks.
Using google:
update <table>
set <column>=<inactive keyword>
where <column>=<active keyword>
What does Nagios XI use for host or service <table>, what is the active/inactive <column> (is it different for hosts and services), is the column value 0 or 1 for active or inactive or is there a keyword (i.e. ACTIVE or INACTIVE)?
Again if it gets too complex or if I can easily corrupt the database, I'll stick with the XI GUI.
Thanks.
Re: Nagios XI Import Inactive Hosts
Honestly, if you do not have experience using sql, I would be wary to help you implement this.toodaly wrote:Again if it gets too complex or if I can easily corrupt the database, I'll stick with the XI GUI.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: Nagios XI Import Inactive Hosts
OK. Thanks. I'll stick with the XI GUI.
Re: Nagios XI Import Inactive Hosts
No problem, I do wish there was an easier way for you.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.