We have several instances of Nagios XI running for different teams.
We would like to be able to use a central mysql db to store all of the check results (so we can easily pull the data from one spot to present it in our portal).
I've already went through the following steps to try to accomplish this:
-Setup mysql on a separate server
-Ran the ndoutils initialization script to setup the nagios schema on the db
-I then modified /usr/local/nagios/etc/ndomod.cfg on the nagios xi servers and gave each of them a unique instance-name.
-I then modified /usr/local/nagios/etcndo2db.cfg on the nagios xi servers to point to the new db.
-I then modified the ndoutils section in /usr/local/nagiosxi/html/config.inc.php to point to the new db.
After restarting nagios and ndo2db everywhere; I see the data being written to the new db; however, the "Service Status" section in Nagios XI is no longer being updated.
All of the nagios xi instances are displaying the same "Service Status" data.
I noticed in the config.inc.php under the ndoutils section there is no place to specify the "instance-name". Without the instance name how will each nagios xi server know which services belong to it?
Multiple Nagios XI Servers with NDO data in one database
Re: Multiple Nagios XI Servers with NDO data in one database
In /usr/local/nagiosxi/html/config.inc.php I think I found the setting I was looking for: $cfg['default_instance_id']=3; // default ndoutils instance to read from
However, this was below the line that read "/********* DO NOT MODIFY ANYTHING BELOW THIS LINE **********/
I risked my life and changed this to the correct instance id; however, nagios xi was still displaying the data for instance id 1.
Is there another place where this value should be changed?
However, this was below the line that read "/********* DO NOT MODIFY ANYTHING BELOW THIS LINE **********/
I risked my life and changed this to the correct instance id; however, nagios xi was still displaying the data for instance id 1.
Is there another place where this value should be changed?
-
sreinhardt
- -fno-stack-protector
- Posts: 4366
- Joined: Mon Nov 19, 2012 12:10 pm
Re: Multiple Nagios XI Servers with NDO data in one database
I can't say that we have had anyone try this, at least to my knowledge. Let me take a look around and find some more detail info on what else you might need to change.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Re: Multiple Nagios XI Servers with NDO data in one database
If I use the command backend?cmd=getinstances, it returns:
<instancelist>
<recordcount>1</recordcount>
<instance id="1">
<id>1</id>
<name>localhost</name>
<description/>
</instance>
</instancelist>
However, this is incorrect. The ndoutils db that this nagios xi instance is connecting to has 5 instances.
I'm trying to figure out where the above command was pulling its data from, anyone know of this?
<instancelist>
<recordcount>1</recordcount>
<instance id="1">
<id>1</id>
<name>localhost</name>
<description/>
</instance>
</instancelist>
However, this is incorrect. The ndoutils db that this nagios xi instance is connecting to has 5 instances.
I'm trying to figure out where the above command was pulling its data from, anyone know of this?
Re: Multiple Nagios XI Servers with NDO data in one database
In /usr/local/nagiosxi/html/includes/utils-objects.inc.php there is a function called: get_current_instance_id
It looks like this is used to determine the instance id.
It looks like this:
function get_current_instance_id(){
global $cfg;
$instance_id=-1;
if(isset($_SESSION["current_instance_id"])) // current instance
$instance_id=$_SESSION["current_instance_id"];
else if (isset($cfg['default_instance_id'])) // fallback to default instance
$instance_id=$cfg['default_instance_id'];
else
$instance_id=1;
return $instance_id;
}
I set the default_instance_id in the config to 3, so this means the instance_id is being pulled from "$_SESSION["current_instance_id"]".
Anyone know how this is set?
It looks like this is used to determine the instance id.
It looks like this:
function get_current_instance_id(){
global $cfg;
$instance_id=-1;
if(isset($_SESSION["current_instance_id"])) // current instance
$instance_id=$_SESSION["current_instance_id"];
else if (isset($cfg['default_instance_id'])) // fallback to default instance
$instance_id=$cfg['default_instance_id'];
else
$instance_id=1;
return $instance_id;
}
I set the default_instance_id in the config to 3, so this means the instance_id is being pulled from "$_SESSION["current_instance_id"]".
Anyone know how this is set?
-
slansing
- Posts: 7698
- Joined: Mon Apr 23, 2012 4:28 pm
- Location: Travelling through time and space...
Re: Multiple Nagios XI Servers with NDO data in one database
Well, that is stored by php when the session is initiated, I'm trying to work out a way you can easily dump this for reading. You would want to use something like:
http://stackoverflow.com/questions/5383 ... -variables
http://php.about.com/od/advancedphp/ss/ ... ions_2.htm
http://stackoverflow.com/questions/5383 ... -variables
http://php.about.com/od/advancedphp/ss/ ... ions_2.htm
Re: Multiple Nagios XI Servers with NDO data in one database
Thanks.
So $_SESSION["current_instance_id"] is set when the session is started, do we know where in the code that occurs and what it is set to?
I've grepped through the code a lot and see instance_id being passed around, but I can't seem to find where it is initially set.
I'll try the method in the first link you sent to see if it can help me debug this.
I think I noticed several places in the code where the instance_id was hard coded to 1 though, which would be a problem.
So $_SESSION["current_instance_id"] is set when the session is started, do we know where in the code that occurs and what it is set to?
I've grepped through the code a lot and see instance_id being passed around, but I can't seem to find where it is initially set.
I'll try the method in the first link you sent to see if it can help me debug this.
I think I noticed several places in the code where the instance_id was hard coded to 1 though, which would be a problem.
Re: Multiple Nagios XI Servers with NDO data in one database
Yep, this would be an issue. You may want to open up a feature request for the parametrization of this value in config.inc.php on the tracker: http://racker.nagios.com.jscherle wrote:I think I noticed several places in the code where the instance_id was hard coded to 1 though, which would be a problem.
Alternatively, you could configure each instance to only listen on a specific port, and then specify that port in the relevant configs.
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.