jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [trunk/] [Documentation/] [README.snmp] - Blame information for rev 30

 

Line No. Rev Author Line
11simandl;
2; SNMP in HotSaNIC
3;
4 
5With the 0.5 release of HotSaNIC the new SNMP enhancement was introduced.
6I will try to assamble all usefull information about the snmp part in this
7document to give the user an overview whats happening and help developers
8to make their own SNMP enhanced modules.
9 
10--------
11Overview
12--------
13 
14All mdoules gathering data through SNMP use the lib/HotSaNICsnmp.pm module
15to communicate with the SNMP server and collect the needed information.
16The module tries to guess the version of SNMP to use and the "kind" of
17interface (perl module Net::SNMP or system commands). After the first
18call by anyone module the guessed version is stored in a file to be
19read for later calls. Located in $HotSaNIC/modules and named $host.info.
20This is important to know, because if the server is down for some
21reason the content might be wrong, to be sure just do the following:
22 
231. Stop HotSaNIC
242. Delete the file(s) storing version information
253. Start HotSaNIC
26 
27Probing for each host is done again by the first module doing some
28SNMP query.
29 
30Supported protocol versions are: SNMPv1 and SNMPv2c
31 
32Probing is done by sending a get_bulk_request to the agent. If this
33request fails it is assumed that the agent runs protocol version 1 and this
34will be used for all further queries to the same address.
35 
36-------------------------------------------------
37Modules with SNMP support with sample config line
38-------------------------------------------------
39 
40apps:
41APP=SNMP:192.168.1.1:public:sshd,sshd@gateway
42 
43part:
44DRIVE=SNMP:192.168.1.1:public:/dev/hda1,root-fs@gateway
45 
46system:
47HOST=SNMP:192.168.1.1:public,Gateway
48 
49traffic:
50DEV="SNMP:192.168.1.1:public:eth0,12500000,12500000,100MBit Ethernet"
51 
52-------------------------
53Sample run in the logfile
54-------------------------
55 
56To give you a clue about a correct run of SNMP query here is
57a log examples. To get all information you have to set the
58DEBUGLEVEL option in the main settings file to 5.
59 
60The APPS module without preprobed version:
61 
62<log on>
63starting module: "apps"
64Operating system "linux" not supported!
65Falling back to "default"
66.running on PID 14565
67 
681053344545: main loop running
691053344545: signaling 14565
700.181(apps) 1053344545 APPS: enter snmp_walk()
71 
721053344545 APPS: probe_version() module
731053344545 APPS: set_version() [2c]
741053344545 APPS: snmp_mod_walk() [HASH(0x82c4d6c)]
751053344545 APPS: leave snmp_walk()
76<log off>
77 
78After normal startup the first query to the snmp daemon is done by
79calling snmp_walk which logs entry and exit point enclosing the
80whole process. After entering snmp_walk the set_version() function
81is called which needs to call probe_version(), the occurence of
82the logentries is a bit confusing because all function log at the
83end before returning. But well the set_version line shows us that
84the probed version is '2c' which is correct in this case and
85the snmp_mod_walk() function is called because of the presence of
86Net::SNMP it handles the request and returns a hash of results.
87If the module is not availible to the function it would have handed
88out the control to snmp_sys_walk(), which does the query by calling
89apropiate system commands.
90 
91--------------------------
92snmp_walk() and snmp_get()
93--------------------------
94 
95These two functions are the core of the HotSaNICsnmp.pm from
96the modules point of view. Their synopsis is:
97 
98$res = snmp_walk($host, $community, @oids)
99$res = snmp_get($host, community, @oids)
100 
101$res is in both cases a reference to a hash which contains the result in
102the form $res{$oid} = $value and the array argument @oids always contains
103a list of oids to query either with the (bulk)walk or the get mehtod.
104 
105I hope I documented the HotSaNICsnmp.pm good enough to make clear
106whats going on, so if you want more details on the functions you
107might want to look in there.
108 

Powered by WebSVN 2.2.1