thold v1.0.3 not sending snmp traps

Support questions about the Threshold plugin

Moderators: Moderators, Developers

Post Reply
Author
Message
ciela2
Posts: 15
Joined: Fri Jan 06, 2012 1:52 pm

thold v1.0.3 not sending snmp traps

#1 Post by ciela2 » Fri Feb 23, 2018 5:25 pm

Hello,
We're on Cacti version 1.1.33 and trying to get thold to send out SNMP traps when thresholds are breached.
Out thresholds are being triggered and sending emails but the traps don't reach our SNMP Notification Receiver.

From the Cacti server can send out other traps (not Cacti) successfully.
Our thold version came from the master branch in git, version 1.0.3.

Can anyone advise how to troubleshoot this problem or suggest what might be missing from our configuration?

Cacti 1.x is great - especially automation of graphs and trees.
Any suggestions or insight would be appreciated.
Thanks.

User avatar
Osiris
Cacti Pro User
Posts: 835
Joined: Mon Jan 05, 2015 10:10 am

Re: thold v1.0.3 not sending snmp traps

#2 Post by Osiris » Tue Mar 13, 2018 8:48 pm

Likely a pm to browniebraun on this one. Have you setup the snmp agent receivers? Have you tested them? Is your snmptrap path correct?
Before history, there was a paradise, now dust.

netniV
Cacti Guru User
Posts: 2670
Joined: Sun Aug 27, 2017 12:05 am

Re: thold v1.0.3 not sending snmp traps

#3 Post by netniV » Wed Mar 14, 2018 7:17 am

thold expects you have thold_alert_snmp turned on, thold_alert_snmp_warning set to false (blank) and thold_alert_snmp_normal set to false (blank). The descriptive names for these are:

SNMP Notifications
Disable Warning Notifications
Disable Restoration Notifications

If these are set correctly, I'll dig deeper into what may be preventing them which may be something to do with snmpagent_notification() in lib/snmpagent.php. Things like whether you have the notification in the ignore list, whether there are any managers defined to receive that specific MIB event.

Double check the snmpagent_notifications_log table to see if there have been any entries.

ciela2
Posts: 15
Joined: Fri Jan 06, 2012 1:52 pm

Re: thold v1.0.3 not sending snmp traps

#4 Post by ciela2 » Thu Mar 22, 2018 4:08 pm

Thanks for getting back to me about this!

Under Configuration > Settings > SNMP Notification Presets I have a check in "SNMP Notifications"
"Disable Warning Notifications" is blank/unchecked.
"Disable Restoration Notifications" is blank/unchecked.

Utilities > SNMP Notification Receivers > I have my PC (which has a MIB browser/Trap Receiver application) set up. I can see traps in the Trap receiver on my PC, originating from this Cacti server if I send traps from a script.

I set up a threshold on Local Linux Machine - Logged in Users [users] [users], it's triggered if more than one user logs into the Cacti server.
I've got an Alert Email - extra email set up in the Threshold.

But when the threshold is triggered, I only get an email - no SNMP trap.
Utilities > SNMPAgent Notification Log is empty - no entries.
The Cacti server OS is Centos 7.

There are entries from THOLD in the cacti log : Alerting is necessary, Preparing to send email, etc.

Please let me know what else I can check.
Thanks again

stuong
Posts: 3
Joined: Mon May 07, 2018 6:22 pm

Re: thold v1.0.3 not sending snmp traps

#5 Post by stuong » Mon May 07, 2018 6:49 pm

Hi all,
I have exactly the same problem described by clela2. Thold triggered, emails sent, thold logs posted to cacti.log. But no log in my SNMP Notification Receiver's log tab. I have enabled all 7 notifications/MIBS.
I am on Cacti 1.1.38 and thold 1.0.5 running on centos 6.9. Any suggestions?

ciela2
Posts: 15
Joined: Fri Jan 06, 2012 1:52 pm

Re: thold v1.0.3 not sending snmp traps

