Windows performance counters & VBS/WMI via SNMP

Post support questions that relate to the Windows 2003/2000/XP operating systems.

Moderators: Developers, Moderators

Post Reply
viras
Posts: 16
Joined: Sun Aug 24, 2008 4:21 am

Post by viras »

Good afternoon.

Help me to make please one picture consisting of two entrance data. Using your program to me it was possible to receive:
1.3.6.1.4.1.15.51.1.0.2 Terminal Services \\Total Sessions 1.3.6.1.4.1.15.51.2.0.2 Terminal Services \\Active Sessions
But at creation of a xml-file I had difficulties with a field an index.

xml:
<interface>
<name>Get TS Sessions Information</name>
<oid_index>.1.3.6.1.4.1.15.51</oid_index>
<oid_index_parse>OID/REGEXP:.*\.([0-9]*\.[0-9]*)$</oid_index_parse>
<oid_num_indexes>.1.3.6.1.4.1.15.51.2</oid_num_indexes>
<index_order>tsTotal:tsActive</index_order>
<index_order_type>numeric</index_order_type>
<index_title_format>|chosen_order_field|</index_title_format>

<fields>
<tsIndex>
<name>Index</name>
<method>walk</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.15.51</oid>
</tsIndex>
<tsTotal>
<name>Total</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.15.51.1.0.2</oid>
</tsTotal>
<tsActive>
<name>Active</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.15.51.2.0.2</oid>
</tsActive>
<tsInactive>
<name>Inactive</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.15.51.3.0.2</oid>
</tsInactive>
</fields>
</interface>


Data Query Debug Information:
+ Running data query [10].
+ Found type = '3' [snmp query].
+ Found data query XML file at '/usr/local/share/cacti/resource/snmp_queries/ts_sessions.xml'
+ XML file parsed ok.
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.15.51'
+ Located input field 'tsIndex' [walk]
+ Executing SNMP walk for data @ '.1.3.6.1.4.1.15.51'
+ Found item [tsIndex='0'] index: 51.0 [from value]
+ Found item [tsIndex='Terminal Services'] index: 51.1 [from value]
+ Found item [tsIndex='3'] index: 51.2 [from value]
+ Found item [tsIndex='-1'] index: 51.3 [from value]
+ Found data query XML file at '/usr/local/share/cacti/resource/snmp_queries/ts_sessions.xml'
+ Found data query XML file at '/usr/local/share/cacti/resource/snmp_queries/ts_sessions.xml'
+ Found data query XML file at '/usr/local/share/cacti/resource/snmp_queries/ts_sessions.xml'
erwan.l
Cacti User
Posts: 138
Joined: Tue Jan 22, 2008 4:36 am
Contact:

Post by erwan.l »

Hello,
I am not familiar with this way of adding graphs in cacti.
I myself usually do a data template (based on generic oid template), then a graph template for that data template.

At that point, I simply have to add a graph template for any host and it up it goes.

I feel that the issue is with snmp walk as my snmptool is not very good at it.

May be if you tell me what oid should give what output, I might make it more compliant?

A log file will help as well.

Regards,
Erwan.
viras
Posts: 16
Joined: Sun Aug 24, 2008 4:21 am

Post by viras »

The field "index" and the field "name" is necessary. And "name" can be received the list using "index"

Like:
snmpwalk -c public -v 1 192.168.1.24 .1.3.6.1.4.1.2021.2.1
UCD-SNMP-MIB::prIndex.1 = INTEGER: 1
UCD-SNMP-MIB::prIndex.2 = INTEGER: 2
UCD-SNMP-MIB::prIndex.3 = INTEGER: 3
UCD-SNMP-MIB::prNames.1 = STRING: sendmail
UCD-SNMP-MIB::prNames.2 = STRING: httpd
UCD-SNMP-MIB::prNames.3 = STRING: cron
UCD-SNMP-MIB::prMin.1 = INTEGER: 0
UCD-SNMP-MIB::prMin.2 = INTEGER: 1
UCD-SNMP-MIB::prMin.3 = INTEGER: 1
UCD-SNMP-MIB::prMax.1 = INTEGER: 0
UCD-SNMP-MIB::prMax.2 = INTEGER: 10
UCD-SNMP-MIB::prMax.3 = INTEGER: 10
UCD-SNMP-MIB::prCount.1 = INTEGER: 2
UCD-SNMP-MIB::prCount.2 = INTEGER: 128
UCD-SNMP-MIB::prCount.3 = INTEGER: 0

