lost and found ( for me ? )

cacti : create a custom template for SNMP monitoring ( SNMP Data Query )

Here’s an example of how to create a custom template to monitor the remote box’s storage info.

just referred to http://docs.cacti.net/manual:088:3a_advanced_topics.3b_snmp_data_query_walkthrough#snmp_data_query_walkthrough
http://forums.cacti.net/viewtopic.php?t=11647

I am not familiar with cacti. just follow the instructions.

many thanks!

cacti ( ubuntu ) – node ( centos )

[ on the cacti box ]

root@ubuntu12-04-vm4:/etc# apt-cache policy cacti
cacti:
 Installed: 0.8.7i-2ubuntu1
 Candidate: 0.8.7i-2ubuntu1
 Version table:
*** 0.8.7i-2ubuntu1 0
       500 http://jp.archive.ubuntu.com/ubuntu/ precise/universe amd64 Packages
       100 /var/lib/dpkg/status


retrieve hdStorageTable
# snmptable -c public -v 2c 192.168.10.223 HOST-RESOURCES-MIB::hrStorageTable
SNMP table: HOST-RESOURCES-MIB::hrStorageTable

hrStorageIndex                        hrStorageType  hrStorageDescr hrStorageAllocationUnits hrStorageSize hrStorageUsed hrStorageAllocationFailures
             1 HOST-RESOURCES-MIB::hrStorageTypes.2 Physical memory               1024 Bytes       1020588        180320                           ?
             3 HOST-RESOURCES-MIB::hrStorageTypes.3  Virtual memory               1024 Bytes       3117732        180320                           ?
             6 HOST-RESOURCES-MIB::hrStorageTypes.1  Memory buffers               1024 Bytes       1020588          9204                           ?
             7 HOST-RESOURCES-MIB::hrStorageTypes.1   Cached memory               1024 Bytes        104948        104948                           ?
            10 HOST-RESOURCES-MIB::hrStorageTypes.3      Swap space               1024 Bytes       2097144             0                           ?
            31 HOST-RESOURCES-MIB::hrStorageTypes.4               /               4096 Bytes       4644287        619762                           ?
            35 HOST-RESOURCES-MIB::hrStorageTypes.4        /dev/shm               4096 Bytes        127573             0                           ?

# snmpwalk -c public -v 2c -On 192.168.10.223 HOST-RESOURCES-MIB::hrStorageTable|more
.1.3.6.1.2.1.25.2.3.1.1.1 = INTEGER: 1
.1.3.6.1.2.1.25.2.3.1.1.3 = INTEGER: 3
.1.3.6.1.2.1.25.2.3.1.1.6 = INTEGER: 6
.1.3.6.1.2.1.25.2.3.1.1.7 = INTEGER: 7
.1.3.6.1.2.1.25.2.3.1.1.10 = INTEGER: 10
.1.3.6.1.2.1.25.2.3.1.1.31 = INTEGER: 31
.1.3.6.1.2.1.25.2.3.1.1.35 = INTEGER: 35
.1.3.6.1.2.1.25.2.3.1.2.1 = OID: .1.3.6.1.2.1.25.2.1.2
.1.3.6.1.2.1.25.2.3.1.2.3 = OID: .1.3.6.1.2.1.25.2.1.3


Index Base is .1.3.6.1.2.1.25.2.3.1.1.

create xml file.
on the cacti box , go to <path to cacti>/resource/snmp_queries directory
root@ubuntu12-04-vm4:~# cd /usr/share/cacti/resource/snmp_queries
root@ubuntu12-04-vm4:/usr/share/cacti/resource/snmp_queries#

root@ubuntu12-04-vm4:/usr/share/cacti/resource/snmp_queries# cat hrStorageTable.xml
<interface>
       <name>Get hrStoragedTable Information</name>
       <description>Get SNMP based Partition Information out of hrStorageTable</description>
       <index_order>hrStorageDescr:hrStorageIndex</index_order>
       <index_order_type>numeric</index_order_type>
       <oid_index>.1.3.6.1.2.1.25.2.3.1.1</oid_index>

       <fields>
               <hrStorageIndex>
                       <name>Index</name>
                       <method>walk</method>
                       <source>value</source>
                       <direction>input</direction>
                       <oid>.1.3.6.1.2.1.25.2.3.1.1</oid>
               </hrStorageIndex>
       </fields>
