doc:appunti:linux:sa:snmp
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
doc:appunti:linux:sa:snmp [2011/02/26 12:03] – [Esempi configurazione] niccolo | doc:appunti:linux:sa:snmp [2018/02/05 07:04] – [Introduzione] niccolo | ||
---|---|---|---|
Line 21: | Line 21: | ||
.1.3.6.1.2.1.31.1.1.1.1.2 | .1.3.6.1.2.1.31.1.1.1.1.2 | ||
- | # snmptranslate .1.3.6.1.2.1.31.1.1.1.1.2 | + | # snmptranslate |
IF-MIB:: | IF-MIB:: | ||
Line 82: | Line 82: | ||
La versione più recente del pacchetto Debian binda il demone solo sull' | La versione più recente del pacchetto Debian binda il demone solo sull' | ||
+ | ==== Controllo del log ==== | ||
+ | L' | ||
+ | |||
+ | < | ||
+ | SNMPDOPTS=' | ||
+ | </ | ||
+ | |||
+ | In questo caso **S0-5** significa loggare su syslog da '' | ||
===== Aggiunta di sensori SNMP ===== | ===== Aggiunta di sensori SNMP ===== | ||
Line 88: | Line 96: | ||
persi (netmonitor), | persi (netmonitor), | ||
- | <code> | + | <file> |
exec sensors1 / | exec sensors1 / | ||
exec sensors2 / | exec sensors2 / | ||
- | </code> | + | </file> |
A questo punto il sensore è leggibile con: | A questo punto il sensore è leggibile con: | ||
Line 101: | Line 109: | ||
Come si vede il valore è disponibile sotto un MIB differente, la radice in questo caso è .1.3.6.1.4.1.2021.8.1. (UCD-SNMP-MIB:: | Come si vede il valore è disponibile sotto un MIB differente, la radice in questo caso è .1.3.6.1.4.1.2021.8.1. (UCD-SNMP-MIB:: | ||
+ | Con la nuova sintassi di **'' | ||
+ | |||
+ | < | ||
+ | extend sensors_cpu_fan | ||
+ | extend sensors_sys_fan | ||
+ | </ | ||
+ | |||
+ | in questo caso l'OID da leggere è: | ||
+ | |||
+ | < | ||
+ | snmpwalk -v1 -c public 127.0.0.1 ' | ||
+ | </ | ||
+ | |||
+ | Il vantaggio è che l'OID viene indirizzato non con l' | ||
+ | |||
+ | Notare l'uso degli apici nel comando da shell, in quanto le **doppie virgolette** fanno parte a tutti gli effetti del nome dell' | ||
===== Esempi configurazione ===== | ===== Esempi configurazione ===== | ||
Line 127: | Line 151: | ||
< | < | ||
### CPU Load | ### CPU Load | ||
- | Target[cpu1]: | + | Target[cpu1]: |
+ ssCpuRawSystem.0& | + ssCpuRawSystem.0& | ||
- | + ssCpuRawNice.0& | + | + ssCpuRawNice.0& |
Title[cpu1]: | Title[cpu1]: | ||
PageTop[cpu1]: | PageTop[cpu1]: | ||
+ | Colours[cpu1]: | ||
MaxBytes[cpu1]: | MaxBytes[cpu1]: | ||
Unscaled[cpu1]: | Unscaled[cpu1]: | ||
Line 142: | Line 167: | ||
LegendI[cpu1]: | LegendI[cpu1]: | ||
LegendO[cpu1]: | LegendO[cpu1]: | ||
- | Options[cpu1]: | + | #Options[cpu1]: |
+ | Options[cpu1]: | ||
</ | </ | ||
+ | |||
+ | **NOTA**: Il carico della CPU deve essere diviso per il **numero di core** presenti (vedere con '' | ||
< | < | ||
Line 171: | Line 199: | ||
PageTop[free]: | PageTop[free]: | ||
Options[free]: | Options[free]: | ||
- | Colours[free]: | + | Colours[free]: |
MaxBytes1[free]: | MaxBytes1[free]: | ||
MaxBytes2[free]: | MaxBytes2[free]: | ||
Line 207: | Line 235: | ||
#!/bin/sh | #!/bin/sh | ||
- | # It assumes that the command output(df -kl) looks like this: | + | # It assumes that the command output(df -klP) looks like this: |
# | # | ||
# Filesystem | # Filesystem | ||
Line 267: | Line 295: | ||
</ | </ | ||
- | ===== MIBs e Debian Squeeze ===== | + | Temperature graph using **lmsensors**. Verify that the version of Net-SNMP on the target system was compiled with the lmSensors extension by running **'' |
+ | |||
+ | < | ||
+ | snmpwalk -v2c -c public localhost 1.3.6.1.4.1.2021.13.16 | ||
+ | </ | ||
+ | |||
+ | In my case the temperature is multiplied by 1000: | ||
+ | |||
+ | < | ||
+ | ### Sensor temp1 | ||
+ | Target[temp1]: | ||
+ | Factor[temp1]: | ||
+ | YTicsFactor[temp1]: | ||
+ | Title[temp1]: | ||
+ | PageTop[temp1]: | ||
+ | Options[temp1]: | ||
+ | Colours[temp1]: | ||
+ | MaxBytes[temp1]: | ||
+ | Unscaled[temp1]: | ||
+ | YLegend[temp1]: | ||
+ | ShortLegend[temp1]: | ||
+ | Legend1[temp1]: | ||
+ | Legend2[temp1]: | ||
+ | LegendI[temp1]: | ||
+ | LegendO[temp1]: | ||
+ | </ | ||
+ | |||
+ | It seems that MRTG does not support UTF-8 (even version 2.17.4), so the configuration file should be encoded in ISO_8859-1. Special characters used in HTML output should be encoded properly. | ||
+ | |||
+ | See this article: [[http:// | ||
+ | |||
+ | ===== MIBs e Debian | ||
+ | |||
+ | Vedere il [[https:// | ||
Tradizionalmente i file contenenti i MIBs di [[http:// | Tradizionalmente i file contenenti i MIBs di [[http:// | ||
Line 281: | Line 342: | ||
</ | </ | ||
- | Stessa cosa bisogna farla per il demone snmpd, | + | Stessa cosa bisogna farla per il demone snmpd, |
< | < | ||
- | # Don't load any MIBs by default. | + | export MIBS=UCD-SNMP-MIB |
- | # You might comment this lines once you have the MIBs downloaded. | + | |
- | #export MIBS= | + | |
</ | </ | ||
Line 332: | Line 391: | ||
NET-SNMP-EXTEND-MIB:: | NET-SNMP-EXTEND-MIB:: | ||
</ | </ | ||
+ | |||
+ | ===== SNMP su ipv6 ===== | ||
+ | |||
+ | Con Debian Wheezy sono necessarie alcune accortezze perché SNMP risponda anche su IPV6, in particolare **''/ | ||
+ | |||
+ | < | ||
+ | agentAddress | ||
+ | agentaddress | ||
+ | |||
+ | rocommunity | ||
+ | rocommunity6 public default | ||
+ | </ | ||
+ | |||
+ | ===== SNMP con systemd su Debian 9 ===== | ||
+ | |||
+ | **Debian 9 Stretch** utilizza il sistema di init **systemd** invece del vecchio // | ||
+ | |||
+ | La risoluzione degli OIDs nella loro descrizione testuale richiede sempre l' | ||
+ | |||
+ | < | ||
+ | #mibs : | ||
+ | </ | ||
+ | |||
+ | Eventuali personalizzazioni dei parametri di snmpd non si fanno più con la variabile d' |
doc/appunti/linux/sa/snmp.txt · Last modified: 2020/04/01 11:40 by niccolo