monitoring routers and switch with nagios

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
barry1946
Posts: 32
Joined: Wed Aug 14, 2013 11:29 am

monitoring routers and switch with nagios

Post by barry1946 »

I have installed [b](nagios-3.5.0-1.el6.x86_64[/b] )on(centos 6.4 x64.) using yum
the purpose is to monitor the routers and switches .
but I am facing some problem:
1)my nagios.cfg is in /etc/nagios/ while all the tutorials including nagios officials say it exist in (/usr/local/nagios/etc/nagios.cfg directory)

anyway while i uncomment cfg_file=/usr/local/nagios/etc/objects/switch.cfg and enter the following configs

define host{
use routers
host_name cisco-7200
alias Cisco 7200
address 192.168.162.200
hostgroups routers
}

# Create a new hostgroup for switches

define hostgroup{
hostgroup_name routers
alias Network routers
}

I receive this error all the time:
Running configuration check... CONFIG ERROR! Restart aborted. Check your Nagios configuration.
this is my rpm -qa | grep nagios

nagios-plugins-by_ssh-1.4.16-5.el6.x86_64
nagios-plugins-fping-1.4.16-5.el6.x86_64
nagios-plugins-smtp-1.4.16-5.el6.x86_64
nagios-plugins-mrtgtraf-1.4.16-5.el6.x86_64
nagios-3.5.0-1.el6.x86_64
nagios-plugins-sensors-1.4.16-5.el6.x86_64
nagios-plugins-breeze-1.4.16-5.el6.x86_64
nagios-plugins-cluster-1.4.16-5.el6.x86_64
nagios-plugins-tcp-1.4.16-5.el6.x86_64
nagios-plugins-procs-1.4.16-5.el6.x86_64
nagios-plugins-ssh-1.4.16-5.el6.x86_64
nagios-plugins-all-1.4.16-5.el6.x86_64
nagios-plugins-ntp-perl-1.4.16-5.el6.x86_64
nagios-plugins-load-1.4.16-5.el6.x86_64
nagios-plugins-log-1.4.16-5.el6.x86_64
nagios-plugins-disk-1.4.16-5.el6.x86_64
nagios-plugins-dummy-1.4.16-5.el6.x86_64
nagios-plugins-perl-1.4.16-5.el6.x86_64
nagios-plugins-snmp-1.4.16-5.el6.x86_64
nagios-plugins-rpc-1.4.16-5.el6.x86_64
nagios-plugins-mailq-1.4.16-5.el6.x86_64
nagios-plugins-nagios-1.4.16-5.el6.x86_64
nagios-plugins-ups-1.4.16-5.el6.x86_64
nagios-plugins-ldap-1.4.16-5.el6.x86_64
nagios-plugins-icmp-1.4.16-5.el6.x86_64
nagios-plugins-time-1.4.16-5.el6.x86_64
nagios-plugins-nrpe-2.14-3.el6.x86_64
nagios-plugins-http-1.4.16-5.el6.x86_64
nagios-plugins-ping-1.4.16-5.el6.x86_64
nagios-plugins-game-1.4.16-5.el6.x86_64
nagios-common-3.5.0-1.el6.x86_64
nagios-plugins-ircd-1.4.16-5.el6.x86_64
nagios-plugins-flexlm-1.4.16-5.el6.x86_64
nagios-plugins-file_age-1.4.16-5.el6.x86_64
nagios-plugins-dig-1.4.16-5.el6.x86_64
nagios-plugins-swap-1.4.16-5.el6.x86_64
nagios-plugins-dns-1.4.16-5.el6.x86_64
nagios-plugins-hpjd-1.4.16-5.el6.x86_64
nagios-plugins-oracle-1.4.16-5.el6.x86_64
nagios-plugins-mrtg-1.4.16-5.el6.x86_64
nagios-plugins-overcr-1.4.16-5.el6.x86_64
nagios-plugins-nwstat-1.4.16-5.el6.x86_64
nagios-plugins-ide_smart-1.4.16-5.el6.x86_64
nagios-plugins-users-1.4.16-5.el6.x86_64
nagios-plugins-wave-1.4.16-5.el6.x86_64
nagios-plugins-pgsql-1.4.16-5.el6.x86_64
nagios-plugins-ntp-1.4.16-5.el6.x86_64
nagios-plugins-dhcp-1.4.16-5.el6.x86_64
nagios-plugins-mysql-1.4.16-5.el6.x86_64
nagios-plugins-nt-1.4.16-5.el6.x86_64
nagios-devel-3.5.0-1.el6.x86_64
nagios-plugins-1.4.16-5.el6.x86_64
nagios-plugins-disk_smb-1.4.16-5.el6.x86_64
nagios-plugins-real-1.4.16-5.el6.x86_64

do u have any idea which helps?
thanks in advance?
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: monitoring routers and switch with nagios

Post by slansing »

Please run the following and share the output "wrap it with the 'CODE' tool within the reply page."

Be sure to alter the paths to the bin and the .cfg if they are different in your installation:

Code: Select all

/usr/local/nagios/bin/nagios -v /etc/nagios.cfg
Cited:

http://nagios.sourceforge.net/docs/3_0/ ... onfig.html
barry1946
Posts: 32
Joined: Wed Aug 14, 2013 11:29 am

Re: monitoring routers and switch with nagios

Post by barry1946 »

Dear thanks for answering :

[root@nagios local]# echo $PATH
:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/etc:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/etc:/usr/local/nagios/bin/:/usr/local/nagios/bin/nagios

[root@nagios ~]# cd /usr/local/
[root@nagios local]# ls
bin etc games include lib lib64 libexec sbin share src

[root@nagios local]# /usr/local/nagios/bin/nagios -v /etc/nagios.cfg
-bash: /usr/local/nagios/bin/nagios: No such file or directory

this directory does not exist .
for me it is like this :
[root@nagios nagios]# cd /etc/nagios/objects/
[root@nagios objects]# ls
commands.cfg contacts.cfg localhost.cfg printer.cfg switch.cfg templates.cfg timeperiods.cfg windows.cfg
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: monitoring routers and switch with nagios

Post by slansing »

As mentioned you will need to change the directories to where you have those files at. So, you will need to locate your nagios bin and the location of your nagios.cfg which I believe you posted.
barry1946
Posts: 32
Joined: Wed Aug 14, 2013 11:29 am

Re: monitoring routers and switch with nagios

Post by barry1946 »

I think this is what you mean :
I did like this:
[root@nagios objects]# whereis nagios
nagios: /usr/sbin/nagios /etc/nagios /usr/lib64/nagios /usr/include/nagios /usr/share/nagios

then I added these to the path I also added /etc to the path then i couls get some answers:
then

[root@nagios objects]# /usr/sbin/nagios -v /etc/nagios.cfg

Nagios Core 3.5.0
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 03-15-2013
License: GPL

Website: http://www.nagios.org
Reading configuration data...
Error: Cannot open main configuration file '/etc/nagios.cfg' for reading!
Error processing main config file!



***> 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.
the problem after restarting the service still exist!
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: monitoring routers and switch with nagios

Post by abrist »

there is a good change the nagios.cfg is located inside the /etc/nagios directory:
Try:

Code: Select all

/usr/sbin/nagios -v /etc/nagios/nagios.cfg
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.
barry1946
Posts: 32
Joined: Wed Aug 14, 2013 11:29 am

Re: monitoring routers and switch with nagios

Post by barry1946 »

the problem solved.
i should have enter the router configuration data in switch.cfg file not the nagios.cfg file
thanks for your responses anyway
Locked