Help me please !!! snmp walk with regular expression

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Post Reply
pontiacy
Posts: 6
Joined: Tue May 24, 2011 12:03 am

Help me please !!! snmp walk with regular expression

Post by pontiacy »

how can get snmp with regular expression oid this pattern

.1.3.6.1.4.1.2352.2.4.1.4.1.3.18.1 = Gauge32: 36
.1.3.6.1.4.1.2352.2.4.1.4.1.3.31.1 = Gauge32: 35
.1.3.6.1.4.1.2352.2.4.1.4.1.3.36.1 = Gauge32: 35
.1.3.6.1.4.1.2352.2.4.1.4.1.3.49.1 = Gauge32: 18
.1.3.6.1.4.1.2352.2.4.1.4.1.3.50.1 = Gauge32: 33
.1.3.6.1.4.1.2352.2.4.1.4.1.3.59.1 = Gauge32: 36
.1.3.6.1.4.1.2352.2.4.1.4.1.3.62.1 = Gauge32: 36
.1.3.6.1.4.1.2352.2.4.1.4.1.3.75.1 = Gauge32: 34
.1.3.6.1.4.1.2352.2.4.1.4.1.3.78.1 = Gauge32: 18
.1.3.6.1.4.1.2352.2.4.1.4.1.3.79.1 = Gauge32: 34

this oid not have index in last number
I want a number in red return to index with <oid_index_parse>
Do you have some regular expression for this problem ? ...
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Help me please !!! snmp walk with regular expression

Post by noname »

- HowTo: Data Query Templates
See "SNMP Index is a STRING" + "SNMP Index does not exist"

Your case is like as 1 character instead of string.
pontiacy
Posts: 6
Joined: Tue May 24, 2011 12:03 am

Re: Help me please !!! snmp walk with regular expression

Post by pontiacy »

Yes same your case but in example it's return index is "1"
I want a number in red before last number ...
I think it's must must modify this line
<oid_index_parse>OID/REGEXP:.*\([0-9]{1,3})$</oid_index_parse>
I try to modify but not return an index same a red number ..
Can you help me please ?
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Help me please !!! snmp walk with regular expression

Post by noname »

For example:

Code: Select all

<interface>
        <name>Sample</name>
        <description>Sample Query</description>
        <oid_index>.1.3.6.1.4.1.2352.2.4.1.4.1.3</oid_index>
        <oid_index_parse>OID/REGEXP:.*\.([0-9]{1,2})\.1$</oid_index_parse>
        <index_order>Index</index_order>
        <index_order_type>numeric</index_order_type>
        <index_title_format>|chosen_order_field|</index_title_format>

        <fields>
                <Index>
                        <name>Index</name>
                        <source>index</source>
                        <direction>input</direction>
                </Index>
                <TestValue>
                        <name>Test Value</name>
                        <method>walk</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.2352.2.4.1.4.1.3</oid>
                </TestValue>
        </fields>
</interface>
If there is not only ".1" but also exists other number (".2" or ".3" or ...) in the last of OID,
try using <oid_suffix> as follows:

Code: Select all

                <TestValue>
                        <name>Test Value</name>
                        <method>get</method>
                        <source>value</source>
                        <direction>output</direction>
                        <oid>.1.3.6.1.4.1.2352.2.4.1.4.1.3</oid>
                        <oid_suffix>1</oid_suffix>
                </TestValue>
EDIT: Sorry, I made a mistake.. "<direction> ~ </direction>" for TestValue should be "output". (corrected)
pontiacy
Posts: 6
Joined: Tue May 24, 2011 12:03 am

Re: Help me please !!! snmp walk with regular expression

Post by pontiacy »

I use this template

Code: Select all

