Jump to content

Recommended Posts

Posted

I'm a novice with linux having only played around with it on my home computer, however for my apprenticeship they have asked me to setup Nagios on a Linux server - I've gotten the LAMP server up and running (Ubuntu 12.10) and have got cacti up and running however Nagios is causing my head to hurt.

 

Nagios is up and running and can be accessed remotely using the localhosts IP address. First off we had authentifcation issues after logging into the account - i'm not sure if the issue i'm having now is a remnant of the prior issue i just mentioned. (Apologises for rambling)

 

I have added a switch which pings fine with Nagios (I think it does at least), however I tried to monitor ports via SNMP and have come up with this error

 

"External command error: MIB search path: $HOME/.snmp/mibs:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp"

 

[ATTACH=CONFIG]17655[/ATTACH]

 

I've installed the plugins and checked that they are where they should be and they seem to be though perhaps i've installed them incorrectly - I've reinstalled them since i installed it the first time following instructions.

 

This is probably a simple fix staring me in the face!

 

Let me know if there is anything that i need to provide (and how to provide it if possible)

 

Any help would be much apprecitated.

(Apologises if you have seen this question before)

Posted
As I recall with the nagios package on ubuntu the binary for querying SNMP isn't where it is expected to be. You need to find it and then either add it to the path OR alter the commands config file to point explicitly to it OR copy the binary into the Nagios bin directory.
Posted (edited)

You are looking for a binary file check_snmp. So

 

sudo find / -name check_snmp

 

Should tell you where the file is (if you have it).

 

I think it should really be in /usr/lib/nagios/plugins/

 

(should I add these need to be run from a shell??)

Edited by pcstru
Posted
The file check_snmp is located in /usr/lib/nagios/plugins.. It was there by default I didn't have to move it. Though it is also located in /usr/local/nagios/libexec/ as well - is this a problem?
Posted

It shouldn't be. Check your commands.cfg in /usr/local/nagios/etc . Does it have a line :

# 'check_snmp' command definition
define command{
       command_name    check_snmp
       command_line    $USER1$/check_snmp -H $HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$ $ARG4$
       }

 

(You should also see a check_ping command in there?).

Posted

ImageUploadedByEduGeek1364293841.232729.jpgImageUploadedByEduGeek1364293886.401809.jpg

 

Sorry for the late reply was at a meeting - both lines are present however the snmp one is different to the one you posted

Posted

Ok. So what did you do to monitor ports on a switch? Presumably you have something in service.cfg?

 

define service{

use generic-service

hostgroup_name switches

service_description Uptime

check_command check_snmp!-C [*******] -o .1.3.6.1.2.1.1.3.0

 

}

 

 

You can also go into (say) /usr/local/nagios/libexec and run check_snmp manually :

 

cd /usr/local/nagios/libexec

./check_snmp

Posted

Sanity check = /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

 

is quite helpful.

 

ps - you can copy and paste configs - it isn't windows.

Posted
I think you will need more arguments on the check_snmp command in commands.cfg. It should do no harm to add more $ARG params, they will just be ignored if no value is given.
Posted (edited)

ImageUploadedByEduGeek1364295046.889025.jpg

 

Here's the switch config - I used the template present so i'm guessing now that i've not changed something that i should have

 

what are the ARG params? - going to add them in now

Edited by Jwebb
Posted
Sanity check = /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

 

is quite helpful.

 

ps - you can copy and paste configs - it isn't windows.

 

Ive just used this command and it has returned 0 warnings 0 errors

Posted

Restarted nagios and checked to see if changes made would fix the issue, no such luck ): I'll be back in 30m-60ms

 

Thanks for the help so far

Posted
[ATTACH]17664[/ATTACH]

 

Here's the switch config - I used the template present so i'm guessing now that i've not changed something that i should have

 

what are the ARG params? - going to add them in now

 

ARG1$ etc are just general parameters. You only have one in the configuration for the command, but your service is trying to pass many (that may work if nagios passes everything as a single argument, but it didn't work for me!). Check that check_snmp and your switch behaves as you expect by running from the command line :

 

i.e. (typical check on uptime (****** is the access password, replace as appropriate)

 

cd /usr/local/nagios/libexec

./check_snmp -H 192.168.100.11 -C ****** -o .1.3.6.1.2.1.1.3.0

Posted (edited)

Capture.JPGThat tutorial will help me set up the email notification by the looks of it - i haven't done that yet, but I've got nagios up and running and pinging a switch which is all good but having issues with monitoring the switch using snmp :/

 

 

"cd /usr/local/nagios/libexec

./check_snmp -H 192.168.100.11 -C ****** -o .1.3.6.1.2.1.1.3.0"

 

the password is correct - but I dont have that list of number after it.. should i have that in there?

Edited by Jwebb
Posted

The number is the location of the uptime ticks trap. It may be wrong for your switches in which case you need a valid trap. You can try the -o ifOperStatus.1 style command. The aim is to any valid return from a switch using check_snmp on the command line. Once you know that is working, then we can use that in nagios.

 

MIBBroswer (or some other means of snmp interrogation can be useful).

Posted

How can I aquire the uptime ticks trap for our switches? - will it be different for all traps?

 

Sorry just to clarify what is the valid return that i require to move on? (the ticks trap number?)

 

Thanks again for your help

Posted

When I run that at the command line I get something like :

 

SNMP OK - Timeticks: (896946403) 103 days, 19:31:04.03 |

 

As opposed to something beginning :

 

External command error:

 

There is a utility you can use in ubuntu to list the snmp traps on a target device. I just can't remember it's name :-(!

Posted

Sorry for no reply it was my day release to college yesterday, I may get a chance to do some today but they have me doing cable management and desktop deployment xD then it's my holiday thanks for the pointers ill post again on here if problems persist which I'm sure they will.

 

Thanks to everyone for their help and time (:

Posted
Managed to get back to doing some of this today - I've got a little further, seems i was missing some things - sudo apt-get install snmp-mibs-downloader<- by getting these and restarting Nagios i have gotten further. I'll post a image up in a moment
Posted

Step further.JPG

 

As you can see this has fixed the Uptime issues - which were red before and the error code for the ports has changed to "External command error: Error in packet"

 

Any thoughts?

Posted

Using

cd /usr/local/nagios/libexec

./check_snmp -H 10.1.3.40 -C ****** -o ifOperStatus.1

 

[ATTACH=CONFIG]17688[/ATTACH]

 

These are the results

Posted (edited)

I get not found on that attachment.

 

MRTG is a separate package that gathers traffic and other stats that accumulate over time. Looks like the check_mtrggraf is trying to access those statistics so you will need to install and configure mrtg if you want to use that.

 

The fact that uptime is working shows nagios is talking to your switches. I guess the mibs package translates the 0.1.2.1 type notation to the more human friendly iOperUpTime notations. You could configure the call to return info from the correct trap with check_snmp but you will only get accumulated figure which without any context is pretty useless.

Edited by pcstru

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...