Dit geeft de verschillen weer tussen de geselecteerde revisie en de huidige revisie van de pagina.
| Beide kanten vorige revisie Vorige revisie Volgende revisie | Vorige revisie | ||
|
werkinstructies:snmp:monitoring_centos7 [2016/08/24 11:49] abel [configuratie] |
werkinstructies:snmp:monitoring_centos7 [2016/08/25 22:38] (huidige) abel [Eeen custom OID/MIB maken] |
||
|---|---|---|---|
| Regel 26: | Regel 26: | ||
| #### | #### | ||
| # First, map the community name " | # First, map the community name " | ||
| - | # | + | # sec.name |
| - | com2sec | + | com2sec |
| + | com2sec | ||
| #### | #### | ||
| # Second, map the security name into a group name: | # Second, map the security name into a group name: | ||
| - | # groupName | + | # group.name sec.model |
| - | group notConfigGroup | + | group |
| - | group notConfigGroup | + | |
| #### | #### | ||
| Regel 42: | Regel 42: | ||
| #### | #### | ||
| # Finally, grant the group read-only access to the systemview view. | # Finally, grant the group read-only access to the systemview view. | ||
| - | + | # | |
| - | # group | + | access MyROGroup |
| - | access | + | |
| - | + | ||
| - | ## | + | |
| - | com2sec | + | |
| - | + | ||
| - | ## | + | |
| - | group MyROGroup | + | |
| - | + | ||
| - | ## | + | |
| - | access MyROGroup | + | |
| </ | </ | ||
| Regel 69: | Regel 59: | ||
| load 12 14 14 | load 12 14 14 | ||
| </ | </ | ||
| + | |||
| + | ===== Eeen custom OID/MIB maken ===== | ||
| + | |||
| + | Voor sommige gewenste dat is geen snmp OID beschikbaar, | ||
| + | |||
| + | Om deze waarden toch via snmp beschikbaar te maken kan je de uitkomst van een script als extra snmp waarde configureren. | ||
| + | |||
| + | We nemen het voorbeeld van het netwerk verkeer. | ||
| + | |||
| + | de standaard MIB's geven een cumulatief getal voor het aantal octets in en uit, dus geen bits per seconde. | ||
| + | |||
| + | De oplossing is een script dat continue deze waarde voor het netwerk verkeer uitrekent en in een file zet. Het uitlezen van de waarde in die file kunnen we dan als een simpel script aan de snmp configuratie toevoegen. | ||
| + | |||
| + | '' | ||
| + | |||
| + | en zet hier in: | ||
| + | < | ||
| + | #!/bin/bash | ||
| + | |||
| + | while true | ||
| + | do | ||
| + | |||
| + | #haal de cumulatieve waarde van de input en output | ||
| + | |||
| + | inoct_1=$(snmpget -v 1 localhost -c public IF-MIB:: | ||
| + | outoct_1=$(snmpget -v 1 localhost -c public IF-MIB:: | ||
| + | |||
| + | sleep 5 | ||
| + | |||
| + | inoct_2=$(snmpget -v 1 localhost -c public IF-MIB:: | ||
| + | outoct_2=$(snmpget -v 1 localhost -c public IF-MIB:: | ||
| + | |||
| + | in_traffic=$[((inoct_2 * 8) - (inoct_1 * 8)) / 5] | ||
| + | out_traffic=$[((outoct_2 * 8) - (outoct_1 * 8)) / 5] | ||
| + | #echo $in_traffic | ||
| + | echo $in_traffic > / | ||
| + | #echo $out_traffic | ||
| + | echo $out_traffic >> / | ||
| + | |||
| + | done | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||