<interface>
  	<name>Get Card Temperature</name> 
  	<description>Query for list of Redback Card Temp sensors</description> 
  	<oid_index>.1.3.6.1.4.1.2352.2.4.1.4.1.3</oid_index> 
	<oid_index_parse>OID/REGEXP:.*\.([0-9]{1,2})\.1$</oid_index_parse>
  	<index_order>TempIndex</index_order> 
 	<index_order_type>numeric</index_order_type> 
  	<index_title_format>|chosen_order_field|</index_title_format> 
	<fields>
		<TempIndex>
			<name>Index</name>
			<source>index</source>
			<direction>input</direction>
		</TempIndex>
		<TempSensorsCard>
  			<name>Card</name> 
  			<method>walk</method> 
 			<source>value</source> 
  			<direction>output</direction> 
 			<oid>.1.3.6.1.4.1.2352.2.4.1.4.1.2</oid> 
			<oid_suffix>1</oid_suffix>
  		</TempSensorsCard>
		<TempSensorsValue>
  			<name>Celsius</name> 
  			<method>walk</method> 
  			<source>value</source> 
  			<direction>output</direction> 
  			<oid>.1.3.6.1.4.1.2352.2.4.1.4.1.3</oid> 
			<oid_suffix>1</oid_suffix>
  		</TempSensorsValue>
  	</fields>
</interface>
but output same this

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/redback_temp.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.2352.2.4.1.4.1.3'
+ No SNMP data returned
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/redback_temp.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/redback_temp.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/redback_temp.xml'
snmpwalk output

Code: Select all

snmpwalk -v 2c -c testro 172.0.0.1 -On .1.3.6.1.4.1.2352.2.4.1.4.1.3
.1.3.6.1.4.1.2352.2.4.1.4.1.3.18.1 = Gauge32: 36
.1.3.6.1.4.1.2352.2.4.1.4.1.3.31.1 = Gauge32: 35
.1.3.6.1.4.1.2352.2.4.1.4.1.3.36.1 = Gauge32: 35
.1.3.6.1.4.1.2352.2.4.1.4.1.3.49.1 = Gauge32: 18
.1.3.6.1.4.1.2352.2.4.1.4.1.3.50.1 = Gauge32: 33
.1.3.6.1.4.1.2352.2.4.1.4.1.3.59.1 = Gauge32: 36
.1.3.6.1.4.1.2352.2.4.1.4.1.3.62.1 = Gauge32: 35
.1.3.6.1.4.1.2352.2.4.1.4.1.3.75.1 = Gauge32: 33
.1.3.6.1.4.1.2352.2.4.1.4.1.3.78.1 = Gauge32: 18
.1.3.6.1.4.1.2352.2.4.1.4.1.3.79.1 = Gauge32: 34
can you help me solve this problem ..?
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Help me please !!! snmp walk with regular expression

Post by noname »

Code: Select all

+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.2352.2.4.1.4.1.3'
+ No SNMP data returned
Cacti failed to retrieve data from the device via SNMP.
Please check SNMP settings for that device in Cacti GUI.
pontiacy
Posts: 6
Joined: Tue May 24, 2011 12:03 am

Re: Help me please !!! snmp walk with regular expression

Post by pontiacy »

when i change <oid_index> and <oid_index_parse> in same host

Code: Select all

<interface>
  	<name>Get Card Temperature</name> 
  	<description>Query for list of Redback Card Temp sensors</description> 
  	<oid_index>.1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0<oid_index> 
	<oid_index_parse>OID/REGEXP:.*\.([0-9]{1,5})$</oid_index_parse>
  	<index_order>TempIndex</index_order> 
 	<index_order_type>numeric</index_order_type> 
  	<index_title_format>|chosen_order_field|</index_title_format> 
	<fields>
		<TempIndex>
			<name>Index</name>
			<source>index</source>
			<direction>input</direction>
		</TempIndex>
		<TempSensorsCard>
  			<name>Card</name> 
  			<method>walk</method> 
 			<source>value</source> 
  			<direction>output</direction> 
			<oid>.1.3.6.1.4.1.2352.2.4.1.4.1.2</oid> 
			<oid_suffix>1</oid_suffix>
  		</TempSensorsCard>
		<TempSensorsValue>
  			<name>Celsius</name> 
  			<method>walk</method> 
			<source>value</source> 
			<direction>output</direction> 
			<oid>.1.3.6.1.4.1.2352.2.4.1.4.1.3</oid> 
			<oid_suffix>1</oid_suffix>
  		</TempSensorsValue>
  	</fields>
