Good day
Can someone please assist on how to configure nagios to navigate to, and display more than one environment on the same host? For example:
http://host/nagios/uat
http://host/nagios/prod
In short, I've tried and copied most folders/files inside /usr/local/nagios/, rename them, and tried some config changes e.g.
etc/cgi_uat.cfg , nagios_uat.cfg
etc/cgi_prod.cfg , nagios_prod.cfg
Als too tried configure apache config and created two nagios.configs e.g.
nagios_uat.conf
nagios_prod.conf
But still it only displayed one and the same environment, irrespective if I navigated to the UAT or to PROD URL's
Thanks
Nic
Configure Nagios to monitor multiple environments
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Configure Nagios to monitor multiple environments
you would also need to start 2 different instances of nagios
and
Either way this is going to be a mess because you are going to have to change all the paths in all of the files to reference the new paths for each type
Finally you would need to change the http directive to match the correct share and cgi directories.
Honestly, if at all possible I would recommend just installing Nagios on 2 separate VM's
Code: Select all
/usr/local/nagios/bin/nagios -c /usr/local/nagios/etc/nagios_prod.cfg -dCode: Select all
/usr/local/nagios/bin/nagios -c /usr/local/nagios/etc/nagios_uat.cfg -dFinally you would need to change the http directive to match the correct share and cgi directories.
Honestly, if at all possible I would recommend just installing Nagios on 2 separate VM's
Re: Configure Nagios to monitor multiple environments
Thanks for the reply
Preferably would like to stick to one VM monitoring multiple environments.
But will give it one more try though...
The actual problem seems to be it everytime reads the below default main config file, irrespective of the changes and different URL's
Explanation:
Ive tried and started two seperate nagios daemons as suggested (the -c option does not exists)
All config related folders were copied and modified to a uat path
/usr/local/nagios/uat/* -- etc, share, sbin ..
I've changed nagios/uat/share/config.inc.php, to point to a new UAT config
After some tests realised the problem is that it still reads the original file '/usr/local/nagios/etc/cgi.cfg'
Irrespective of the URL
http://host/uat
http://host/prod
Any idea how to make it read the uat config file?
Snippets of Updated Apache UAT config
Preferably would like to stick to one VM monitoring multiple environments.
But will give it one more try though...
The actual problem seems to be it everytime reads the below default main config file, irrespective of the changes and different URL's
Code: Select all
['main_config_file']='/usr/local/nagios/etc/cgi.cfg';Ive tried and started two seperate nagios daemons as suggested (the -c option does not exists)
Code: Select all
/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios_uat.cfg
/usr/local/nagios/bin/nagios -d /usr/local/nagios/etc/nagios_prod.cfgAll config related folders were copied and modified to a uat path
/usr/local/nagios/uat/* -- etc, share, sbin ..
I've changed nagios/uat/share/config.inc.php, to point to a new UAT config
Code: Select all
['main_config_file']='/usr/local/nagios/uat/etc/cgi.cfg';Irrespective of the URL
http://host/uat
http://host/prod
Any idea how to make it read the uat config file?
Snippets of Updated Apache UAT config
Code: Select all
ScriptAlias /uat/cgi-bin "/usr/local/nagios/uat/sbin"
Alias /uat "/usr/local/nagios/uat/share"
<Directory "/usr/local/nagios/uat/share"-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Configure Nagios to monitor multiple environments
Oh yes, you hit the other problem
What you would need to do is re-compile nagios for this 2nd version and pass the following to the ./configure
but then you would need to have the binaries stored in a different location.... and down the rabbit hole you go
Around line 1425 you can see the configure options
https://github.com/NagiosEnterprises/na ... /configure
What you would need to do is re-compile nagios for this 2nd version and pass the following to the ./configure
Code: Select all
./configure --sysconfdir=/usr/local/nagios/uat/etcAround line 1425 you can see the configure options
https://github.com/NagiosEnterprises/na ... /configure
Re: Configure Nagios to monitor multiple environments
Thanks very much for assistance, issue clarified now. Decided to go for a Nagios VM per environment
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Configure Nagios to monitor multiple environments
Sounds like a good planNicoN wrote:Thanks very much for assistance, issue clarified now. Decided to go for a Nagios VM per environment