zabbix-tools / mib2zabbix Goto Github PK
View Code? Open in Web Editor NEWSNMP Template generator for Zabbix
SNMP Template generator for Zabbix
I tried to convert mib file for megaraid controller and importing it to zabbix fails with the below error:
mib file: LSI-MegaRAID-SAS-MIB.mib.txt
Error in query [INSERT INTO items (name,authtype,data_type,delay,delay_flex,delta,description,formula,history,inventory_link,ipmi_sensor,logtimefmt,multiplier,params,password,port,privatekey,publickey,snmp_community,snmp_oid,snmpv3_authpassphrase,snmpv3_authprotocol,snmpv3_contextname,snmpv3_privpassphrase,snmpv3_privprotocol,snmpv3_securitylevel,snmpv3_securityname,status,trends,type,units,username,value_type,key_,trapper_hosts,hostid,interfaceid,flags,itemid) VALUES ('enclosureID for {#SNMPINDEX}','0','0','60','','0','EnclosureID for this enclosure.(Unique)','1','7','0','','','0','','','{$SNMP_PORT}','','','{$SNMP_COMMUNITY}','.1.3.6.1.4.1.3582.4.1.5.2.1.1.{#SNMPINDEX}','','0','','','0','0','','0','365','4','','','0','enclosureID[{#SNMPINDEX}]','','10160',NULL,'2','33490')] [Duplicate entry '10160-enclosureID[{#SNMPINDEX}]' for key 'items_1'] SQL statement execution has failed "INSERT INTO items (name,authtype,data_type,delay,delay_flex,delta,description,formula,history,inventory_link,ipmi_sensor,logtimefmt,multiplier,params,password,port,privatekey,publickey,snmp_community,snmp_oid,snmpv3_authpassphrase,snmpv3_authprotocol,snmpv3_contextname,snmpv3_privpassphrase,snmpv3_privprotocol,snmpv3_securitylevel,snmpv3_securityname,status,trends,type,units,username,value_type,key_,trapper_hosts,hostid,interfaceid,flags,itemid) VALUES ('enclosureID for {#SNMPINDEX}','0','0','60','','0','EnclosureID for this enclosure.(Unique)','1','7','0','','','0','','','{$SNMP_PORT}','','','{$SNMP_COMMUNITY}','.1.3.6.1.4.1.3582.4.1.5.2.1.1.{#SNMPINDEX}','','0','','','0','0','','0','365','4','','','0','enclosureID[{#SNMPINDEX}]','','10160',NULL,'2','33490')". [conf.import.php:176 → CFrontendApiWrapper->import() → CApiWrapper->__call() → CFrontendApiWrapper->callMethod() → CApiWrapper->callMethod() → CFrontendApiWrapper->callClientMethod() → CLocalApiClient->callMethod() → call_user_func_array() → CConfiguration->import() → CConfigurationImport->import() → CConfigurationImport->processDiscoveryRules() → CItemPrototype->create() → CItemPrototype->createReal() → DB::insert() → DB::exception() in include/classes/db/DB.php:441]
Hello
im trying since hours to convert these mibs
http://cd.lucom.de/vpn-industrie-router/snmp/
http://www.circitor.fr/Mibs/Html/C/CONEL-MIB.php#routerLR77V2L
https://bitbucket.org/bbsmartworx/snmp-mib/
http://www.oid-info.com/get/1.3.6.1.4.1.30140
https://www.smart-con.cz/wp-content/uploads/2018/04/SNMP_OID_Apliakcni_prirucka_20180227.pdf
before
$ snmptranslate .1.3.6.1.4.1.30140.6.1.0 MIB search path: /home/appliance/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp:/home/appliance/.snmp/mibs
$Cannot find module (CONEL-MIB.mib): At line 1 in (none) SNMPv2-SMI::enterprises.30140.6.1.0
then i uploaded the files into
/home/appliance/.snmp/mibs
/usr/local/share/snmp/mibs
/usr/share/snmp/mibs
$ export MIBS=+CONEL-STATUS-MIB $ export MIBS=+CISCO-SMI $ export MIBS=+CONEL-INFO-MIB $ export MIBS=+CONEL-IO-MIB $ export MIBS=+CONEL-MBUS-MIB $ export MIBS=+CONEL-MOBILE-MIB
result
$ snmptranslate .1.3.6.1.4.1.30140.6.1.0 CONEL-MOBILE-MIB::conel.6.1.0
$ mib2zabbix -f /home/appliance/conel.xml -e -o .1.3.6.1.4.1.30140.6.1 Smartmatch is experimental at /home/appliance/bin/mib2zabbix line 475. OID .1.3.6.1.4.1.30140.6.1 not found in MIB tree.
Zabbix v4.2.1
perl 5, version 22, subversion 1 (v5.22.1) built for x86_64-linux-gnu-thread-multi
Pod::Usage
M/MA/MAREKR/Pod-Usage-1.69.tar.gz
/usr/share/perl/5.22/Pod/Usage.pm
Installed: 1.64
CPAN: 1.69
XML::Simple
G/GR/GRANTM/XML-Simple-2.25.tar.gz
/usr/share/perl5/XML/Simple.pm
Installed: 2.22
CPAN: 2.25
Description: Ubuntu 16.04.6 LTS
Release: 16.04
Codename: xenial
running the appliance VM on Synology 1817+
$apt search net-snmp
Sorting... Done
Full Text Search... Done
libnet-snmp-perl/xenial,xenial 6.0.1-2 all
Script SNMP connectionslibsnmp-base/xenial-updates,xenial-updates,xenial-security,xenial-security,now 5.7.3+dfsg-1ubuntu4.2 all [installed,automatic]
SNMP configuration script, MIBs and documentationlibsnmp-dev/xenial-updates,xenial-security 5.7.3+dfsg-1ubuntu4.2 amd64
SNMP (Simple Network Management Protocol) development fileslibsnmp-extension-passpersist-perl/xenial,xenial 0.07-2 all
Generic pass/pass_persist extension framework for Net-SNMPlibsnmp-perl/xenial-updates,xenial-security,now 5.7.3+dfsg-1ubuntu4.2 amd64 [installed]
SNMP (Simple Network Management Protocol) Perl5 supportlibsnmp30/xenial-updates,xenial-security,now 5.7.3+dfsg-1ubuntu4.2 amd64 [installed,automatic]
SNMP (Simple Network Management Protocol) librarylibsnmp30-dbg/xenial-updates,xenial-security 5.7.3+dfsg-1ubuntu4.2 amd64
SNMP (Simple Network Management Protocol) library debugpython-netsnmp/xenial-updates,xenial-security 5.7.3+dfsg-1ubuntu4.2 amd64
SNMP (Simple Network Management Protocol) Python supportruby-snmp/xenial,xenial 1.2.0-1 all
simple network management protocol bindings for rubysnmp/xenial-updates,xenial-security,now 5.7.3+dfsg-1ubuntu4.2 amd64 [installed]
SNMP (Simple Network Management Protocol) applicationssnmpd/xenial-updates,xenial-security,now 5.7.3+dfsg-1ubuntu4.2 amd64 [installed,automatic]
SNMP (Simple Network Management Protocol) agentssnmptrapd/xenial-updates,xenial-security,now 5.7.3+dfsg-1ubuntu4.2 amd64 [installed]
Net-SNMP notification receiversnmptt/xenial,xenial 1.4-1 all
SNMP trap handler for use with snmptrapdtkmib/xenial-updates,xenial-updates,xenial-security,xenial-security 5.7.3+dfsg-1ubuntu4.2 all
SNMP (Simple Network Management Protocol) MIB browser
Hi Ryan
Have just download mib2zabbix script, but I am getting the following error message with running:
syu@ubuntu:~/mib2zabbix$ perl ./mib2zabbix.pl -o .1.3.6.1.4.1.24391.4.1
**Smartmatch is experimental at ./mib2zabbix.pl line 429.
circular data structures not supported at ./mib2zabbix.pl line 824.**
Line 824, XML output?
Hi,
i get the following error message :
mib2zabbix -f ENVSEMS2D.xml --oid=.1.3.6.1.4.1.3699
Smartmatch is experimental at /bin/mib2zabbix line 475.
Expected STATUS (OBJECTS): At line 136 in /usr/share/snmp/mibs/ENVSEMS2D.txt
Warning: ENVSEMS2D:: extSensorAclmValues appears to be a table entry but does not have the 'Entry; suffix
Hello,
I´m using your script to generate a Zabbix template for my EATON EPDU G3.
I´ve installed the MIB file from EATON according to the instructions over here (http://www.net-snmp.org/FAQ.html#How_do_I_add_a_MIB_). I can confirm that the MIB is working with snmptranslate:
root@zabbix:~/SNMP/mib2zabbix-master# snmptranslate 1.3.6.1.4.1.534
EATON-OIDS::eaton
However, when I´m trying to execute your script, it creates an empty xml file.
Here is my syntax for creating the template:
root@zabbix:~/SNMP/mib2zabbix-master# ./mib2zabbix.pl -f /root/eaton.xml -e -o .1.3.6.1.4.1.534
What do I do wrong here?
System is Debian Stretch with all updates installed & Zabbix 4.0
Kind regards & Happy New Year!
I am runing this command:
./mib2zabbix.pl -o MY_FILE.my
2 comments, when I run the same script without the .pl extension it gets further than this error by giving me an error already brought up here (about the circular arrays).
Secondly, does this program accept .my files?
Getting the following error on centos 7 yum. Installed as follows
sudo yum install "perl(SNMP)" "perl(XML::Simple)"
Ran as follows
mib2zabbix -o .1.3.6.1.2.1 -f ~/test/printer-mib.xml -v 3 -L authPriv -a SHA -A test -x AES -X test -n snmp-server -u test
Also tried without success.
sudo yum install perl-Digest-SHA
Hi,
I'm trying to use your script to generate a template from the BGP4-MIB file.
I'm looking for an option to just load this file.
The actual behavior is that the script loads all MIB files present in /usr/share/snmp/mibs/ and generate a 52000 lines template with all MIBS.
Thanks for your work.
Regards,
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
Problem is the following
`/bin/mib2zabbix$ perl mib2zabbix.pl -o
Smartmatch is experimental at mib2zabbix.pl line 475.
circular data structures not supported at mib2zabbix.pl line 918.
`
perl 5.24.1-3+deb9u4 libxml-simple-perl 2.22-1 libsnmp-perl 5.7.3+dfsg-1.7 zabbix-agent 1:3.4.11-1+stre i386 zabbix-frontend-php 1:3.4.11-1+stre all zabbix-release 3.4-1+stretch all zabbix-server-mysql 1:3.4.11-1+stre i386
Please tell me what you can do?
Thanks.
Hi Ryan
I have uploaded a version of your mib2zabbix to support v.24 template schema, feel free to merge it to your master copy. It is not the cleanest but it does the job.
https://github.com/akayueh/mib2zabbix
Steven
Hi all
I'm trying to convert mib file:
https://userweb.jlab.org/~brads/Manuals/Hardware/Liebert-Emerson_GXT_UPS/SNMP_MIBs/Upsmate.mib
to zabbix template
it has root oid: .1.3.6.1.4.1.935
it seems to be converted (without error), but not all parts are in template after import
can you help me, what could be problem?
also does your script supports zabbix version 4?
thanks
I've rendered IF-MIB and it looks fine, except I can't seem to figure out how to have the HC counters included. Is there a trick to this?
Thank you for your great work, which's help me to add template in Zabbix monitoring via imported mib file.
I trying to use command.
mib2zabbix -e -o .1.3.6.1.4.1.6247
but return as
OID .1.3.6.1.4.1.6247 not found in MIB tree
Environment:
Could you point me that what am I missing? Again thank you.
someone please guide steps to implement it
Thanks so much for great work!
I can suggest to add an option to specify the MIB modules to load? Maybe you could also have the "all" option like SNMPWALK?
snmpwalk option:
-m MIB[:...] load given list of MIBs (ALL loads everything)
-M DIR[:...] look in given list of directories for MIBs
Thanks so much
For those of us who don't write code every day, it would be much appreciated if there are examples of how to use this... the help function really doesn't do much to explain it to the layman. Please add examples and more detailed instructions on how to use this. Please assume people know nothing.
Hi Ryan
There seems to be an error in your Low-Level SNMP OID.
For example in the Doremi Template:
From Template:
Name: dcpSENfansEntry Discovery
Key: DOREMI-DC-DCPLAYER-MIB.dcpSENfansEntry
SNMP OID: discovery[{#DCPFANHIGHTHRESHOLD},.1.3.6.1.4.1.24391.4.1.3.3.1.1.1.6,{#DCPFANLOWTHRESHOLD},.1.3.6.1.4.1.24391.4.1.3.3.1.1.1.5,{#DCPFANVALUE},.1.3.6.1.4.1.24391.4.1.3.3.1.1.1.4,{#DCPFANWORKINGSTATE},.1.3.6.1.4.1.24391.4.1.3.3.1.1.1.3]
FromMIB Browser Software (e.g. iReasoning MIB Brower):
Name: dcpSENfansEntry
Key: DOREMI-DC-DCPLAYER-MIB.dcpSENfansEntry
OID: .1.3.6.1.4.1.24391.4.1.3.3.1.1.1
OID Full Name: .iso.org.dod.internet.private.enterprises.doremiHQRoot.drmDCRoot.drmdcDCPlayerMib.dcpModulesRoot.dcpSensors.dcpSENprobes.dcpSENfansTable.dcpSENfansEntry
Will this work with version 5 of Zabbix or does it need to be updated? If it does need to be updated, do you plan up doing that?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.