Network Dependencies

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
chandasandeep
Posts: 8
Joined: Sun Dec 04, 2016 11:38 pm

Network Dependencies

Post by chandasandeep »

Hi Team,

We are using Nagios Core for monitoring Tool. Recently we have faced an issue between two data centers which causes to getting the alerts from second data center as its different network.

so , i tried to give the configuration set up as given below and found that error while restarting the nagios service.

Could you please help me out asap

define hostdependency{
host_name Host A
dependent_host_name 10.175.23.1
notification_failure_criteria d
}
define hostdependency{
host_name Host B
dependent_host_name 10.175.23.1
notification_failure_criteria d,u
}

Note : Error which we are recieving like as given blow.

[root@azmrns01 hosts]# service nagios restart
Restarting nagios (via systemctl): Job for nagios.service failed because the control process exited with error code. See "systemctl status nagios.service" and "journalctl -xe" for details.
[FAILED]
[root@azmrns01 hosts]# tail -f /var/log/messages
Dec 5 04:31:42 azmrns01 nagios: Check your configuration file(s) to ensure that they contain valid
Dec 5 04:31:42 azmrns01 nagios: directives and data defintions. If you are upgrading from a previous
Dec 5 04:31:42 azmrns01 nagios: version of Nagios, you should be aware that some variables/definitions
Dec 5 04:31:42 azmrns01 nagios: may have been removed or modified in this version. Make sure to read
Dec 5 04:31:42 azmrns01 nagios: the HTML documentation regarding the config files, as well as the
Dec 5 04:31:42 azmrns01 nagios: 'Whats New' section to find out what has changed.
Dec 5 04:31:42 azmrns01 systemd: nagios.service: control process exited, code=exited status=8
Dec 5 04:31:42 azmrns01 systemd: Failed to start LSB: Starts and stops the Nagios monitoring server.
Dec 5 04:31:42 azmrns01 systemd: Unit nagios.service entered failed state.
Dec 5 04:31:42 azmrns01 systemd: nagios.service failed.
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: Network Dependencies

Post by avandemore »

What is the output from:

Code: Select all

/usr/local/nagios/bin/nagios -vvv /usr/local/nagios/etc/nagios.cfg
Previous Nagios employee
chandasandeep
Posts: 8
Joined: Sun Dec 04, 2016 11:38 pm

Re: Network Dependencies

Post by chandasandeep »

Hi Thanks for your reply,

Here are the out put details as given below.

My requirement is to configure network dependencies. we have linux servers in two data centers with different network. one data center xyz and nagios is set up in same data center, when vpn disconnected second data center servers are getting server down alerts from nagios.

So i tried to configure as given below.

[root@azmrns01 hosts]# /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

Nagios Core 4.0.8
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-12-2014
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Read main config file okay...
Warning: Duplicate definition found for service 'disk write queue length' on host 'TDMRAXSQL01' (config file '/usr/local/nagios/etc/objects/hosts/TDMRAXSQL01.cfg', starting on line 218)
Warning: Duplicate definition found for service 'disk read queue length' on host 'TDMRAXSQL01' (config file '/usr/local/nagios/etc/objects/hosts/TDMRAXSQL01.cfg', starting on line 209)
Warning: Duplicate definition found for service 'disk write queue length' on host 'TDMRAXDEVSQL01' (config file '/usr/local/nagios/etc/objects/hosts/TDMRAXDEVSQL01.cfg', starting on line 218)
Warning: Duplicate definition found for service 'disk read queue length' on host 'TDMRAXDEVSQL01' (config file '/usr/local/nagios/etc/objects/hosts/TDMRAXDEVSQL01.cfg', starting on line 209)
Warning: Duplicate definition found for service 'disk write queue length' on host 'TDMRSQL01' (config file '/usr/local/nagios/etc/objects/hosts/TDMRSQL01.cfg', starting on line 233)
Warning: Duplicate definition found for service 'disk read queue length' on host 'TDMRSQL01' (config file '/usr/local/nagios/etc/objects/hosts/TDMRSQL01.cfg', starting on line 224)
Warning: Duplicate definition found for service 'data buffer cache hit ratio' on host 'TDMRSQL01' (config file '/usr/local/nagios/etc/objects/hosts/TDMRSQL01.cfg', starting on line 198)
Warning: Duplicate definition found for service 'SQL connection time' on host 'TDMRSQL01' (config file '/usr/local/nagios/etc/objects/hosts/TDMRSQL01.cfg', starting on line 190)
Warning: Duplicate definition found for service 'disk write queue length' on host 'AZMRAXSQL01' (config file '/usr/local/nagios/etc/objects/hosts/AZMRAXSQL01.cfg', starting on line 213)
Warning: Duplicate definition found for service 'disk read queue length' on host 'AZMRAXSQL01' (config file '/usr/local/nagios/etc/objects/hosts/AZMRAXSQL01.cfg', starting on line 204)
Warning: Duplicate definition found for service 'sql service CPU privileged time' on host 'TDMRAXDW01' (config file '/usr/local/nagios/etc/objects/hosts/TDMRAXDW01.cfg', starting on line 295)
Warning: Duplicate definition found for service 'disk write queue length' on host 'TDMRAXDW01' (config file '/usr/local/nagios/etc/objects/hosts/TDMRAXDW01.cfg', starting on line 204)
Warning: Duplicate definition found for service 'disk read queue length' on host 'TDMRAXDW01' (config file '/usr/local/nagios/etc/objects/hosts/TDMRAXDW01.cfg', starting on line 195)
Warning: Duplicate definition found for service 'disk write queue length' on host 'TDMRSRS01' (config file '/usr/local/nagios/etc/objects/hosts/TDMRSRS01.cfg', starting on line 249)
Warning: Duplicate definition found for service 'disk read queue length' on host 'TDMRSRS01' (config file '/usr/local/nagios/etc/objects/hosts/TDMRSRS01.cfg', starting on line 240)
Warning: Duplicate definition found for service 'disk write queue length' on host 'TDMRSQL02' (config file '/usr/local/nagios/etc/objects/hosts/TDMRSQL02.cfg', starting on line 221)
Warning: Duplicate definition found for service 'disk read queue length' on host 'TDMRSQL02' (config file '/usr/local/nagios/etc/objects/hosts/TDMRSQL02.cfg', starting on line 212)
Warning: Duplicate definition found for service 'disk write queue length' on host 'AZMRDEVAXSQL01' (config file '/usr/local/nagios/etc/objects/hosts/AZMRDEVAXSQL01.cfg', starting on line 199)
Warning: Duplicate definition found for service 'disk read queue length' on host 'AZMRDEVAXSQL01' (config file '/usr/local/nagios/etc/objects/hosts/AZMRDEVAXSQL01.cfg', starting on line 190)
Warning: Duplicate definition found for service 'disk write queue length' on host 'TDMRAXSQL02' (config file '/usr/local/nagios/etc/objects/hosts/TDMRAXSQL02.cfg', starting on line 220)
Warning: Duplicate definition found for service 'disk read queue length' on host 'TDMRAXSQL02' (config file '/usr/local/nagios/etc/objects/hosts/TDMRAXSQL02.cfg', starting on line 211)
Error: Invalid max_check_attempts value for host 'gateway'
Error: Could not register host (config file '/usr/local/nagios/etc/objects/hosts/host-gateway.cfg', starting on line 2)
Error processing object config files!


