I want to use Cacti to graph stats of my databases tables. I think the simpliest way is to use a Data Query... so I made some perl scripts returning requested values like the "interfaces" scheme :
Code: Select all
tree.index.1 = 1
tree.index.2 = 2
tree.name.1 = name1
tree.name.2 = name2
tree.value1 = 42
tree.value2 = 54
Code: Select all
SNMPv2-SMI::enterprises.x.2.3.4.3.1 = STRING: "1 hactdif 19 0 0 1"
SNMPv2-SMI::enterprises.x.2.3.4.3.2 = STRING: "2 hactdifd 6 0 0 1"
SNMPv2-SMI::enterprises.x.2.3.4.3.3 = STRING: "3 hadart 5 0 0 0"
SNMPv2-SMI::enterprises.x.2.3.4.3.4 = STRING: "4 hartrf 5 0 0 0"
SNMPv2-SMI::enterprises.x.2.3.4.3.5 = STRING: "5 hbr 61 0 0 44"
SNMPv2-SMI::enterprises.x.2.3.4.3.6 = STRING: "6 hbrd 92 0 0 86"
SNMPv2-SMI::enterprises.x.2.3.4.3.7 = STRING: "7 hbrdana 82 0 0 77"
SNMPv2-SMI::enterprises.x.2.3.4.3.8 = STRING: "8 hbrdd 124 0 0 119"
SNMPv2-SMI::enterprises.x.2.3.4.3.9 = STRING: "9 hbrrf 30 0 0 25"
SNMPv2-SMI::enterprises.x.2.3.4.3.10 = STRING: "10 hcmde 23 0 0 16"
SNMPv2-SMI::enterprises.x.2.3.4.3.11 = STRING: "11 hcmded 53 0 0 45"
SNMPv2-SMI::enterprises.x.2.3.4.3.12 = STRING: "12 hcmdedd 55 0 0 47"
SNMPv2-SMI::enterprises.x.2.3.4.3.13 = STRING: "13 hcmderf 10 0 0 5"
SNMPv2-SMI::enterprises.x.2.3.4.3.14 = STRING: "14 hcom 41 0 0 36"
SNMPv2-SMI::enterprises.x.2.3.4.3.15 = STRING: "15 hcriv 108 9 0 84"
With this XML file :
Code: Select all
<interface>
<name>Tables stats</name>
<description>Queries a host for a list of monitorable tables stats</description>
<oid_index>.1.3.6.1.4.1.x.2.3.4.3</oid_index>
<oid_num_indexes>.1.3.6.1.4.1.x.2.3.4.1.0</oid_num_indexes>
<index_order>pgIndex:pgName</index_order>
<index_order_type>numeric</index_order_type>
<index_title_format>|chosen_order_field|</index_title_format>
<fields>
<pgIndex>
<name>Index</name>
<method>walk</method>
<source>VALUE/REGEXP:^([0-9]*) .*$</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.x.2.3.4.3</oid>
</pgIndex>
<pgName>
<name>Table name</name>
<method>walk</method>
<source>VALUE/REGEXP:^[0-9]* ([^ ]*) .*$</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.x.2.3.4.3</oid>
</pgName>
<pgReads>
<name>Reads</name>
<method>walk</method>
<source>VALUE/REGEXP:^[0-9]* [^ ]* ([0-9]*) .*$</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.x.2.3.4.3</oid>
</pgReads>
<pgCreates>
<name>Creates</name>
<method>walk</method>
<source>VALUE/REGEXP:^[0-9]* [^ ]* [0-9]* ([0-9]*) .*$</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.x.2.3.4.3</oid>
</pgCreates>
<pgUpdates>
<name>Updates</name>
<method>walk</method>
<source>VALUE/REGEXP:^[0-9]* [^ ]* [0-9]* [0-9]* ([0-9]*) .*$</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.x.2.3.4.3</oid>
</pgUpdates>
<pgDeletes>
<name>Deletes</name>
<method>walk</method>
<source>VALUE/REGEXP:^[0-9]* [^ ]* [0-9]* [0-9]* [0-9]* ([0-9]*)$</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.x.2.3.4.3</oid>
</pgDeletes>
</fields>
</interface>
My query verbose is normal :
Code: Select all
+ Running data query [17].
+ Found type = '3' [snmp query].
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/progress_vif5_7.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.x.2.3.4.3'
+ Located input field 'pgIndex' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.x.2.3.4.3'
+ Found item [pgIndex='1'] index: 1 [from regexp value parse]
etc...
Code: Select all
+ Located input field 'pgName' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.x.2.3.4.3'
+ Found item [pgName='hactdif'] index: 1 [from regexp value parse]
etc...
Code: Select all
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/progress.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/progress.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/progress.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/progress.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/progress.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/progress.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/progress.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/progress.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/progress.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/progress.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/progress.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/progress.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/progress.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/progress.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/progress.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/progress.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/progress.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/progress.xml'
Code: Select all
01/31/2006 10:37:31 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/rrdtool-1.2.12/bin/rrdtool update /var/www/html/cacti/r
ra/qualite_pgreads_302.rrd --template pgDeletes:pgUpdates:pgCreates:pgReads 1138700246:U:U:U:U
01/31/2006 10:37:31 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/rrdtool-1.2.12/bin/rrdtool update /var/www/html/cacti/r
ra/qualite_pgreads_307.rrd --template pgDeletes:pgUpdates:pgCreates:pgReads 1138700246:U:U:U:U
01/31/2006 10:37:31 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/rrdtool-1.2.12/bin/rrdtool update /var/www/html/cacti/r
ra/qualite_pgreads_306.rrd --template pgReads:pgDeletes:pgUpdates:pgCreates 1138700246:U:U:U:U
01/31/2006 10:37:31 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/rrdtool-1.2.12/bin/rrdtool update /var/www/html/cacti/r
ra/qualite_pgreads_305.rrd --template pgDeletes:pgUpdates:pgCreates:pgReads 1138700246:U:U:U:U
01/31/2006 10:37:31 AM - POLLER: Poller[0] CACTI2RRD: /usr/local/rrdtool-1.2.12/bin/rrdtool update /var/www/html/cacti/r
ra/qualite_pgreads_304.rrd --template pgDeletes:pgUpdates:pgCreates:pgReads 1138700246:U:U:U:U
I use :
Cacti : 0.8.6h
PHP : 5.0.4
MySQL : 4.1.16
And now I must use cmd.php due to this timeout error with cactid (0.8.6g) :
Code: Select all
CACTID: Host[7] DS[299] WARNING: SNMP timeout detected [500 ms], ignoring host 'qualite'
Code: Select all
*** buffer overflow detected ***: /usr/bin/cactid terminated
======= Backtrace: =========
/lib/libc.so.6(__chk_fail+0x41)[0x3c9c45]
/lib/libc.so.6(__vsprintf_chk+0x0)[0x3c9510]
/lib/libc.so.6(_IO_default_xsputn+0x97)[0x34c858]
/lib/libc.so.6(_IO_vfprintf+0x363f)[0x32a141]
/lib/libc.so.6(__vsprintf_chk+0xa1)[0x3c95b1]
/usr/bin/cactid[0x804bb6b]
/usr/bin/cactid[0x804a00b]
/usr/bin/cactid[0x804fab4]
/usr/bin/cactid[0x80502f5]
/lib/libpthread.so.0[0x45eb80]
/lib/libc.so.6(__clone+0x5e)[0x3b69ce]
Thanks.