localhost and switch status Down

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.
csandy1703
Posts: 1
Joined: Wed Sep 25, 2013 4:51 am

localhost and switch status Down

Post by csandy1703 »

Deal All

I have installed NagiOS 4.0.0. with no errors.

However after opening nagios interface, localhost status is DOWN always.

Also I added one switch in /usr/local/nagios/etc/objects/switch.cfg, but it also showing DOWN.

Pl help
volpeadmin
Posts: 21
Joined: Wed Sep 25, 2013 9:44 am

Re: localhost and switch status Down

Post by volpeadmin »

I'm also having this same problem...I've found threads elsewhere outside the official support forum that suggest the service.cfg and hosts.cfg should be checked for syntax errors, etc, however after a clean install on my part, I don't find those files anywhere...
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: localhost and switch status Down

Post by abrist »

In a clean install, localhost.cfg should hold these config objects. What is the listing of the directory:

Code: Select all

ls -la /usr/local/nagios/etc
ls -la /usr/local/nagios/etc/objects
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.
volpeadmin
Posts: 21
Joined: Wed Sep 25, 2013 9:44 am

Re: localhost and switch status Down

Post by volpeadmin »

# ls -la /usr/local/nagios/etc
total 76
drwxrwxr-x. 3 nagios nagios 4096 Sep 24 15:35 .
drwxr-xr-x. 8 root root 4096 Sep 18 14:46 ..
-rw-rw-r--. 1 nagios nagios 11669 Sep 18 14:46 cgi.cfg
-rw-r--r--. 1 nagios nagios 26 Sep 18 16:35 htpasswd.users
-rw-rw-r--. 1 nagios nagios 44710 Sep 18 14:46 nagios.cfg
drwxrwxr-x. 2 nagios nagios 4096 Sep 25 09:17 objects
-rw-rw----. 1 nagios nagios 1340 Sep 18 14:46 resource.cfg
# ls -la /usr/local/nagios/etc/objects
total 56
drwxrwxr-x. 2 nagios nagios 4096 Sep 25 09:17 .
drwxrwxr-x. 3 nagios nagios 4096 Sep 24 15:35 ..
-rw-rw-r--. 1 nagios nagios 7716 Sep 18 14:46 commands.cfg
-rw-rw-r--. 1 nagios nagios 2166 Sep 18 14:46 contacts.cfg
-rw-rw-r--. 1 nagios nagios 5408 Sep 25 09:17 localhost.cfg
-rw-rw-r--. 1 nagios nagios 3124 Sep 18 14:46 printer.cfg
-rw-rw-r--. 1 nagios nagios 3293 Sep 18 14:46 switch.cfg
-rw-rw-r--. 1 nagios nagios 10812 Sep 18 14:46 templates.cfg
-rw-rw-r--. 1 nagios nagios 3208 Sep 18 14:46 timeperiods.cfg
-rw-rw-r--. 1 nagios nagios 4019 Sep 18 14:46 windows.cfg
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: localhost and switch status Down

Post by abrist »

Well, you have a localhost.cfg, and it is not empty. Is the objects folder included in the nagios cfg?

Code: Select all

grep cfg_ /usr/local/nagios/etc/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.
volpeadmin
Posts: 21
Joined: Wed Sep 25, 2013 9:44 am

Re: localhost and switch status Down

Post by volpeadmin »

cfg_file=/usr/local/nagios/etc/objects/commands.cfg
cfg_file=/usr/local/nagios/etc/objects/contacts.cfg
cfg_file=/usr/local/nagios/etc/objects/timeperiods.cfg
cfg_file=/usr/local/nagios/etc/objects/templates.cfg
cfg_file=/usr/local/nagios/etc/objects/localhost.cfg
#cfg_file=/usr/local/nagios/etc/objects/windows.cfg
#cfg_file=/usr/local/nagios/etc/objects/switch.cfg
#cfg_file=/usr/local/nagios/etc/objects/printer.cfg
# extension) in a particular directory by using the cfg_dir
#cfg_dir=/usr/local/nagios/etc/servers
#cfg_dir=/usr/local/nagios/etc/printers
#cfg_dir=/usr/local/nagios/etc/switches
#cfg_dir=/usr/local/nagios/etc/routers
# object configuration files (see the cfg_file and cfg_dir options above).
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: localhost and switch status Down

Post by sreinhardt »

By default the host checks are just check_ping. Have you verified that your host is allowing responses from icmp packets and allowing them output or that your switch is responding to them?
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.
volpeadmin
Posts: 21
Joined: Wed Sep 25, 2013 9:44 am

Re: localhost and switch status Down

Post by volpeadmin »

# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:5903
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:5902
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:5901
ACCEPT icmp -- anywhere anywhere

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: localhost and switch status Down

Post by sreinhardt »

well, everything looks good there. Let's do a ping to both and just be 100% sure that icmp is working.
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.
volpeadmin
Posts: 21
Joined: Wed Sep 25, 2013 9:44 am

Re: localhost and switch status Down

Post by volpeadmin »

# ping -c3 152.122.15.15
PING 152.122.15.15 (152.122.15.15) 56(84) bytes of data.
64 bytes from 152.122.15.15: icmp_seq=1 ttl=255 time=0.469 ms
64 bytes from 152.122.15.15: icmp_seq=2 ttl=255 time=0.557 ms
64 bytes from 152.122.15.15: icmp_seq=3 ttl=255 time=0.425 ms

--- 152.122.15.15 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.425/0.483/0.557/0.060 ms

# ping -c3 localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.070 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.018 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.042 ms

--- localhost ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.018/0.043/0.070/0.021 ms
Locked