Page 1 of 2

Nagios plugins - interfacetable_v3t issues

Posted: Tue Feb 13, 2018 7:56 pm
by charpham
Hi

Has anybody used this plugin for Nagios Core 4.3.4 on CentOS 7? I am having some problems on how to use this.. The documentation in regards to the actual configuration setup for Nagios is virtually non existent. There is no mention as how to configure this in the cfg files.. I can run the command from CLI and get results but when adding it to my switch.cfg and command.cfg, I get errors when I reload nagios. I am not sure how this is done... here is a snippet of my command.cfg file

#checking router and switch interface info
define command{
command_name check_interface_table_v3t
command_line /usr/local/nagios/libexec/check_interface_table_v3t.pl -H $HOSTADDRESS$
}

here is a snippet of my switch.cfg file
# monitoring inteface stats using plugin - check_interface_v3t
define service{
use generic-service ; Inherit values from a template
host_name switch-1
service_description Interface status
check_command check_interface_table_v3t.pl -2 -C <string>-f

If i reload nagios i see the following error..
feb 13 16:52:17 nagios.server.net nagios[15074]: Error: Service check command 'check_interface_table_v3t.pl -2 -C <string> -f' specified in service 'Interface status' for host 'switch-1' not defined anywhere!

is there somewhere else that this needs to be defined...?

any help would be greatly appreciated..

thanks

Re: Nagios plugins - interfacetable_v3t issues

Posted: Wed Feb 14, 2018 5:03 pm
by tgriep
If looks like your command is missing the $ARG1$ $ARG2$ in the command line, change you command line from

Code: Select all

/usr/local/nagios/libexec/check_interface_table_v3t.pl -H $HOSTADDRESS$
to

Code: Select all

/usr/local/nagios/libexec/check_interface_table_v3t.pl -H $HOSTADDRESS$ -C $ARG1$ $ARG2$
Then in your service check, put the community string in $ARG1$ and in $ARG2$ put the following

Code: Select all

-2 -f
Save the changes and restart nagios to see if the changes work.

Re: Nagios plugins - interfacetable_v3t issues

Posted: Wed Feb 21, 2018 6:48 pm
by charpham
Thanks so much ... I will give this a try and let you know of my results

Re: Nagios plugins - interfacetable_v3t issues

Posted: Thu Feb 22, 2018 11:13 am
by tmcdonald
We'll keep this open for you

Re: Nagios plugins - interfacetable_v3t issues

Posted: Sun Mar 04, 2018 2:23 pm
by charpham
Hi

Looks like I am still having problems

Here is what I did
I modified the device.cfg file
here is a snippet

# monitoring interface stats using plugin - check_interface_v3t
define service{
use generic-service ; Inherit values from a template
host_name charpham-3548
service_description Interface status
check_command check_interface_table_v3t.pl -H <hostaddress> -C v14tual -2 -f
}

Here is the snippet for commands.cfg

#checking router and switch interface info
define command{
command_name check_interface_table_v3t
command_line /usr/local/nagios/libexec/check_interface_table_v3t.pl -H $HOSTADDRESS$ -C $ARG1$ $ARG2$
}


I reloaded Nagios and checking the logs it still seems to fail

Error: Service check command 'check_interface_table_v3t.pl -H <hostaddress> -C <device community string> -2 -f' specified in service 'Interface status' for host 'hostname' not defined anywhere!
Mar 04 10:57:31 terminusnet nagios[24507]: Checked 40 services.
Mar 04 10:57:31 terminusnet nagios[24507]: Checked 8 hosts.


I also ran "./check_interface_table_v3t.pl -H 1<hostaddress>-C <community string> -2 -f" from the cli and did get output

Re: Nagios plugins - interfacetable_v3t issues

Posted: Mon Mar 05, 2018 2:42 pm
by scottwilkerson
This plugin used a cache directory which I thin by default is /tmp/.ifCache

If you run the plugin a few times as root, it creates the files in needs WITHOUT access for nagios user.

Try this, run the following

Code: Select all

chown -R nagios.nagios /tmp/.ifCache
Then see if they work in the UI
http://www.tontonitch.com/tiki/tiki-ind ... ion+-+0.05

You can also change the directory with the --cachedir flag, but make sure the nagios user can read/write to the directory

Re: Nagios plugins - interfacetable_v3t issues

Posted: Sat Mar 17, 2018 3:03 pm
by charpham
Thanks for the response... I will give this a try when I have a chance

much appreciated for your help

Re: Nagios plugins - interfacetable_v3t issues

Posted: Mon Mar 19, 2018 10:26 am
by tmcdonald
We'll keep this thread open for you pending your reply.

Re: Nagios plugins - interfacetable_v3t issues

Posted: Mon Mar 19, 2018 2:59 pm
by charpham
Hi

I am just starting out regarding scripting.. Regard specifying the /tmp directory for .ifcache, do you know where this is specified. If it in the python script "check_interface_table_v3t.pl"? . What is the syntax for to change the "cachedir" Sorry for my ignorance here. LOL

In the "check_interface_table_v3t.pl" I did change the cachdir under

Code: Select all

# Default values: snmp options
    %ghSNMPOptions = (
        '.......
        'cachedir'                  => "/tmp/.ifCache",
I changed this to /usr/local/nagios/etc/ .ifcache as noted below... however I can't seem to change the ownership even though the directory/file ".ifCache" is there.. (as a hidden directory/file with permissions root.root)

Code: Select all

[root libexec]# chown -R nagios.nagios /tmp/.ifCache
chown: cannot access ‘/tmp/.ifCache’: No such file or directory
[root libexec]# 

[root@terminus libexec]# ./check_interface_table_v3t.pl -D
\1 better written as $1 at /usr/local/interfacetable_v3t/lib/SnmpUtils.pm line 743.
\2 better written as $2 at /usr/local/interfacetable_v3t/lib/SnmpUtils.pm line 743.
.........

Snmp options:

Code: Select all

{
  '64bits' => 0,
  'authproto' => 'md5',
  'cachedir' => '/usr/local/nagios/etc/.ifCache',
  'community' => 'public',
  'contextname' => '',
  'domain' => 'udp',
  'host' => 'localhost',
  'login' => '',
  'max-repetitions' => undef,
  'maxmsgsize' => undef,
  'passwd' => '',
  'port' => 161,
  'privpass' => '',
  'privproto' => 'des',
  'retries' => 2,
  'timeout' => 2,
  'unixsnmp' => 0,
  'version' => '1'

If run the following I get this..

Re: Nagios plugins - interfacetable_v3t issues

Posted: Wed Mar 21, 2018 4:57 pm
by kyang
I have never used this plugin before, but in regards to what scottwilkerson said,

your cachedir is located here--> /usr/local/nagios/etc/.ifCache

Run this to change ownership of the .ifCache.

Code: Select all

chown -R nagios.nagios /usr/local/nagios/etc/.ifCache
by scottwilkerson
You can also change the directory with the --cachedir flag, but make sure the nagios user can read/write to the directory
Looking at the --help options. If you use --cachedir <caching directory> --> that is how you can change the cachedir.