</interface>


on the cacti GUI , go to Data Queries ( GUI -> console -> collection methods -> Data Queries )


click Add and register “hrStorageTable.xml”



go to the device and add “SNMP – hrStoragedTable”

click “Verbose Query”
nnn error.



edit xml ( delete “Index_order” )

# cat hrStorageTable.xml
<interface>
       <name>Get hrStoragedTable Information</name>
       <description>Get SNMP based Partition Information out of hrStorageTable</description>
       <index_order_type>numeric</index_order_type>
       <oid_index>.1.3.6.1.2.1.25.2.3.1.1</oid_index>

       <fields>
               <hrStorageIndex>
                       <name>Index</name>
                       <method>walk</method>
                       <source>value</source>
                       <direction>input</direction>
                       <oid>.1.3.6.1.2.1.25.2.3.1.1</oid>
               </hrStorageIndex>
       </fields>
</interface>


Okay.



let’s add storage description
edit xml file

# cat hrStorageTable.xml
<interface>
  <name>Get hrStoragedTable Information</name>
  <description>Get SNMP based Partition Information out of hrStorageTable</description>
  <index_order_type>numeric</index_order_type>
  <oid_index>.1.3.6.1.2.1.25.2.3.1.1</oid_index>

  <fields>
     <hrStorageIndex>
        <name>Index</name>
        <method>walk</method>
        <source>value</source>
        <direction>input</direction>
        <oid>.1.3.6.1.2.1.25.2.3.1.1</oid>
     </hrStorageIndex>
     <hrStorageType>
        <name>Type</name>
        <method>walk</method>
        <source>value</source>
        <direction>input</direction>
        <oid>.1.3.6.1.2.1.25.2.3.1.2</oid>
     </hrStorageType>
     <hrStorageDescr>
        <name>Description</name>
        <method>walk</method>
        <source>value</source>
        <direction>input</direction>
        <oid>.1.3.6.1.2.1.25.2.3.1.3</oid>
     </hrStorageDescr>
     <hrStorageAllocationUnits>
        <name>Allocation Units (Bytes)</name>
        <method>walk</method>
        <source>value</source>
        <direction>input</direction>
        <oid>.1.3.6.1.2.1.25.2.3.1.4</oid>
     </hrStorageAllocationUnits>
  </fields>
</interface>



go to “create graphs for this host”




edit the xml to get output.

# cat hrStorageTable.xml
<interface>
  <name>Get hrStoragedTable Information</name>
  <description>Get SNMP based Partition Information out of hrStorageTable</description>
  <index_order_type>numeric</index_order_type>
  <oid_index>.1.3.6.1.2.1.25.2.3.1.1</oid_index>

  <fields>
     <hrStorageIndex>
        <name>Index</name>
        <method>walk</method>
        <source>value</source>
        <direction>input</direction>
        <oid>.1.3.6.1.2.1.25.2.3.1.1</oid>
     </hrStorageIndex>
     <hrStorageDescr>
        <name>Description</name>
        <method>walk</method>
        <source>value</source>
        <direction>input</direction>
        <oid>.1.3.6.1.2.1.25.2.3.1.3</oid>
     </hrStorageDescr>
     <hrStorageAllocationUnits>
        <name>Allocation Units (Bytes)</name>
        <method>walk</method>
        <source>value</source>
        <direction>input</direction>
        <oid>.1.3.6.1.2.1.25.2.3.1.4</oid>
     </hrStorageAllocationUnits>
     <hrStorageSize>
        <name>Total Size (Units)</name>
        <method>walk</method>
        <source>value</source>
        <direction>output</direction>
        <oid>.1.3.6.1.2.1.25.2.3.1.5</oid>
     </hrStorageSize>
     <hrStorageUsed>
        <name>Used Space (Units)</name>
        <method>walk</method>
        <source>value</source>
        <direction>output</direction>
        <oid>.1.3.6.1.2.1.25.2.3.1.6</oid>
     </hrStorageUsed>
  </fields>
</interface>


define the data template

go to “data template”
click Add







add data source “hrStorageUsed” as well.

click “save”

define the graph template
Templates -> Graph templates
click “create”




click “add”









Data Queries -> SNMP – hrStoragedtable


check “hrStorageSize” and “hrStorageUsed”

create graphs for this host





graph




nnn , it’s difficult for me to define custom templates..

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.