In this example of processes - 3 pieces. At everyone the index. For example prIndex.1 corresponds to process sendmail, and has number 1. As prIndex.2 corresponds to process httpd, and has number 2. prIndex.3 corresponds to process cron, and has number 3 accordingly. What useful it is possible to see? The minimum and maximum values of these processes (prMin and prMax), well and the most important thing that is necessary to us - current quantity of the started processes: prCount. That is we see that quantity httpd now equally 128, quantity sendmail - 2, and quantity cron - 0. It to us also should be described in xml-e. We come in /resource/snmp_queries and we create new XML which will describe structure of the data:

<interface>
<name>Get prosesses</name>
<oid_index>.1.3.6.1.4.1.2021.2.1.1</oid_index>
<index_order>prNames:prIndex</index_order>
<index_order_type>numeric</index_order_type>
<index_title_format>|chosen_order_field|</index_title_format>
<fields>
<prIndex>
<name>Index</name>
<method>walk</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.2021.2.1.1</oid>
</prIndex>
<prNames>
<name>Name</name>
<method>walk</method>
<source>value</source>
<direction>input</direction>
<oid>.1.3.6.1.4.1.2021.2.1.2</oid>
</prNames>
<prCount>
<name>Count</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.2021.2.1.5</oid>
</prCount>
</fields>
</interface>

Here
* name - a name of structure (any)
* oid_index - oid on which the list of indexes (in ours their cases is allocated will be 3 pieces)
* prIndex, prNames, prCount is already data structures. Names for them any. I have named them just as they are written on MIB.
Here we will stop on more detailed:
<prIndex> - - the parametre name
<name> Index </name> - - Its mapping
<method> walk </method> - - Method of reception
<source> value </source> - - Type
<direction> input </direction> - - Direction
<oid>.1.3.6.1.4.1.2021.2.1.1 </oid> is simple - - Oid on which it it is possible to receive
</prIndex>

direction (direction) is a data type for the schedule. It can be either input or output. input - input data (a name of process or it index) on which schedules will differ, and output - output data of schedules, that is that data which will be drawn on the schedule for this or that process.
erwan.l
Cacti User
Posts: 138
Joined: Tue Jan 22, 2008 4:36 am
Contact:

Post by erwan.l »

Hello,
Oki I see : with these explanations I shall be able to adapt snmptools in the right way.

I'll come with an update very soon.

In the meantime, I suggest you use a counters.ini file along with snmptools so that you can define you own OID's.
You might even be able to shape the oid's as cacti is expecting them.

More explanations here : http://erwan.l.free.fr/snmptools.

Regards,
Erwan.
viras
Posts: 16
Joined: Sun Aug 24, 2008 4:21 am

Post by viras »

Perfectly! I will better wait :)
lacteolus
Posts: 12
Joined: Tue Jul 15, 2008 2:55 am

Post by lacteolus »

Hi, erwan.l
I get one more problem. It's about Windows Server 2008. I have such box and when I try to use your tool I get stopping SNMP service. And I find "The SNMP Service service terminated unexpectedly" (Event ID 7034) error in Event Log. Did you test it in this OS? What do you think?
Best regards
erwan.l
Cacti User
Posts: 138
Joined: Tue Jan 22, 2008 4:36 am
Contact:

Post by erwan.l »

Hi Lacteolus,
A new challenge : windows 2008 :)
I should be able to make a virtual image tomorrow and test it there.
Any logfile you may be able to share already to guess where the issue is?

Also, I should release a version 2 soon.
It will use native api's for performance counters and therefore should be more cross platform compatible.
It will run on win64.
It will support fully snmpwalk. (this will address viras issue - see earlier post)
It will only run with a counters.ini file (much much easier than having to guess your oid!).