</interface>
Result page here

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/redback_temp.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.33' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.34' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.37' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.38' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.39' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.40' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.41' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.42' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.43' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.44' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.45' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.47' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.48' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.50' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.51' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.52' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.53' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.64' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.77' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.78' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.79' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.80' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.86' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.87' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.101' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.111' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.140' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.157' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.201' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.202' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.203' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.204' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.205' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.206' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.400' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.500' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.501' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1000' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1001' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1002' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1007' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1008' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1009' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1010' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1011' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1012' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1013' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1014' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1015' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1016' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1017' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1018' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1019' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1020' value: '0'
+ Index found at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1081' value: '0'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.33' results: '33'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.34' results: '34'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.37' results: '37'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.38' results: '38'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.39' results: '39'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.40' results: '40'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.41' results: '41'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.42' results: '42'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.43' results: '43'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.44' results: '44'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.45' results: '45'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.47' results: '47'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.48' results: '48'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.50' results: '50'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.51' results: '51'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.52' results: '52'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.53' results: '53'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.64' results: '64'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.77' results: '77'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.78' results: '78'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.79' results: '79'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.80' results: '80'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.86' results: '86'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.87' results: '87'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.101' results: '101'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.111' results: '111'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.140' results: '140'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.157' results: '157'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.201' results: '201'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.202' results: '202'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.203' results: '203'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.204' results: '204'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.205' results: '205'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.206' results: '206'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.400' results: '400'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.500' results: '500'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.501' results: '501'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1000' results: '1000'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1001' results: '1001'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1002' results: '1002'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1007' results: '1007'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1008' results: '1008'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1009' results: '1009'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1010' results: '1010'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1011' results: '1011'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1012' results: '1012'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1013' results: '1013'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1014' results: '1014'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1015' results: '1015'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1016' results: '1016'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1017' results: '1017'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1018' results: '1018'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1019' results: '1019'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1020' results: '1020'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.1081' results: '1081'
+ Inserting index data for field 'TempIndex' [value='33']
+ Inserting index data for field 'TempIndex' [value='34']
+ Inserting index data for field 'TempIndex' [value='37']
+ Inserting index data for field 'TempIndex' [value='38']
+ Inserting index data for field 'TempIndex' [value='39']
+ Inserting index data for field 'TempIndex' [value='40']
+ Inserting index data for field 'TempIndex' [value='41']
+ Inserting index data for field 'TempIndex' [value='42']
+ Inserting index data for field 'TempIndex' [value='43']
+ Inserting index data for field 'TempIndex' [value='44']
+ Inserting index data for field 'TempIndex' [value='45']
+ Inserting index data for field 'TempIndex' [value='47']
+ Inserting index data for field 'TempIndex' [value='48']
+ Inserting index data for field 'TempIndex' [value='50']
+ Inserting index data for field 'TempIndex' [value='51']
+ Inserting index data for field 'TempIndex' [value='52']
+ Inserting index data for field 'TempIndex' [value='53']
+ Inserting index data for field 'TempIndex' [value='64']
+ Inserting index data for field 'TempIndex' [value='77']
+ Inserting index data for field 'TempIndex' [value='78']
+ Inserting index data for field 'TempIndex' [value='79']
+ Inserting index data for field 'TempIndex' [value='80']
+ Inserting index data for field 'TempIndex' [value='86']
+ Inserting index data for field 'TempIndex' [value='87']
+ Inserting index data for field 'TempIndex' [value='101']
+ Inserting index data for field 'TempIndex' [value='111']
+ Inserting index data for field 'TempIndex' [value='140']
+ Inserting index data for field 'TempIndex' [value='157']
+ Inserting index data for field 'TempIndex' [value='201']
+ Inserting index data for field 'TempIndex' [value='202']
+ Inserting index data for field 'TempIndex' [value='203']
+ Inserting index data for field 'TempIndex' [value='204']
+ Inserting index data for field 'TempIndex' [value='205']
+ Inserting index data for field 'TempIndex' [value='206']
+ Inserting index data for field 'TempIndex' [value='400']
+ Inserting index data for field 'TempIndex' [value='500']
+ Inserting index data for field 'TempIndex' [value='501']
+ Inserting index data for field 'TempIndex' [value='1000']
+ Inserting index data for field 'TempIndex' [value='1001']
+ Inserting index data for field 'TempIndex' [value='1002']
+ Inserting index data for field 'TempIndex' [value='1007']
+ Inserting index data for field 'TempIndex' [value='1008']
+ Inserting index data for field 'TempIndex' [value='1009']
+ Inserting index data for field 'TempIndex' [value='1010']
+ Inserting index data for field 'TempIndex' [value='1011']
+ Inserting index data for field 'TempIndex' [value='1012']
+ Inserting index data for field 'TempIndex' [value='1013']
+ Inserting index data for field 'TempIndex' [value='1014']
+ Inserting index data for field 'TempIndex' [value='1015']
+ Inserting index data for field 'TempIndex' [value='1016']
+ Inserting index data for field 'TempIndex' [value='1017']
+ Inserting index data for field 'TempIndex' [value='1018']
+ Inserting index data for field 'TempIndex' [value='1019']
+ Inserting index data for field 'TempIndex' [value='1020']
+ Inserting index data for field 'TempIndex' [value='1081']
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/redback_temp.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/redback_temp.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/redback_temp.xml'
I think some <oid_index_parse> not match it's return