#6 Post by ciela2 » Thu May 10, 2018 8:02 am

I upgraded to see if that would help, so I'm also on Cacti 1.1.38, thold 1.0.5.

There is no sign that Cacti even attempts to send an SNMP trap, even if logging it set to DEBUG.
Anyway thought it might be worth mentioning that when selecting 'View SNMPAgent Notification Log', the drop down box for "Receiver" doesn't show any of the SNMP Notification Receivers - two are set up in my configuration.

So perhaps that's the issue.

If anyone can provide some troubleshooting advice or a workaround, that'd be great.
Thanks,
Imogen

stuong
Posts: 3
Joined: Mon May 07, 2018 6:22 pm

Re: thold v1.0.3 not sending snmp traps

#7 Post by stuong » Wed Aug 01, 2018 2:54 pm

found it and fixed it. Cacti is now sending and logging traps...
there are 2 places that I have to modify in lib/snmpagent.php:

Code: Select all

function snmpagent_notification($notification, $mib, $varbinds, $severity = SNMPAGENT_EVENT_SEVERITY_MEDIUM, $overwrite = false){
        global $config;
 
        if (isset($config['snmpagent']['notifications']['ignore'][$notification])) {
                return false;
        }
 
        $path_snmptrap = read_config_option('path_snmptrap'); /* old name was snmpagent_path_snmptrap */
 
….
 
        if (sizeof($notification_managers) == 0) { /* we want to test if no notification_managers is found */
                /* To bad! Nobody wants to hear our message. :( */
                if (in_array($severity, array(SNMPAGENT_EVENT_SEVERITY_HIGH, SNMPAGENT_EVENT_SEVERITY_CRITICAL))) {
 

Can Cacti support team inform the developers to look at lib/snmpagent.php? :wink:



PS: is there a way to extend the page/session timeout? I had to copy and paste the message in order to submit successfully

ciela2
Posts: 15
Joined: Fri Jan 06, 2012 1:52 pm

Re: thold v1.0.3 not sending snmp traps

#8 Post by ciela2 » Wed Aug 01, 2018 4:01 pm

Thank you stuong!
Good work, this fixed my problem also.

I believe you should post this on git as an issue: https://github.com/Cacti/cacti/issues

ciela2

netniV
Cacti Guru User
Posts: 2670
Joined: Sun Aug 27, 2017 12:05 am

Re: thold v1.0.3 not sending snmp traps

#9 Post by netniV » Thu Aug 02, 2018 6:55 am

Yes, if you could post an issue so that we can track this on the repo (see link above). If you can also post a diff of the changes you made, we can try to match the lines to make sure it's applied correctly.

stuong
Posts: 3
Joined: Mon May 07, 2018 6:22 pm

Re: thold v1.0.3 not sending snmp traps

#10 Post by stuong » Fri Aug 31, 2018 6:26 pm

reported the bug and it has been included for future release
https://github.com/Cacti/cacti/issues/1849

I think you can close this thread as resolved :D

eholz1
Cacti User
Posts: 129
Joined: Mon Oct 01, 2018 10:09 am

Re: thold v1.0.3 not sending snmp traps

#11 Post by eholz1 » Thu Apr 04, 2019 4:38 pm

Hello Experts,

The php fix in this post also "fixed" my issue with having a "receiver",
but no logs.

I now get traps in the log file. Where is this file located?
Also, I do have an issue, I have devices that are disabled, and devices that are down permanently.
BUT I get snmp traps for these devices! Is there any way I can stop snmptrap messages for disabled devices?
If a device is permanently down, I can switch it to disabled.

Any ideas?

Thanks for an excellent fix on this.

eholz1

netniV
Cacti Guru User
Posts: 2670
Joined: Sun Aug 27, 2017 12:05 am

Re: thold v1.0.3 not sending snmp traps

#12 Post by netniV » Thu Apr 04, 2019 8:29 pm

For that I would post a github issue with the exact details of what you have configured, what you see happen and what you expect to happen instead.

Post Reply