2016-06-01 15:33:08 +08:00
|
|
|
# mib2zabbix
|
|
|
|
|
|
2016-08-08 17:55:05 +08:00
|
|
|
This Perl script will generate a Zabbix v3 Template in XML format from an OID
|
|
|
|
|
tree in a SNMP MIB file.
|
2016-06-01 15:33:08 +08:00
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
|
|
2016-08-08 17:55:05 +08:00
|
|
|
mib2zabbix.pl -o <OID> [OPTIONS]...
|
|
|
|
|
|
2016-06-01 15:33:08 +08:00
|
|
|
Export loaded SNMP MIB OIDs to Zabbix Template XML
|
|
|
|
|
|
2016-08-08 17:55:05 +08:00
|
|
|
-f, --filename=PATH output filename (default: stdout)
|
|
|
|
|
|
|
|
|
|
-N, --name=STRING template name (default: OID label)
|
|
|
|
|
-G, --group=STRING template group (default: 'Templates')
|
|
|
|
|
-e, --enable-items enable all template items (default: disabled)
|
|
|
|
|
|
|
|
|
|
-o, --oid=STRING OID tree root to export (must start with '.')
|
|
|
|
|
|
|
|
|
|
-v, --snmpver=1|2|3 SNMP version (default: 2)
|
|
|
|
|
-p, --port=PORT SNMP UDP port number (default: 161)
|
|
|
|
|
|
2016-06-01 15:33:08 +08:00
|
|
|
SNMP Version 1 or 2c specific
|
|
|
|
|
|
2016-08-08 17:55:05 +08:00
|
|
|
-c, --community=STRING SNMP community string (default: 'public')
|
|
|
|
|
|
2016-06-01 15:33:08 +08:00
|
|
|
SNMP Version 3 specific
|
|
|
|
|
|
|
|
|
|
-L, --level=LEVEL security level (noAuthNoPriv|authNoPriv|authPriv)
|
|
|
|
|
-n, --context=CONTEXT context name
|
|
|
|
|
-u, --username=USERNAME security name
|
|
|
|
|
-a, --auth=PROTOCOL authentication protocol (MD5|SHA)
|
|
|
|
|
-A, --authpass=PASSPHRASE authentication protocol passphrase
|
|
|
|
|
-x, --privacy=PROTOCOL privacy protocol (DES|AES)
|
|
|
|
|
-X, --privpass=PASSPHRASE privacy passphrase
|
2016-08-08 17:55:05 +08:00
|
|
|
|
|
|
|
|
Zabbix item configuration
|
|
|
|
|
|
|
|
|
|
--check-delay=SECONDS check interval in seconds (default: 60)
|
|
|
|
|
--disc-delay=SECONDS discovery interval in seconds (default: 3600)
|
|
|
|
|
--history=DAYS history retention in days (default: 7)
|
|
|
|
|
--trends=DAYS trends retention in days (default: 365)
|
|
|
|
|
|
|
|
|
|
-h, --help print this message
|
2016-06-01 15:33:08 +08:00
|
|
|
|
|
|
|
|
### Requirements
|
|
|
|
|
|
2016-08-08 17:55:05 +08:00
|
|
|
* Zabbix v3+
|
|
|
|
|
* Perl v5
|
2016-06-01 15:33:08 +08:00
|
|
|
* Pod::Usage
|
|
|
|
|
* XML::Simple
|
|
|
|
|
* Net-SNMP
|
|
|
|
|
* Correctly configured [MIB files](http://net-snmp.sourceforge.net/tutorial/tutorial-5/commands/mib-options.html)
|
|
|
|
|
|
2016-08-08 18:18:57 +08:00
|
|
|
### Installation
|
|
|
|
|
|
2016-08-17 16:18:18 +08:00
|
|
|
Install from GitHub:
|
2016-08-08 18:18:57 +08:00
|
|
|
|
2016-08-17 15:10:05 +08:00
|
|
|
# install prerequisites on Ubuntu:
|
|
|
|
|
apt-get install perl libxml-simple-perl libsnmp-perl
|
|
|
|
|
|
2016-10-30 20:43:50 +08:00
|
|
|
# install prerequisites on RHEL family:
|
|
|
|
|
yum install "perl(SNMP)" "perl(XML::Simple)"
|
|
|
|
|
|
2016-08-17 15:10:05 +08:00
|
|
|
# assumes ~/bin exists and is in $PATH, so adjust accordingly!
|
|
|
|
|
curl -sL -o ~/bin/mib2zabbix https://raw.githubusercontent.com/cavaliercoder/mib2zabbix/master/mib2zabbix.pl
|
|
|
|
|
chmod +x ~/bin/mib2zabbix
|
|
|
|
|
|
2016-08-08 18:18:57 +08:00
|
|
|
|
2016-06-01 15:33:08 +08:00
|
|
|
### Translations
|
|
|
|
|
|
2016-08-08 17:55:05 +08:00
|
|
|
This table describes how MIB elements are translated into Zabbix template
|
|
|
|
|
elements:
|
|
|
|
|
|
2016-06-01 15:33:08 +08:00
|
|
|
* Scalar OID -> Zabbix SNMP Item
|
|
|
|
|
* Table OID -> Zabbix SNMP Discovery Rule
|
|
|
|
|
* Table Column OID -> Zabbix Discovery Prototype
|
|
|
|
|
* Trap/Notification OID -> Zabbix SNMP Trap Item
|
2016-08-08 17:55:05 +08:00
|
|
|
* OID Enums -> Zabbix Value Maps
|
2016-06-01 15:47:54 +08:00
|
|
|
|
|
|
|
|
### License
|
|
|
|
|
|
|
|
|
|
mib2zabbix - SNMP Template Generator for Zabbix
|
|
|
|
|
Copyright (C) 2016 - Ryan Armstrong <ryan@cavaliercoder.com>
|
|
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|