Page 1 of 3

How to monitor remote hosts by sending Traps to Nagios

Posted: Wed Dec 09, 2015 12:04 pm
by newbe
Hello Everyone,

since a couple of weeks ive been reading alot of Documentations and HOW-TOs about SNMP, NET-SNMP, SNMPTT & Passive Checks - im still an absolute beginner :roll:

I want to monitor an unix remote machine with Nagios Core. The remote machine needs to send a passive trap to my Nagios(Server), if a certain cpu, harddisc and main memory limit is reached.
As far as for the Security i like to use SNMPv3 and a SSH Tunnel on Nagios Side to enter on the remote machine just in case. The remote machine will be behind a Firewall/NAT.
To force a trap i know i need to use MIBs on both sides. On the remote machine i need to implement a script and a cronjob for what i know.

Which plugins do i need for sending Traps ( in my case the remote machine is behind a firewall/nat ) or which combination of plugins to manage my plan ?
Ive been readin alot of NSCA and NRDP, NSClient. Would those one work for me and if i use them how much do i need to implement to force a trap with MIBs ?



I would appreciate it alot if someone can give an advice on how to overcome my plan as easy as possible.

Thanks in advanced.

newbe

Re: How to monitor remote hosts by sending Traps to Nagios

Posted: Wed Dec 09, 2015 5:30 pm
by rkennedy
You should be able to use check_snmp to accomplish the check you're trying to achieve.
The remote machine needs to send a passive trap to my Nagios(Server), if a certain cpu, harddisc and main memory limit is reached.
Can you clarify on this? Wouldn't you like Nagios to monitor your CPU / HD / Memory all at once and alert you if a certain threshold is hit?

Is the machine a virtual, or physical that you're trying to monitor? Does it have SNMP setup on it?

Re: How to monitor remote hosts by sending Traps to Nagios

Posted: Thu Dec 10, 2015 6:52 am
by newbe
thank you for your message rkennedy,

I know Nagios is able to monitor via active polling the remote machine for parameters like cpu, hd and memory but
due to performance reasons i like to have the remote machine as active device and force a trap if like i said a certain cpu limit is reached.


Sorry i didnt write down my system yet :
The remote machine i like to monitor is a physical device.
Ubuntu 14.04 LTS is running on the remote machine with NET-SNMP Version 5.6.2.1

On the Nagios Machine :
Ubuntu 14.04 LTS
Nagios Core Version 4.1.1,
NET-SNMP Version 5.7.2,
snmptt 1.4-1

So far i have done this:
On the remote machine snmpd is running and i can send a trap-test (right now only with snmpv2) from the command line to Nagios Machine.
On the Nagios machine i receive the trap on Port 162 where snmptrapd is listening. snmptrapd pass the trap to snmptt.
With snmpttconvertmib ive convert a test mib on Nagios side, on the remote machine where iam sending the trap test has the same test mib too of course
On Nagios side im calling the submit_check_result plugin which gave me a Warning Status in Nagios when ever i send a trap from the remote machine.

Ive been reading alot that passive traps from a remote machine isnt easy at all, but i guess there must be a way while combining with Nagios Plugins ( NSCA, NRDP, NSClient ?? ) to overcome this problem.

Any advices or ideas ?

Thanks in advanced

Re: How to monitor remote hosts by sending Traps to Nagios

Posted: Thu Dec 10, 2015 3:43 pm
by rkennedy
NSCA, NRDP, and NSClient++ generally report the metrics to Nagios, and let Nagios decide if a warning is needed.

Since you would like the client to do the calculations, you'll need to find a working script that can do this. Something in bash should work, running along side cron to check on 1 or 5 minute intervals. From there, if the script hits your threshold (however you decide to write it), then send the SNMP to Nagios, and it will generate the alert.

Does that help provide some clarification?

Re: How to monitor remote hosts by sending Traps to Nagios