Code: Select all

+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.2352.2.4.1.4.1.3'
+ No SNMP data returned
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Help me please !!! snmp walk with regular expression

Post by noname »

pontiacy wrote:when i change <oid_index> and <oid_index_parse> in same host

Code: Select all

...
<oid_index>.1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0<oid_index>
<oid_index_parse>OID/REGEXP:.*\.([0-9]{1,5})$</oid_index_parse>
...
The above REGEXP pattern will match to the part as this,
1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.33
not to this part.
1.3.6.1.4.1.2352.2.1.1.1.1.1.10137.0.33
Anyway, how about this simple XML?

Code: Select all

<interface>
     <name>Get Card Temperature</name>
     <description>Query for list of Redback Card Temp sensors</description>
     <oid_index>.1.3.6.1.4.1.2352.2.4.1.4.1.3</oid_index>
     <index_order>TempIndex</index_order>
     <index_order_type>numeric</index_order_type>
     <index_title_format>|chosen_order_field|</index_title_format>
     <fields>
       <TempIndex>
         <name>Index</name>
         <source>index</source>
         <direction>input</direction>
       </TempIndex>
     </fields>
</interface>
If Cacti can access that OID (.1.3.6.1.4.1.2352.2.4.1.4.1.3) properly,
maybe it will show the result like as follows..
XML file parsed ok.
Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.2352.2.4.1.4.1.3'
Index found at OID: '.1.3.6.1.4.1.2352.2.4.1.4.1.3.18.1' value: '36'
Index found at OID: '.1.3.6.1.4.1.2352.2.4.1.4.1.3.31.1' value: '35'
Index found at OID: '.1.3.6.1.4.1.2352.2.4.1.4.1.3.36.1' value: '35'
Index found at OID: '.1.3.6.1.4.1.2352.2.4.1.4.1.3.49.1' value: '18'
Index found at OID: '.1.3.6.1.4.1.2352.2.4.1.4.1.3.50.1' value: '33'
Index found at OID: '.1.3.6.1.4.1.2352.2.4.1.4.1.3.59.1' value: '36'
Index found at OID: '.1.3.6.1.4.1.2352.2.4.1.4.1.3.62.1' value: '35'
Index found at OID: '.1.3.6.1.4.1.2352.2.4.1.4.1.3.75.1' value: '33'
Index found at OID: '.1.3.6.1.4.1.2352.2.4.1.4.1.3.78.1' value: '18'
Index found at OID: '.1.3.6.1.4.1.2352.2.4.1.4.1.3.79.1' value: '34'
Inserting index data for field 'TempIndex' [value='36']
Inserting index data for field 'TempIndex' [value='35']
Inserting index data for field 'TempIndex' [value='35']
Inserting index data for field 'TempIndex' [value='18']
Inserting index data for field 'TempIndex' [value='33']
Inserting index data for field 'TempIndex' [value='36']
Inserting index data for field 'TempIndex' [value='35']
Inserting index data for field 'TempIndex' [value='33']
Inserting index data for field 'TempIndex' [value='18']
Inserting index data for field 'TempIndex' [value='34']
pontiacy
Posts: 6
Joined: Tue May 24, 2011 12:03 am

Re: Help me please !!! snmp walk with regular expression

Post by pontiacy »

I use your code

Code: Select all

<interface>
     <name>Get Card Temperature</name>
     <description>Query for list of Redback Card Temp sensors</description>
     <oid_index>.1.3.6.1.4.1.2352.2.4.1.4.1.3</oid_index>
     <index_order>TempIndex</index_order>
     <index_order_type>numeric</index_order_type>
     <index_title_format>|chosen_order_field|</index_title_format>
     <fields>
       <TempIndex>
         <name>Index</name>
         <source>index</source>
         <direction>input</direction>
       </TempIndex>
     </fields>
