Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not all traps was imported from MIB to XML #20

Open
romale opened this issue Jun 9, 2018 · 5 comments
Open

Not all traps was imported from MIB to XML #20

romale opened this issue Jun 9, 2018 · 5 comments

Comments

@romale
Copy link

romale commented Jun 9, 2018

Hi Ryan,
I've receive snmp trap from my devices, and after research i tried to convert mib file to zabbix xml, but not all trap entry was imported to xml file.

Example trap messages (from snmptt.log):
13:39:05 2018/06/04 FCMGMT-MIB::connUnitPortStatusChange Normal "General event" 10.1.1.232 - ZBXTRAP 10.1.1.232 general failure offline
13:39:05 2018/06/04 FCMGMT-MIB::connUnitPortStatusChange Normal "General event" 10.1.1.233 - ZBXTRAP 10.1.1.233 general failure offline
13:42:10 2018/06/04 FCMGMT-MIB::connUnitPortStatusChange Normal "General event" 10.1.1.233 - ZBXTRAP 10.1.1.233 general failure offline
13:42:10 2018/06/04 FCMGMT-MIB::connUnitPortStatusChange Normal "General event" 10.1.1.232 - ZBXTRAP 10.1.1.232 general failure offline

Example trap messages (from snmptrapd.log):
2018-06-04 13:31:51 10.1.1.232(via UDP: [10.1.1.232]:57541->[172.1.1.1]:162) TRAP, SNMP v1, community public
experimental.94 Enterprise Specific Trap (6) Uptime: 359 days, 7:39:40.55
experimental.94.1.10.1.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.369098964 = INTEGER: 1 experimental.94.1.10.1.6.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.369098964 = INTEGER: 3
2018-06-04 13:31:51 10.1.1.233(via UDP: [10.1.1.233]:18726->[172.1.1.1]:162) TRAP, SNMP v1, community public
experimental.94 Enterprise Specific Trap (6) Uptime: 359 days, 5:42:48.85
experimental.94.1.10.1.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.369098964 = INTEGER: 1 experimental.94.1.10.1.6.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.369098964 = INTEGER: 3
2018-06-04 13:35:02 10.1.1.232(via UDP: [10.1.1.232]:57541->[172.1.1.1]:162) TRAP, SNMP v1, community public
experimental.94 Enterprise Specific Trap (6) Uptime: 359 days, 7:42:51.49
experimental.94.1.10.1.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.527958784 = INTEGER: 5 experimental.94.1.10.1.6.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.527958784 = INTEGER: 3
2018-06-04 13:35:02 10.1.1.233(via UDP: [10.1.1.233]:18726->[172.1.1.1]:162) TRAP, SNMP v1, community public
experimental.94 Enterprise Specific Trap (6) Uptime: 359 days, 5:45:58.93
experimental.94.1.10.1.7.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.528024320 = INTEGER: 5 experimental.94.1.10.1.6.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.528024320 = INTEGER: 3

Mib file:
http://www.oidview.com/mibs/0/FCMGMT-MIB.html

And after converting, no any mentions about connUnitPortStatusChange in XML file.

Could you help me?

Thanks

@romale romale changed the title Not of all traps was imported from MIB to XML Not all traps was imported from MIB to XML Jun 9, 2018
@cavaliercoder
Copy link
Collaborator

I can imagine one of two problems happening here:

  1. Zabbix doesn't support all types of traps, so the script might be skipping them deliberately
  2. The trap you desire does not exist in the portion of the MIB tree (root OID) you are exporting.

Try adding some logging to the script to see if your trap is being processed and what is happening to it. Also, try grepping the MIB files for connUnitPortStatusChange so you can see where it lives and what types it is composed of.

@romale
Copy link
Author

romale commented Jun 13, 2018

# grep -i connUnitPortStatusChange FCMGMT-MIB.mib
    connUnitPortStatusChange TRAP-TYPE 
# grep -i connUnitPortStatusChange FCMGMT-MIB.xml
# echo $?
1
#

From my first post, we can see in "snmptt" output, that FCMGMT-MIB file parsed correctly and translated to human readable format.

Unfortunately, i'm not perl developer, i was try debug your script, but it isn't easy for me. Bash or python i can (on user-level), but not perl.

@cavaliercoder
Copy link
Collaborator

Understood. I'll take a look to try understanding what is going wrong. For reference, can you please provide the exact commands you are using to generate the Zabbix templates?

@romale
Copy link
Author

romale commented Jun 14, 2018

I use this command

mib2zabbix.pl -o .1.3.6.1.3.94 -G CUSTOM-TEMPLATES -v 2 > FCMGMT-MIB.xml

And some examples, that show if MIB in the right location:

# snmptranslate .1.3.6.1.3.94
fcmgmt
# snmptranslate .1.3.6.1.3.94.5
connUnitServiceSet

@rafaelrs
Copy link

rafaelrs commented Jul 10, 2020

Disregard this. I found that it's all ok
I have same issue. I generated xml template, but found, that's not all OID included in my template.

That's how i was generating:

$ snmptranslate -Tz -m ./Shtyl-MIB_UPS2-06.mib  | ./mib2zabbix.pl -o ".1.3.6.1.4.1.34498.2.6" -f "./Template Shtyl UPS auto.xml" -e -G UPS -N "Template Shtyl UPS" -v 3 -L authNoPriv -n main -a SHA --disc-delay=3600 --history=90 --trends=365
Smartmatch is experimental at ./mib2zabbix.pl line 475.

Now, after realizing that not all OID included i made oneline script to find which of them:

~~$ for oid in $(snmptranslate -Tz -m ./Shtyl-MIB_UPS2-06.mib | grep -oE "1.3.6.1.4.1.34498.2.6[0-9,\.]+"); do echo -n $(snmptranslate -Onf $oid)"("$oid"): "; if grep -q "$oid" "Template Shtyl UPS auto.xml"; then echo "present"; else echo "absent"; fi; done~~

....
My MIB file is:
Shtyl-MIB_UPS2-06.mib.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants