Page 1 of 1

Host checks fails due to possible format issue

Posted: Tue Feb 21, 2012 5:45 pm
by tecnalb
Hello,

I have several devices behind firewalls I am monitoring. Previous to the latest update I have not seemed to have issues change the default host checks from ICMP to a different check. But today I have spent much time trying to get a new device setup, and they keep failing. The services themselves are OK. Its just the host check.

Most of my devices are behind firewalls with a single IP, so I redirect an external port to the internal :161. So while attempting to resolve this I see the following error. As you can see, there is an additional ":161" appended to my command. I can't find where its coming from.

CMD: /usr/bin/snmpget -t 1 -r 5 -m '' -v 1 [authpriv] xx.xxx.xxx.xx:11161:161

The command should be everything above except the :161

In this example, my host was setup as <ip address>:11161 and it works for services checks. I tried to copy another working device in the same config, but I cannot seem to isolate what change I must have made earlier, or where this :161 is coming from.

Thanks!

Re: Host checks fails due to possible format issue

Posted: Tue Feb 21, 2012 6:00 pm
by scottwilkerson
can you post what you have in each of the fields in the CCM as well as what you have set for this command

Re: Host checks fails due to possible format issue

Posted: Wed Feb 22, 2012 4:19 pm
by tecnalb
Hostname: IP:11161
Address: IP:11161
Check command is blank

Template: nagios_NAS_firewalled

The template is

check_xi_service_snmp
Command: $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$
$ARG1$: -o sysUpTimeInstance -C public -P 1 -m DISMAN-EVENT-MIB


I have another host configured the exact same way, but it passes.

Re: Host checks fails due to possible format issue

Posted: Wed Feb 22, 2012 4:28 pm
by tecnalb
Ahh, I think I found the issue... the -C is not what is set there. So from the command line I can make it work. But I'm still confused about where the :161 is coming from...

Re: Host checks fails due to possible format issue

Posted: Wed Feb 22, 2012 4:38 pm
by scottwilkerson
add this to $ARG1$
-p 11161

making it

Code: Select all

-o sysUpTimeInstance -C public -P 1 -m DISMAN-EVENT-MIB -p 11161
And your host address should just be
<ip address>

Re: Host checks fails due to possible format issue

Posted: Wed Feb 22, 2012 4:55 pm
by tecnalb
OK, so here is another question... I'm a noob...

So I backtracked, down to the "check command" level, and created a new check:

new_check_command: $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$ $ARG2$

then I went to the Host Command Template screen and create a new host template:

template name: new_template
Check command: new_check_command
$ARG1$: -C community
$ARG2$: -o sysUpTimeInstance -P 1 -m DISMAN-EVENT-MIB

then I went to the Host Management screen and modified my host with
NO check command
$ARG1$: community
use the template "new_template"

it didn't work....

So when using the template I assume I cannot pass an $ARG$ to a template?? Unless within the template? Or, do I need to use a different $ARG$ like $ARG3$?

Basically my goal is this... I need to check these NAS devices which are all behind firewalls, with a port-forward from a non-standard port to :161. The ICMP seems to always fail, so I was going to use the snmp get as the check. It works. However, I need to pass a custom community string to each device. The standard XI check) snmp does not seem to allow for that. Or I'm using the wrong one.

This is fun!! :)

Re: Host checks fails due to possible format issue

Posted: Wed Feb 22, 2012 5:40 pm
by scottwilkerson
tecnalb wrote:So when using the template I assume I cannot pass an $ARG$ to a template?? Unless within the template?
Correct.
If you are using a template it is going to use the $ARGn$ from the template.

You can select the new_check_command in the host to override the template.
and pass the port you want to use in your $ARGn$ with the -p argument

So in your host use the following
Check command: new_check_command
$ARG1$: -C community -p PORT
$ARG2$: -o sysUpTimeInstance -P 1 -m DISMAN-EVENT-MIB

Re: Host checks fails due to possible format issue

Posted: Thu Feb 23, 2012 6:22 am
by tecnalb
So in the end, is a Host template not the way to design a check that can pull that information, like a custom community string? I guess i need to study the docs better. Ha! Thanks for the help. I did the suggestion you made, and that fixed it up.

Re: Host checks fails due to possible format issue

Posted: Thu Feb 23, 2012 8:05 am
by scottwilkerson
tecnalb wrote:So in the end, is a Host template not the way to design a check that can pull that information, like a custom community string? I guess i need to study the docs better. Ha! Thanks for the help. I did the suggestion you made, and that fixed it up.
Correct. Adding the check command to a template works great for things that don't change host to host, and the only thing that is different for the check command is the hostaddress. certainly you could still use a template if you have other settings that you want the same between all of your hosts, but if an item in the check is going to change like the community string, then you will need to override the template and specify the check on the host.