</interface>
Result

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/redback_temp.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.2352.2.4.1.4.1.3'
+ No SNMP data returned
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/redback_temp.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/redback_temp.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/redback_temp.xml'
adn I check with full oid .1.3.6.1.4.1.2352.2.4.1.4.1.3.18.1
it's return

Code: Select all

+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.2352.2.4.1.4.1.3.18.1'
+ No SNMP data returned
same you ask. my snmp host not return any data to cacti server but snmp not error

Code: Select all

SNMP Information
System:Redback Networks SmartEdge OS Version SEOS-5.0.7.10p16-Release Built
by sysbuild@lx-dev2 Thu Apr 23 10:23:22 PDT 2009 Copyright (C)
1998-2009, Redback Networks Inc. All rights reserved.
Uptime: 131591223 (15 days, 5 hours, 31 minutes)
Hostname: TEST
Location: TEST
Contact: TEST
Can you suggest me for this problem ?
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Help me please !!! snmp walk with regular expression

Post by noname »

Sorry, I have no idea any more..

Could you show me again the output of snmpwalk to the OID (.1.3.6.1.4.1.2352.2.4.1.4.1.3) when performed as poller user (e.g. cactiuser)?
pontiacy
Posts: 6
Joined: Tue May 24, 2011 12:03 am

Re: Help me please !!! snmp walk with regular expression

Post by pontiacy »

Oh it's success

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/redback_temp.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.2352.2.4.1.4.1.3'
+ Index found at OID: '1.3.6.1.4.1.2352.2.4.1.4.1.3.18.1' value: '31'
+ Index found at OID: '1.3.6.1.4.1.2352.2.4.1.4.1.3.31.1' value: '31'
+ Index found at OID: '1.3.6.1.4.1.2352.2.4.1.4.1.3.36.1' value: '30'
+ Index found at OID: '1.3.6.1.4.1.2352.2.4.1.4.1.3.49.1' value: '14'
+ Index found at OID: '1.3.6.1.4.1.2352.2.4.1.4.1.3.50.1' value: '29'
+ Index found at OID: '1.3.6.1.4.1.2352.2.4.1.4.1.3.59.1' value: '32'
+ Index found at OID: '1.3.6.1.4.1.2352.2.4.1.4.1.3.62.1' value: '31'
+ Index found at OID: '1.3.6.1.4.1.2352.2.4.1.4.1.3.75.1' value: '29'
+ Index found at OID: '1.3.6.1.4.1.2352.2.4.1.4.1.3.78.1' value: '18'
+ Index found at OID: '1.3.6.1.4.1.2352.2.4.1.4.1.3.79.1' value: '30'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.4.1.4.1.3.18.1' results: '18'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.4.1.4.1.3.31.1' results: '31'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.4.1.4.1.3.36.1' results: '36'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.4.1.4.1.3.49.1' results: '49'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.4.1.4.1.3.50.1' results: '50'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.4.1.4.1.3.59.1' results: '59'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.4.1.4.1.3.62.1' results: '62'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.4.1.4.1.3.75.1' results: '75'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.4.1.4.1.3.78.1' results: '78'
+ index_parse at OID: '1.3.6.1.4.1.2352.2.4.1.4.1.3.79.1' results: '79'
+ Inserting index data for field 'TempIndex' [value='18']
+ Inserting index data for field 'TempIndex' [value='31']
+ Inserting index data for field 'TempIndex' [value='36']
+ Inserting index data for field 'TempIndex' [value='49']
+ Inserting index data for field 'TempIndex' [value='50']
+ Inserting index data for field 'TempIndex' [value='59']
+ Inserting index data for field 'TempIndex' [value='62']
+ Inserting index data for field 'TempIndex' [value='75']
+ Inserting index data for field 'TempIndex' [value='78']
+ Inserting index data for field 'TempIndex' [value='79']
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/redback_temp.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/redback_temp.xml'
+ Found data query XML file at '/var/www/html/cacti/resource/snmp_queries/redback_temp.xml'
I change snmp timeout parameter . I need to test output parameter then report you later .
thank you for your suggestion . :P
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests