Gebruikershulpmiddelen

Site-hulpmiddelen


werkinstructies:snmp:monitoring_centos7

Verschillen

Dit geeft de verschillen weer tussen de geselecteerde revisie en de huidige revisie van de pagina.

Link naar deze vergelijking

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 "public" into a "security name" # First, map the community name "public" into a "security name"
-      sec.name       source        community +       sec.name   source              community 
-com2sec notConfigUser  default       public+com2sec  mynetwork  192.168.1.0/24      public 
 +com2sec  mynetwork  localhost           public
  
 #### ####
 # Second, map the security name into a group name: # Second, map the security name into a group name:
-      groupName        securityModel   securityName +     group.name sec.model  sec.name 
-group   notConfigGroup   v1              notConfigUser +group  MyROGroup  v2c        mynetwork
-group   notConfigGroup   v2c             notConfigUser+
  
 #### ####
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.
- +                context sec.model sec.level prefix    read    write    notif 
-      group           context sec.model sec.level prefix read    write  notif +access MyROGroup   ""     any       noauth    exact      all    none     none
-access  notConfigGroup  ""      any       noauth    exact  allview none   none +
- +
-##       sec.name   source              community +
-com2sec  mynetwork  192.168.1.0/24      public +
- +
-##     group.name sec.model  sec.name +
-group  MyROGroup  v2c        mynetwork +
-  +
-##                context sec.model sec.level prefix    read    write    notif +
-access MyROGroup   ""     any       noauth    exact      all    none   none+
  
 </code> </code>
Regel 69: Regel 59:
 load 12 14 14 load 12 14 14
 </code> </code>
 +
 +===== Eeen custom OID/MIB maken =====
 +
 +Voor sommige gewenste dat is geen snmp OID beschikbaar, bijvoorbeeld netwerk I/O per tijdseenheid.
 +
 +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.
 +
 +''vi /usr/local/bin/calculate_network_trafic.sh''
 +
 +en zet hier in:
 +<code>
 +#!/bin/bash
 +
 +while true
 +do
 +
 +  #haal de cumulatieve waarde van de input en output  octets op elke 5 seconde en deel het verschil door 5
 +
 +  inoct_1=$(snmpget -v 1 localhost -c public IF-MIB::ifInOctets.2 | cut -d' ' -f4)
 +  outoct_1=$(snmpget -v 1 localhost -c public IF-MIB::ifOutOctets.2 | cut -d' ' -f4)
 +
 +  sleep 5
 +
 +  inoct_2=$(snmpget -v 1 localhost -c public IF-MIB::ifInOctets.2 | cut -d' ' -f4)
 +  outoct_2=$(snmpget -v 1 localhost -c public IF-MIB::ifOutOctets.2 | cut -d' ' -f4)
 +
 +  in_traffic=$[((inoct_2 * 8) - (inoct_1 * 8)) / 5]
 +  out_traffic=$[((outoct_2 * 8) - (outoct_1 * 8)) / 5]
 +  #echo $in_traffic
 +  echo $in_traffic > /var/tmp/nettraffic
 +  #echo $out_traffic
 +  echo $out_traffic >> /var/tmp/nettraffic
 +
 +done
 +</code> 
 +
 +
 +
  
  
werkinstructies/snmp/monitoring_centos7.1472032151.txt.gz · Laatst gewijzigd: 2016/08/24 11:49 door abel