***> One or more problems was encountered while processing the config files...

Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.



[root@azmrns01 hosts]# more host-gateway.cfg
# a host definition for the gateway of the default route
define host {
host_name gateway
alias Default Gateway
address 10.175.23.1
use generic-host
}


Thanks,
Sandeep
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: Network Dependencies

Post by avandemore »

That's a pretty clear error as to what is happening:
Error: Invalid max_check_attempts value for host 'gateway'
Please see this: https://assets.nagios.com/downloads/nag ... .html#host
You'll notice max_check_attempts is a required value. So either adjust that definition or assign it a template it inherit the value from.
Previous Nagios employee
chandasandeep
Posts: 8
Joined: Sun Dec 04, 2016 11:38 pm

Re: Network Dependencies

Post by chandasandeep »

Hi Thank you for assistance.

successfully i have configured gateway

[root@azmrns01 hosts]# cat host-gateway.cfg
# a host definition for the gateway of the default route
define host{
host_name Gateway
alias Bogus Router #1
address 10.175.23.81
check_command check-host-alive
check_interval 1
retry_interval 1
max_check_attempts 5
check_period 24x7
process_perf_data 0
retain_nonstatus_information 0
contact_groups admins
notification_interval 2
notification_period 24x7
notification_options d,u,r
}

and here are dependencies in same gateway config file.

define hostdependency{
host_name AZMRDC01
dependent_host_name Gateway
notification_failure_criteria d
}

define hostdependency{
host_name TDMRAXDEVSQL01
dependent_host_name Gateway
notification_failure_criteria d,u
}

Note : My question is when vpn disconnected between AZMRDC01 and TDMRAXDEVSQL01 network. we have to get host unreachable or etc alerts on TDMRAXDEVSQL01 server. please let me know where and how should i place set up.

thanks in advance.
Sandeep
avandemore
Posts: 1597
Joined: Tue Sep 27, 2016 4:57 pm

Re: Network Dependencies

Post by avandemore »

If I understand your setup correctly you have something like this:

TDMRAXDEVSQL01+---------+Gateway(VPN)+---------+AZMRDC01

If this the case, the Gateway VPN software should be exposing some type of VPN status information.

If it was me, I'd find a plugin for that on https://exchange.nagios.org/ or write a custom one, and monitor that. I would setup notifications based upon that, and then those hosts could depend on the Gateway VPN check status.
Previous Nagios employee
chandasandeep
Posts: 8
Joined: Sun Dec 04, 2016 11:38 pm

Re: Network Dependencies

Post by chandasandeep »

Hi Thank you for help.

other than gateway plugin, can we monitor by host dependency. if A host is one network and B host is another network. if host B network disconnect i will get a host unreachable alert rather than down alert. why because when i checked B host manually its up and running fine.

Thanks in advance.
Sandeep
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Network Dependencies

Post by rkennedy »

If I understand correctly, yes, you should be able to, take a look at this link - https://assets.nagios.com/downloads/nag ... ncies.html
Former Nagios Employee
Locked