After threshold breached send SNMP traps

Support questions about the Threshold plugin

Moderators: Developers, Moderators

Post Reply
frostyritz
Posts: 23
Joined: Wed Apr 03, 2013 8:17 pm

After threshold breached send SNMP traps

Post by frostyritz »

Is there a plugin that will do that as in if a thold is breached it sends an email But can we setup trap information from it as well.


i saw this but its dated back like 5 years ago.
http://blog.cactiusers.org/2009/02/25/t ... -of-thold/


thanks ;)
User avatar
browniebraun
Developer
Posts: 791
Joined: Tue Jun 13, 2006 1:17 am
Location: Cologne, Germany

Re: After threshold breached send SNMP traps

Post by browniebraun »

Works with the latest SVN release of THOLD in combination with the Cacti SNMPAgent plugin for net-snmp.
I still need to commit some changes before Jimmy can release a new version of THOLD, which will also include a THOLD daemon.
(This will allow to run the threshold monitoring on a dedicated server without any influence to the poller itself - I'm monitoring more than 125k of thresholds with CDEFs using that way.)

Regards
-Andi
Hat das Blümchen einen Knick, war der Schmetterling zu dick! ;)
reportit v0.7.5a
SNMPAgent v0.2.3
Download ReportIt | Download SNMPAgent | ReportIt SVN | ReportIt Templates | Wish list
Adi82
Posts: 3
Joined: Wed Nov 12, 2014 12:51 am

Re: After threshold breached send SNMP traps

Post by Adi82 »

Hi guys

I needed to send antoher information besides email when a threshold is breached .

I searched for a way to run an external script but it seems now its not possible.
Also tried to edit thold_functions.php file but im not a programmer :)

I added Cacti SNMPAgent plugin to the cacti server but the default MIB files dont have CACTI-THOLD-MIB in it.

I am attaching the picture which references CACTI-THOLD-MIB.

Can you please tell me where from to download the CACTI-THOLD-MIB?

Thanks in advance.
Attachments
snmp_notifcations_CACTI.jpg
snmp_notifcations_CACTI.jpg (184.71 KiB) Viewed 13349 times
sudoritz
Posts: 8
Joined: Thu Oct 16, 2014 12:23 pm

Re: After threshold breached send SNMP traps

Post by sudoritz »

0hhhh is there a way i can send the SNMPTrap then after it sends the Thold alert ?

thanks
sudoritz
Posts: 8
Joined: Thu Oct 16, 2014 12:23 pm

Re: After threshold breached send SNMP traps

Post by sudoritz »

I might of found a workaround hack fix but i gotta get it better

But i have the Thold syslog to a facility 4 and then i take that data and parse it to another syslog file on the server which then i inspect all incomging logs and read per line and script based on template name and do lookups and then IF confirmed issue i script a snmptrap command.


I need to look for somethign better then a constant tail -f and do something like a Fail2Ban setup but not for just IPs but more for If certain keywords show up from a template i can trigger other scripts and / or snmptrap etc etc
hp3000
Posts: 7
Joined: Sun Aug 30, 2015 6:46 am

Re: After threshold breached send SNMP traps

Post by hp3000 »

You can use snmpagent plugin available in sourceforge along with Thold 0.6.0 (updated by snmpagent developer) available in beta in Cacti SVN.

It works great apart from two issues if using snmp v3:

1. When setting up snmp v3 with SHA, the plugin tries to confirm the authoritative password. Even when the password in both fields match, it throws an error saying they don't match! I have worked around this by commenting out the check function in manager.php of snmpagent plugin. I have raised it with the developer and hopefully it will officially be fixed:

Original Code:

Code: Select all

if ($save["snmp_version"] == 3 && ($save["snmp_auth_password"] != $save["snmp_auth_password_confirm"])) {
                           raise_message(4);
                     }
Uncommented Code:

Code: Select all

/*if ($save["snmp_version"] == 3 && ($save["snmp_auth_password"] != $save["snmp_auth_password_confirm"])) {
                           raise_message(4);
                     }*/
2. It seems Engine ID for SNMP v3 traps has not been taken into acount. So when the plugin generates traps every trap has a different engine ID which can not be managed by many snmp receivers as they require one unique engin ID per device. Again I have worked around this by hard coding a engine-id in setup.php of snmpagent plugin:

Original Code:

Code: Select all

$args = " -v 3 " . (($notification_manager["snmp_message_type"] == 2 )? " -Ci " : "" ) .  " -u " . $notification_manager["snmp_username"];
Changed Code:

Code: Select all

$args = " -v 3  -e 12345678" . (($notification_manager["snmp_message_type"] == 2 )? " -Ci " : "" ) .  " -u " . $notification_manager["snmp_username"];
Note that in the above code the "e" argument of snmptrap tool is used. The engine ID has to be in HEX. I have just used an example!

Also note that cacti-snmpagent needs snmptrap binary and you can point to it in the settings in Cacti
An official fix to both these issues would be good. I have raised both with the snmpagent developer.
User avatar
browniebraun
Developer
Posts: 791
Joined: Tue Jun 13, 2006 1:17 am
Location: Cologne, Germany

Re: After threshold breached send SNMP traps

Post by browniebraun »

A new version of the SNMPAgent plugin addresses both bugs.
Password validation is working now and administrators are allowed to configure the SNMP Engine ID per notification receiver individually.
Additionally a new, much much faster and more scaling persistent daemon for Net-SNMP has become available with this new release.

Best regards
-Andi
Hat das Blümchen einen Knick, war der Schmetterling zu dick! ;)
reportit v0.7.5a
SNMPAgent v0.2.3
Download ReportIt | Download SNMPAgent | ReportIt SVN | ReportIt Templates | Wish list
Rikii16
Posts: 16
Joined: Fri Jan 03, 2020 3:25 pm

Re: After threshold breached send SNMP traps

Post by Rikii16 »

Hello Browniebraun,

How can we config the plugin snmpagent on cacti version 1.2.23/1.2.24, we want to send snmptraps from thold to another server.

Best,
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Re: After threshold breached send SNMP traps

Post by TheWitness »

Andi/Browniebraun may not reach out to you. Let's hope he does.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests