GetRequest (GetNextRequest)
,
SetRequest
na strane klienta, prípadná odpoveď serveru(agenta) je via Response
. Špeciálna záležitosť je nastavenie
tzv. trap - na nastavenú veličinu zareaguje server poslaným informácie a o jej výskyte.INTEGER, Integer32, IPaddress, Counter32, OBJECT IDENTIFIER, ...
). Podporuje možnosť vytvárať komplexnejšie
dátové typy - tabuľky - pomocou konštroru SEQUENCE OF. Existuje už zhruba desať tisíc nadefinovaných objektov.
Príklad definície objektu:
ipForwarding OBJECT-TYPE
SYNTAX INTEGER {
forwarding(1), -- acting as a router
notForwarding(2) -- NOT acting as a router
}
MAX-ACCESS read-write
STATUS current
DESCRIPTION
"The indication of whether this entity is acting as an IP
router in respect to the forwarding of datagrams received
by, but not addressed to, this entity. IP routers forward
datagrams. IP hosts do not (except those source-routed via
the host)."
::= { ip 1 }
. | --------|---------------------- | | | | ccitt(0) iso(1) itu(2) joint-iso-ccitt(3) | |---------------| | org(3) | dod(6) | internet(1) | mgmt(2) | mib-2(1) | ------------------------|----------------------- | | | | | | system(1) interfaces(2) ip(4) icmp(5) tcp(6) udp(7)
# ./configure --with-default-snmp-version="3" --with-sys-contact="xbokes@fi.muni.cz" --with-sys-location="lab.fi.muni.cz" --with-logfile="/var/log/snmpd.log" --with-persistent-directory="/var/net-snmp"
---------------------------------------------------------
Net-SNMP configuration summary:
---------------------------------------------------------
Net-SNMP Version: 5.1.1
Building for: linux
Network transport support: Callback Unix TCP UDP
SNMPv3 Security Modules: usm
Agent MIB code: mibII ucd_snmp snmpv3mibs notification target agent_mibs agentx agent_mibs utilities host
SNMP Perl modules: disabled
Embedded perl support: disabled
Authentication support: MD5 SHA1
Encryption support: DES AES128 AES192 AES256
---------------------------------------------------------
Pokusy so zahrnutím SMNP perl modulov, resp. zabudovanísm perl-u boli po variaciách pokusov negatívne. Perl moduly je nutné konfigurovať
a kompilovať samostatne (podadresár Perl). Pozn.: konciguracia sa spúšťa perl ./Makefile.pl. Uplny a korektny popis
je v INSTALL subore.# make && make test
# su
# make install
/etc/snmp/snmpd.conf
, niektoré distribúcie (alebo staršie verzie)
/etc/snmp/snmpd.local.conf
. Manuálové stránky sú prístupné tu.
Konfigurácia riadenia prístupu - direktívy: com2sec
, group
, view
a access
.# 1) priradenie community k security
# sec.name source community
com2sec notConfigUser default public
com2sec labUser 10.0.0.01/16 lab
com2sec anyAgaue 10.0.20.1/8 agaue
# 2) priradenie security skupine
# groupName securityModel securityName
group notConfigGroup v1 notConfigUser
group labGroup v2c labUser
group AgaueGroup v2c anyAgaue
# 3) priradenie views (neskôr k nim skupiny budú mať priradený prístup)
# name incl/excl subtree mask(optional)
view systemview included .1.3.6.1.2.1.1
view mib2 included .iso.org.dod.internet.mgmt.mib-2
view all included .1
# 4) priradenie práv prístupu skupine
# group context sec.model sec.level prefix read write notif
access notConfigGroup "" any noauth exact systemview none none
access labGroup "" any noauth exact mib2 none none
access AgaueGroup "" 2c noauth exact all all none
# /etc/rc.d/init.d/snmpd start
, resp. # service snmpd start
# snmpwalk -v 2c agaue-beta -c public system
SNMPv2-MIB::sysDescr.0 = STRING: Linux agaue-beta 2.6.3 #7 Tue Mar 16 23:34:30 CET 2004 i686
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
SNMPv2-MIB::sysUpTime.0 = Timeticks: (137416) 0:22:54.16
SNMPv2-MIB::sysContact.0 = STRING: Marek Bokes <xbokes@fi.muni.cz>
SNMPv2-MIB::sysName.0 = STRING: agaue-beta
SNMPv2-MIB::sysLocation.0 = STRING: lab.fi.muni.cz
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (3) 0:00:00.03
SNMPv2-MIB::sysORID.1 = OID: IF-MIB::ifMIB
SNMPv2-MIB::sysORID.2 = OID: SNMPv2-MIB::snmpMIB
SNMPv2-MIB::sysORID.3 = OID: TCP-MIB::tcpMIB
SNMPv2-MIB::sysORID.4 = OID: IP-MIB::ip
SNMPv2-MIB::sysORID.5 = OID: UDP-MIB::udpMIB
SNMPv2-MIB::sysORID.6 = OID: SNMP-VIEW-BASED-ACM-MIB::vacmBasicGroup
SNMPv2-MIB::sysORID.7 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance
SNMPv2-MIB::sysORID.8 = OID: SNMP-MPD-MIB::snmpMPDCompliance
SNMPv2-MIB::sysORID.9 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance
SNMPv2-MIB::sysORDescr.1 = STRING: The MIB module to describe generic objects for network interface sub-layers
SNMPv2-MIB::sysORDescr.2 = STRING: The MIB module for SNMPv2 entities
SNMPv2-MIB::sysORDescr.3 = STRING: The MIB module for managing TCP implementations
SNMPv2-MIB::sysORDescr.4 = STRING: The MIB module for managing IP and ICMP implementations
SNMPv2-MIB::sysORDescr.5 = STRING: The MIB module for managing UDP implementations
SNMPv2-MIB::sysORDescr.6 = STRING: View-based Access Control Model for SNMP.
SNMPv2-MIB::sysORDescr.7 = STRING: The SNMP Management Architecture MIB.
SNMPv2-MIB::sysORDescr.8 = STRING: The MIB for Message Processing and Dispatching.
SNMPv2-MIB::sysORDescr.9 = STRING: The management information definitions for the SNMP User-based Security Model.
SNMPv2-MIB::sysORUpTime.1 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORUpTime.2 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORUpTime.3 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORUpTime.4 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORUpTime.5 = Timeticks: (1) 0:00:00.01
SNMPv2-MIB::sysORUpTime.6 = Timeticks: (2) 0:00:00.02
SNMPv2-MIB::sysORUpTime.7 = Timeticks: (3) 0:00:00.03
SNMPv2-MIB::sysORUpTime.8 = Timeticks: (3) 0:00:00.03
SNMPv2-MIB::sysORUpTime.9 = Timeticks: (3) 0:00:00.03
# cfgmaker --global "WorkDir: /var/www/html/mrtg" --global "Refresh: 300" --ifref=name --output=/etc/mrtg/mrtg.test.cfg public@agaue-beta.lab.fi.muni.cz
mrtg.cfg
(ručne editované, použitie scriptu na získanie dát)
WorkDir: /var/www/html/mrtg/
Options[_]: growright, gauge
Colours[_]: LIGHT_BLU#7aafff,BLU#1000ff,DARK BLU#000066,VIOLET#ff00ff,GREEN#00ff00
Ylegend[_]: % packet loss
Target[ping]: `/etc/mrtg/scripts/pingloss.sh`
MaxBytes[ping]:100
AbsMax[ping]:100
Title[ping]: Strata paketov [%]
PageTop[ping]: <H1>Strata paketov [%]</H1>
Target[_eth0]: `/etc/mrtg/scripts/dev_eth0.sh`
MaxBytes[_eth0]: 12500000
Title[localhost_eth0]:
PageTop[_eth0]: <H1>eth0</H1>