Regards,
Erwan.
Last edited by erwan.l on Fri Aug 29, 2008 1:42 pm, edited 1 time in total.
erwan.l
Cacti User
Posts: 138
Joined: Tue Jan 22, 2008 4:36 am
Contact:

Post by erwan.l »

Hello,

Version 2 is available here : http://erwan.l.free.fr/snmptools/ .

Here are the latest main changes:
switched to native pdh api for cross platform compatibility (64bits included)
works only with a counters.ini file now
counters are formatted now by default
better memory mgmt
snmp getnext support
flag=raw under counter section will return raw instead of formatted counter

Regars,
Erwan.
viras
Posts: 16
Joined: Sun Aug 24, 2008 4:21 am

Post by viras »

In a file counters.ini:
[1.3.6.1.4.1.15.4]
counter=Terminal Services\Total Sessions

In a file log.txt:
13:04:09:957, SnmpExtensionQuery
13:04:09:957, PduType=SNMP_PDU_GETNEXT
13:04:09:957, GetNextRequest:1.3.6.1.4.1.15.3 (8)
13:04:09:972, path=Terminal Services\Total Sessions
13:04:09:972, makepathA: C0000BBD
13:04:09:972, result = length=0 idlength=8
13:04:09:972, length (str_result) =0

Why correct value does not stand out?
erwan.l
Cacti User
Posts: 138
Joined: Tue Jan 22, 2008 4:36 am
Contact:

Post by erwan.l »

uhm, for that particular object I do get the same error.
I am looking into it right now.

in the meantime, try this file and assert that the second oid is working.

[1.3.6.1.4.1.15.4]
counter=Terminal Services\Total Sessions

[1.3.6.1.4.1.15.5]
counter=Processor\% Processor Time\_Total

thanks,
erwan.
Last edited by erwan.l on Sat Aug 30, 2008 5:30 am, edited 1 time in total.
viras
Posts: 16
Joined: Sun Aug 24, 2008 4:21 am

Post by viras »

[1.3.6.1.4.1.15.1]
counter=LogicalDisk\Free Megabytes\_Total
[1.3.6.1.4.1.15.2]
type=string
counter=this is a test
[1.3.6.1.4.1.15.3]
type=exec
counter=cscript /nologo c:\sample.vbs
[1.3.6.1.4.1.15.4]
counter=Terminal Services\Total Sessions
[1.3.6.1.4.1.15.5]
counter=Processor\% Processor Time\_Total

Everything works, except for [1.3.6.1.4.1.15.4]
erwan.l
Cacti User
Posts: 138
Joined: Tue Jan 22, 2008 4:36 am
Contact:

Post by erwan.l »

bug with counters and no instances fixed in v2.0.0.2.

download it again and you should get the right value for Terminal Services\Total Sessions .

hopefully, you should now be able to shape your ini file to address the index & name post above.

Regards,
Erwan.
viras
Posts: 16
Joined: Sun Aug 24, 2008 4:21 am

Post by viras »

Where I can find the new version? On a site http://erwan.l.free.fr/snmptools/ only 2.0.0.1
erwan.l
Cacti User
Posts: 138
Joined: Tue Jan 22, 2008 4:36 am
Contact:

Post by erwan.l »

http://erwan.labalec.fr/snmptools/snmptools2.zip .

I have not yet updated the html page but the zip is new.

/Erwan

edit : html page updated
Last edited by erwan.l on Wed Apr 11, 2012 10:59 am, edited 1 time in total.
viras
Posts: 16
Joined: Sun Aug 24, 2008 4:21 am

Post by viras »

Error in the event viewer:
Source: SNMP
Evend ID: 1102
Description: The SNMP Service is ignoring extension agent dll C:\WINDOWS\system32\snmptools.dll because it is missing or misconfigured.

Source: EvntAgnt
Event ID: 2020
Description: SNMP Event Log Extension Agent has terminated.

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.

P.S. Log file is empty.
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests