root / tools / munin2snmp / README.pod @ 06c8538a
Historique | Voir | Annoter | Télécharger (2,89 ko)
| 1 | 45941d87 | Alex Mestiashvili | =head1 NAME |
|---|---|---|---|
| 2 | |||
| 3 | munin2snmp - SNMP Agent to query munin-node over snmp |
||
| 4 | |||
| 5 | =head1 REQUIREMENTS |
||
| 6 | |||
| 7 | 06c8538a | Alex Mestiashvili | Net::SNMP, Getopt::Long, Pod::Usage perl modules, munin-node with some plugins |
| 8 | 45941d87 | Alex Mestiashvili | |
| 9 | =head2 Example configuration |
||
| 10 | |||
| 11 | /etc/snmp/snmpd.conf |
||
| 12 | |||
| 13 | master agentx |
||
| 14 | agentAddress udp:127.0.0.1:161 |
||
| 15 | rocommunity public 127.0.0.1 |
||
| 16 | |||
| 17 | On a newer system it is enough to define "master" option only |
||
| 18 | |||
| 19 | MUNIN-MIB should be installed on the client, |
||
| 20 | it goes to /usr/local/share/snmp/mibs or /usr/share/munin/mibs |
||
| 21 | or another place where snmpd expects to find the MIB files. |
||
| 22 | |||
| 23 | See also http://www.net-snmp.org/wiki/index.php/FAQ:MIBs_03 |
||
| 24 | |||
| 25 | 06c8538a | Alex Mestiashvili | It is possible to start munin2snmp as non-root user, for example |
| 26 | run munin2snmp as Debian-snmp user on Debian Stretch: |
||
| 27 | |||
| 28 | fix the /var/agentx permissions: |
||
| 29 | |||
| 30 | chmod g+rx /var/agentx |
||
| 31 | chgrp Debian-snmp /var/agentx |
||
| 32 | |||
| 33 | add to /etc/snmp/snmpd.conf: |
||
| 34 | |||
| 35 | master agentx |
||
| 36 | agentXperms 0640 0550 Debian-snmp Debian-snmp |
||
| 37 | |||
| 38 | restart snmpd and start the agent as Debian-snmp: |
||
| 39 | |||
| 40 | su -l Debian-snmp -s /bin/bash -c "/tmp/munin2snmp.pl --pidfile /tmp/munin2snmp.pid --plugins iostat,vmstat" |
||
| 41 | 45941d87 | Alex Mestiashvili | |
| 42 | =head2 Usage |
||
| 43 | |||
| 44 | After setting up snmpd, start the agent: |
||
| 45 | |||
| 46 | 06c8538a | Alex Mestiashvili | ./munin2snmp |
| 47 | 45941d87 | Alex Mestiashvili | |
| 48 | Now one can query the agent |
||
| 49 | |||
| 50 | snmpwalk -v 2c -mMUNIN-MIB -c public localhost .1.3.6.1.4.1.123456.100.1.1 |
||
| 51 | |||
| 52 | where "1.3.6.1.4.1.123456.100.1.1" is example OID selected as the base |
||
| 53 | tree for the agent. |
||
| 54 | |||
| 55 | 06c8538a | Alex Mestiashvili | Change OBJECT IDENTIFIER in the MUNIN-MIB file if you plan to use a different OID. |
| 56 | |||
| 57 | 45941d87 | Alex Mestiashvili | You might need to change the host, port, oidbase and munin_plugins you want to use. |
| 58 | |||
| 59 | The defaults: |
||
| 60 | |||
| 61 | $Munin{PORT} = '4949';
|
||
| 62 | $Munin{HOST} = 'localhost'
|
||
| 63 | $oidbase = ".1.3.6.1.4.1.123456.100.1.1" |
||
| 64 | 06c8538a | Alex Mestiashvili | @munin_plugins = qw ( load cpu df ); |
| 65 | |||
| 66 | One can override the defaults by creating /etc/munin2snmp.conf file with the following |
||
| 67 | configuration options: |
||
| 68 | |||
| 69 | munin_port = [port] |
||
| 70 | munin_host = [host] |
||
| 71 | base_oid = [oid] |
||
| 72 | munin_plugins = [comma separated list of munin-node plugins] |
||
| 73 | |||
| 74 | Or by specifying the parameters, see munin2snmp --help for the usage |
||
| 75 | 45941d87 | Alex Mestiashvili | |
| 76 | =head1 ACKNOWLEDGEMENTS |
||
| 77 | |||
| 78 | Heavily inspired by |
||
| 79 | Vincent Bernat: https://github.com/vincentbernat/extend-netsnmp |
||
| 80 | and Masahito Zembutsu: https://github.com/zembutsu/muninwalk |
||
| 81 | 05d4ad0a | Alex Mestiashvili | |
| 82 | 45941d87 | Alex Mestiashvili | =head1 LICENSE |
| 83 | |||
| 84 | 06c8538a | Alex Mestiashvili | ISC License (ISC) |
| 85 | |||
| 86 | Copyright (c) 2016, Alex Mestiashvili <mailatgoogl@gmail.com> |
||
| 87 | 45941d87 | Alex Mestiashvili | |
| 88 | 06c8538a | Alex Mestiashvili | Permission to use, copy, modify, and/or distribute this software for any |
| 89 | purpose with or without fee is hereby granted, provided that the above |
||
| 90 | copyright notice and this permission notice appear in all copies. |
||
| 91 | 45941d87 | Alex Mestiashvili | |
| 92 | 06c8538a | Alex Mestiashvili | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 93 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
||
| 94 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
||
| 95 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
||
| 96 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
||
| 97 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
||
| 98 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
