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:07]
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+
  
 #### ####
 # Third, create a view for us to let the group have rights to: # Third, create a view for us to let the group have rights to:
 #       name           incl/excl     subtree         mask(optional) #       name           incl/excl     subtree         mask(optional)
-view    allview        included      .1+view    all            included      .1
  
 #### ####
 # 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 60: Regel 50:
  
 <code> <code>
-# dit is om het http proces te monitoren met nagios via snmp+# dit is om het http proces te monitoren met nagios via snmp, critical is >10 en <1
 proc httpd 10 1 proc httpd 10 1
  
-# dit is om de root partitie te bewaken+# dit is om de root partitie te bewaken critical is <100000 Mb vrij
 disk / 100000 disk / 100000
  
Regel 70: Regel 60:
 </code> </code>
  
-zet vervolgens de firewall open voor snmp:+===== Eeen custom OID/MIB maken =====
  
-''%%firewall-cmd --add-port=161/tcp --permanent%%\\ +Voor sommige gewenste dat is geen snmp OID beschikbaar, bijvoorbeeld netwerk I/O per tijdseenheid.
-firewall-cmd %%--%%reload''+
  
 +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.
  
-===== op de Nagios server =====+de standaard MIB's geven een cumulatief getal voor het aantal octets in en uit, dus geen bits per seconde.
  
-test op de nagios server of de snmp waarden uit te lezen zijn:+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>  
 + 
 + 
 + 
 + 
 + 
 + 
 + 
 +===== op de Nagios server =====
  
-''snmpwalk -v 1 name-of-server.auriel.nl -c public .1.3.6.1.4.1.2021.9''+test op de nagios server of de snmp waarden uit te lezen zijn:\\ 
 +''snmpwalk -v 1 backup.auriel.nl -c public .1.3.6.1.4.1.2021.9.1.9''
  
-die moet een waarde geven:+als het klopt krijg je output:
 <code> <code>
 +UCD-SNMP-MIB::dskPercent.1 = INTEGER: 65
 </code> </code>
  
werkinstructies/snmp/monitoring_centos7.1472029632.txt.gz · Laatst gewijzigd: 2016/08/24 11:07 door abel