Posted: Mon Dec 21, 2015 3:12 am
by newbe
rkennedy wrote: Since you would like the client to do the calculations, you'll need to find a working script that can do this. Something in bash should work, running along side cron to check on 1 or 5 minute intervals. From there, if the script hits your threshold (however you decide to write it), then send the SNMP to Nagios, and it will generate the alert.

Does that help provide some clarification?
In the theory yes it does, but im still wondering if its not possible to perform self-management using snmpd.conf
and DisMan Monitoring ? I just followed the tutorial on DisMan Monitoring : http://www.net-snmp.org/wiki/index.php/ ... Monitoring
with the same simple expression "monitor machineTooBusy hrProcessorLoad > 90" - unfortunately without success!

Does it either make any sense to generate Traps with DisMan while using HOST-RESOURCE-MIB ?

Do you know a working script i can use to fit on my requirements ?


thank you for your time

Re: How to monitor remote hosts by sending Traps to Nagios

Posted: Mon Dec 21, 2015 4:39 pm
by Box293
Rob Hassing did a presentation at the Nagios Conference: "SNMP Explained"
https://www.youtube.com/watch?v=2JrvMR3N8v8

It's a very good talk for beginners. Specifically one thing I learned is that you can configure SNMP to execute scripts, which may be helpful.

Re: How to monitor remote hosts by sending Traps to Nagios

Posted: Tue Dec 22, 2015 9:30 am
by newbe
Box293 wrote:Rob Hassing did a presentation at the Nagios Conference: "SNMP Explained"
https://www.youtube.com/watch?v=2JrvMR3N8v8

It's a very good talk for beginners. Specifically one thing I learned is that you can configure SNMP to execute scripts, which may be helpful.

@Box293 thanks alot for this one.

i get confused at that point where Rob Hassing is showing his way of sending traps by snmptrapd which is listingen on Port 162 right ?
is this just another way of solution for polling traps from a device to Nagios with nsca ? my goal of polling a trap from a device which is equal to the client/server principle, ive been trying to work it out with the snmpd.conf not the snmptrapd.conf . ive got running snmpd on a box with ubunutu 14.04 lts and Nagios on ubunut box 14.04 lts with snmptrapd & snmptt ( im not using any virtual machine ) . do iam on the woodway with my understanding ?

thank you for your time

Re: How to monitor remote hosts by sending Traps to Nagios

Posted: Tue Dec 22, 2015 11:11 am
by Box293
newbe wrote:i get confused at that point where Rob Hassing is showing his way of sending traps by snmptrapd which is listingen on Port 162 right ?
is this just another way of solution for polling traps from a device to Nagios with nsca ?
Yes, same principle where NSCA are passive checks.

You configure your Nagios server to listen for incoming SNMP Traps (snmptrapd) and it then spools them to a folder and then the snmptt daemon will perform an EXEC statement which will execute a script which in turn just submits the check result to the nagios command pipe.

However you would need to get something to send the snmptrap from your source server. Like a script that was run via a cron job and based on certain parameters it would execute the snmptrap command and send the trap.

Re: How to monitor remote hosts by sending Traps to Nagios

Posted: Fri Jan 08, 2016 5:39 am
by newbe
However you would need to get something to send the snmptrap from your source server. Like a script that was run via a cron job and based on certain parameters it would execute the snmptrap command and send the trap.[/quote]


@Box293

instead of a script which execute the snmptrap and the send a SNMPv3 Trap, DisMan Monitoring (internal monitoring) should be able to
report problems via SNMP notifications. Im trying to work it out in snmpd.conf file, unfortunately without success.
The first source i worked with was and is still http://www.net-snmp.org/wiki/index.php/ ... Monitoring

Any ideas where to look on this topic to get more into details ?

It would be nice to work with something the Snmp Agent offers already. If DisMan would be to complicated i still can use a script.

thank u for your time.

Re: How to monitor remote hosts by sending Traps to Nagios

Posted: Fri Jan 08, 2016 2:27 pm
by rkennedy
Can you post your related configuration files for us to take a look at?