installing a nagios plugin

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.
l_freez
Posts: 13
Joined: Sat Oct 25, 2014 3:06 pm

installing a nagios plugin

Post by l_freez »

Hi !

I'm new to nagios core please Anyone have a basic explanation of how is install this plugin ? can anyone guide me step by step. very appreciate it

http://exchange.nagios.org/directory/Pl ... st/details

Thanks.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: installing a nagios plugin

Post by Box293 »

You'll need to:
  • Put the plugin in the /usr/local/nagios/libexec/ directory
    create a command
    create a service that users the command
Have a read of this:

http://nagios.sourceforge.net/docs/3_0/ ... bject.html

Followed by this:

http://nagios.sourceforge.net/docs/3_0/ ... ml#command
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
l_freez
Posts: 13
Joined: Sat Oct 25, 2014 3:06 pm

Re: installing a nagios plugin

Post by l_freez »

Box293 wrote:You'll need to:
  • Put the plugin in the /usr/local/nagios/libexec/ directory
    create a command
    create a service that users the command
Have a read of this:

http://nagios.sourceforge.net/docs/3_0/ ... bject.html

Followed by this:

http://nagios.sourceforge.net/docs/3_0/ ... ml#command
thanks for your quick reply. I'll check it again... :)
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: installing a nagios plugin

Post by slansing »

Great, let us know if you need assistance, thanks!
l_freez
Posts: 13
Joined: Sat Oct 25, 2014 3:06 pm

Re: installing a nagios plugin

Post by l_freez »

hi !

can someone help me to finish this

1. firstly I created script file, using copy and paste script in below URL to notepad and create it as check-cisco.pl

https://github.com/ranl/monitor-utils/b ... k-cisco.pl

2. then I moved check-cisco.pl file to /usr/local/nagios/libexec/ directory

3. created command in command.cfg file

# 'check-cisco' command definition
define command{
command_name check-cisco
command_line /usr/local/nagios/libexec/check-cisco.pl -H $HOSTADDRESS$
}

4. finally created service in switch.cfg file

define service{
use generic-service ; Inherit values from a template
hostgroup_name switches
service_description cisco switch
check_command check-cisco!/usr/local/nagios/libexec/check-cisco.pl
}

but its not working.. can someone show me what is wrong and correct !!

Thanks
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: installing a nagios plugin

Post by Box293 »

You are getting there.

The first thing to test is to make sure the script is correctly running at the command line.

Code: Select all

su nagios
/usr/local/nagios/libexec/check-cisco.pl -H the_cisco_device_ip_address
What output does this produce?
I suspect you are going to need to add some more options to the command such as -C public -t temp
Once you have the command working and returning correct output, then you will know how to define the command and service.

Your command definition will need to allow arguments:

Code: Select all

command_line /usr/local/nagios/libexec/check-cisco.pl -H $HOSTADDRESS$ $ARG1$
The $ARG1$ allows you to pass through arguments to your service like "-C public -t temp"

To pass arguments to the command, change your service definition to:

Code: Select all

check_command check-cisco!-C public -t temp
Anything after ! is $ARG1$.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
l_freez
Posts: 13
Joined: Sat Oct 25, 2014 3:06 pm

Re: installing a nagios plugin

Post by l_freez »

when I running the script at the command line its showing this,

[root@localhost ~]# /usr/local/nagios/libexec/check-cisco.pl -H 10.238.80.11

Can't locate Net/SNMP.pm in @INC (@INC contains: /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5 .) at /usr/local/nagios/libexec/check-cisco.pl line 13.
BEGIN failed--compilation aborted at /usr/local/nagios/libexec/check-cisco.pl line 13.

in the scrip, line no 13 is below

1 #!/usr/bin/env perl
2 #####################################
3 #####################################
4 ### ______ _ =) ###
5 ### | ___ \ | | ###
6 ### | |_/ / __ _ _ __ | | ###
7 ### | / / _` || '_ \ | | ###
8 ### | |\ \| (_| || | | || |____ ###
9 ### \_| \_|\__,_||_| |_|\_____/ ###
10 #####################################
11 #####################################
12 use strict;
13 use Net::SNMP;
14 my $stat;
15 my $msg;
16 my $perf;
17 my $days = 14;
18 my $script_name = "check-cisco.pl";
19 ### SNMP OIDs
20 ###############
21 # Temperature
22 my $S_temp = ".1.3.6.1.4.1.9.9.13.1.3.1.3";
23 # Memory
24 my $S_mem_used = ".1.3.6.1.4.1.9.9.48.1.1.1.5.1"; # Byte
25 my $S_mem_free = ".1.3.6.1.4.1.9.9.48.1.1.1.6.1"; # Byte
User avatar
eloyd
Cool Title Here
Posts: 2129
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: installing a nagios plugin

Post by eloyd »

Your problem is a Perl problem, not specific to Nagios at this point. You need to get the Net::SNMP Perl modules installed on your machine. Most likely, you can do it via CPAN as root:

Code: Select all

perl -MCPAN -e shell
install Net::SNMP
If that fails for some reason, you can head to http://search.cpan.org/~dtown/Net-SNMP-v6.0.1/ and download, compile, and install from source.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoydI'm a Nagios Fanatic!
l_freez
Posts: 13
Joined: Sat Oct 25, 2014 3:06 pm

Re: installing a nagios plugin

Post by l_freez »

can you tell me how to install it. I tried to install it using this command but it not work

[root@localhost ~]# perl -MCPAN -e 'install Net::SNMP'
Can't locate CPAN.pm in @INC (@INC contains: /usr/local/lib/perl5 /usr/local/share/perl5 /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5 /usr/share/perl5 .).
BEGIN failed--compilation aborted.

and also tried this its showing

[root@localhost tmp]# yum install Net::SNMP
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: centos.excellmedia.net
* epel: ftp.riken.jp
* extras: centos.excellmedia.net
* updates: centoss5.centos.org
Setting up Install Process
No package Net::SNMP available.
Error: Nothing to do
l_freez
Posts: 13
Joined: Sat Oct 25, 2014 3:06 pm

Re: installing a nagios plugin

Post by l_freez »

after so many tried I installed it. below commands are which I tried

#perl -MCPAN -e shell
#install Net::SNMP
#yum install Net::SNMP
#perl -MCPAN -e 'install Net::SNMP'
#perl -MCPAN -e 'install Net::SNMP'
#yum install Net::SNMP
#yum install cpan App::cpanminus

#perl -MCPAN -e 'install Net::SNMP'

#perl -MCPAN -e shell
#install Net::SNMP

I assumed above things are installed well and now its showing this

[root@localhost ~]# /usr/local/nagios/libexec/check-cisco.pl -H 10.238.80.11
Syntax Error !
check-cisco.pl
-H = Ip/Dns Name of the Switch
-C = SNMP Community
-t = Check type
temp - Temperature
fan - Fan Fail
ps - Power Supply Fail
cpu - CPU Load
mem - Memory
module - Module Health
freeint - Free eth interfaces for X days (-d)
int - Interface Operation Stat (use with -i or -o)
-w = Warning Value
-c = Critical Value
-d = number of days that th ethernet interface hasn't change state, default is 1
4 (only for -t freeint)
-i = Interface Name (only for -t int)
-o = Interface OID (only for -t int)


can someone help me to find out problem !!!
Locked