Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Windows performance counters & VBS/WMI via SNMP
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next
 
Post new topic   Reply to topic    Cacti Forum Index -> Help: Windows Specific
Author Message
erwan.l
Cacti User


Joined: 22 Jan 2008
Posts: 72

PostPosted: Sat Aug 30, 2008 6:45 am    Post subject: Reply with quote

the zip file may have been corrupted.
i have re uploaded it (and also tested the dll on 2 computers).
re download it (sorry...).

http://erwan.l.free.fr/snmptools/snmptools2.zip

/Erwan
Back to top
viras



Joined: 24 Aug 2008
Posts: 16

PostPosted: Sat Aug 30, 2008 6:55 am    Post subject: Reply with quote

Yeeessss, all works perfectly Thanks, thanks, thanks!

Here that I have written in counters.ini:
[1.3.6.1.4.1.15.51.1.1]
type=string
counter=1
[1.3.6.1.4.1.15.51.1.2]
type=string
counter=2

[1.3.6.1.4.1.15.51.2.1]
type=string
counter=Total Sessions
[1.3.6.1.4.1.15.51.2.2]
type=string
counter=Active Sessions

[1.3.6.1.4.1.15.51.3.1]
counter=Terminal Services\Total Sessions
[1.3.6.1.4.1.15.51.3.2]
counter=Terminal Services\Active Sessions
Back to top
erwan.l
Cacti User


Joined: 22 Jan 2008
Posts: 72

PostPosted: Sat Aug 30, 2008 7:00 am    Post subject: Reply with quote

Glad I could help

Eventually, post your graphs and template for others to benefit from your work.

And, thanks a lot for your time & debugging : it does help a lot to improve that tool.

Regards,
Erwan.
Back to top
viras



Joined: 24 Aug 2008
Posts: 16

PostPosted: Sun Aug 31, 2008 12:27 am    Post subject: Reply with quote

Probably one more defect...
In your program SNMP v.2 protocol is not supported, only v.1 I on was pushed on this thought with the message in a forum: http://forums.cacti.net/viewtopic.php?t=27666
Having looked in an initial code cacti (the file snmp.php) can be found such fragment:
if ($version == "1") {
$temp_array = @snmprealwalk("$hostname:$port", "$community", "$oid", ($timeout * 1000), $retries);
}elseif ($version == "2") {
$temp_array = @snmp2_real_walk("$hostname:$port", "$community", "$oid", ($timeout * 1000), $retries);
}else{

And so if version 1 all works, and at version 2 $temp_array it is empty.
Back to top
erwan.l
Cacti User


Joined: 22 Jan 2008
Posts: 72

PostPosted: Sun Aug 31, 2008 4:48 am    Post subject: Reply with quote

Hello Viras,
The SNMP agent, hosted by the MS SNMP service, actually does not deal with the snmp version.

Whatsmore, the snmpwalk command line currently works with both version :
snmpwalk -v 2c -c public 127.0.0.1 1.3.6.1.4.1.15
or
snmpwalk -v 1 -c public 127.0.0.1 1.3.6.1.4.1.15
Both work and return the same value.

Reading the post you are mentionning, I suspect an issue at the cacti level (or one of its component).

Still, I'll do extensive check to exclude any error within snmptools.
Basically, if the request fails but you see 'SnmpExtensionQuery' in the log file, then it is an snmptools bug.
If the request fails and you dont see 'SnmpExtensionQuery', then its an issue at the snmp service or within cacti.


Last edited by erwan.l on Sun Aug 31, 2008 5:51 am; edited 1 time in total
Back to top
erwan.l
Cacti User


Joined: 22 Jan 2008
Posts: 72

PostPosted: Sun Aug 31, 2008 5:38 am    Post subject: Reply with quote

version 2.0.0.3 released.
http://erwan.l.free.fr/snmptools/snmptools2.zip

In previous versions, the dll was exporting these 2 functions :
SnmpExtensioninit (when the agent is loaded by the snmp service)
SnmpExtensionQuery (when the agent is receiving a request)

SnmpExtensionQuery only support snmp v1 type : get, getnext and set.

I have now added a 3rd exported function :
SnmpExtensionQueryEx which will support other v2 types (get, getnext, settest, setundo, setcommit, setcleanup).

details here : http://msdn.microsoft.com/en-us/library/aa378022(VS.85).aspx .

The agent still support only get & getnext requests but at least it will accept other types, and will also log it eventually.

I dont believe this is linked to the issue with snmp v2 from cacti (since simple v2 types were supported from the command line) but at least the code is cleaner

Regards,
Erwan.
Back to top
viras



Joined: 24 Aug 2008
Posts: 16

PostPosted: Sun Aug 31, 2008 8:45 am    Post subject: Reply with quote

All the same does not work.
That I did:
1. The menu "Devices"
2. Has chosen the server
3. Has at the very bottom pressed "Verbose Query"



conters.txt
 Description:
counters.ini

Download
 Filename:  conters.txt
 Filesize:  798 Bytes
 Downloaded:  46 Time(s)


log-v2.txt
 Description:
log-v2

Download
 Filename:  log-v2.txt
 Filesize:  42.67 KB
 Downloaded:  31 Time(s)


log-v1.txt
 Description:
log-v1

Download
 Filename:  log-v1.txt
 Filesize:  2.42 KB
 Downloaded:  28 Time(s)

Back to top
erwan.l
Cacti User


Joined: 22 Jan 2008
Posts: 72

PostPosted: Sun Aug 31, 2008 11:23 am    Post subject: Reply with quote

nice one Viras.
Indeed there was a bug when walking the oid's (the last oid was not handled correctly).

version 2.0.0.4 released.
http://erwan.l.free.fr/snmptools/snmptools2.zip

I was looking on a issue linked to snmp v1 or v2 where actually there was a bug in the logic.

Thanks for the debugging !

Regards,
Erwan.
Back to top
viras



Joined: 24 Aug 2008
Posts: 16

PostPosted: Sun Aug 31, 2008 1:03 pm    Post subject: Reply with quote

Thanks for the program!

Errors have disappeared, but version 2 does not work. Cacti here it is not guilty, as causes standard function snmp2_real_walk. A problem or in snmp service, or in your program.



log-v2.txt
 Description:
log-v2

Download
 Filename:  log-v2.txt
 Filesize:  7.17 KB
 Downloaded:  30 Time(s)

Back to top
erwan.l
Cacti User


Joined: 22 Jan 2008
Posts: 72

PostPosted: Sun Aug 31, 2008 2:43 pm    Post subject: Reply with quote

indeed, I cant use a dataquery in snmp v2 where it works fine in snmp v1.

in v2 i get
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.15.51.1'
+ No SNMP data returned

where in v1 i get
+ Executing SNMP walk for list of indexes @ '.1.3.6.1.4.1.15.51.1'
+ Located input field 'memIndex' [walk]

wierd thing is that snmpwalk works fine via the command line and the snmptools log looks identical in both cases:
snmpwalk -v 2c -c public 127.0.0.1 1.3.6.1.4.1.15.51.1
SNMPv2-SMI::enterprises.15.51.1.1 = INTEGER: 1
SNMPv2-SMI::enterprises.15.51.1.2 = INTEGER: 2

working on it.

/erwan
Back to top
viras



Joined: 24 Aug 2008
Posts: 16

PostPosted: Sun Aug 31, 2008 11:28 pm    Post subject: Reply with quote

Try to use snmpbulkwalk...
Back to top
viras



Joined: 24 Aug 2008
Posts: 16

PostPosted: Mon Sep 01, 2008 2:41 am    Post subject: Reply with quote

Here my first work server.


ts sessions.png
 Description:
Number of sessions
 Filesize:  24.18 KB
 Viewed:  953 Time(s)

ts sessions.png



ts cpu time.png
 Description:
CPU Time
 Filesize:  34.21 KB
 Viewed:  953 Time(s)

ts cpu time.png


Back to top
erwan.l
Cacti User


Joined: 22 Jan 2008
Posts: 72

PostPosted: Mon Sep 01, 2008 11:57 am    Post subject: Reply with quote

Very nice
I like what you did with the snmp query : did not know about this before.
I learned something

Need to fix that snmpv2 thing now.
snmpbulkwalk from the command line work fine as well.

I need to dig into cacti to see how the data is queryed.

Thanks,
Erwan
Back to top
viras



Joined: 24 Aug 2008
Posts: 16

PostPosted: Mon Sep 01, 2008 11:36 pm    Post subject: Reply with quote

/usr/local/share/cacti/lib/snmp.php
function cacti_snmp_walk
line 253-256

if ($version == "1") {
$temp_array = @snmprealwalk("$hostname:$port", "$community", "$oid", ($timeout * 1000), $retries);
}elseif ($version == "2") {
$temp_array = @snmp2_real_walk("$hostname:$port", "$community", "$oid", ($timeout * 1000), $retries);
}else{
Back to top
ky



Joined: 03 Sep 2008
Posts: 5

PostPosted: Wed Sep 03, 2008 2:24 pm    Post subject: Trouble w/64bit on Server 2003 SP2 Reply with quote

Erwan,

*Awesome* tool, once I get it working. Our environment is primarily 64bit (Server 2003 SP2) and I have done the following to get set up:

-Renamed snmptools64.dll to snmptools.dll, moved it to proper dir.
-Configured counters.ini
-Turned on debugging, imported reg file, restarted SNMP.

I am able to query 1.3.6.1.4.1.15 (snmptools by erwan.l@free.fr), I can query anything that defines type=string in counters.ini, but I am not able to get any data from the performance counters.

For these definitions:
[1.3.6.1.4.1.15.1]
counter=PhysicalDisk\Avg. Disk Queue Length\_Total
[1.3.6.1.4.1.15.6]
counter=Processor\% Processor Time

I get this in the log:
14:07:11:465 , SnmpExtensionQueryEx
14:07:11:465 , nRequestType=SNMP_EXTENSION_GET
14:07:11:465 , GetRequest: OID=1.3.6.1.4.1.15 (7)
14:07:11:465 , result=snmptools by erwan.l@free.fr asn_type=4
14:07:11:465 , GetRequest OK
14:15:30:029 , SnmpExtensionQueryEx
14:15:30:029 , nRequestType=SNMP_EXTENSION_GET
14:15:30:029 , GetRequest: OID=1.3.6.1.4.1.15.1 (
14:15:30:029 , path=PhysicalDisk\Avg. Disk Queue Length\_Total
14:15:30:029 , PhysicalDisk\Avg. Disk Queue Length\_Total
14:15:30:029 , makepathA : C0000BBD
14:15:30:029 , length(str_result)=0
14:15:30:029 , GetRequest Failed
14:20:54:316 , SnmpExtensionQueryEx
14:20:54:316 , nRequestType=SNMP_EXTENSION_GET
14:20:54:316 , GetRequest: OID=1.3.6.1.4.1.15.6 (
14:20:54:316 , path=Processor\% Processor Time
14:20:54:316 , Processor\% Processor Time\
14:20:54:316 , makepathA : C0000BBD
14:20:54:316 , length(str_result)=0
14:20:54:316 , GetRequest Failed

Any suggestions?

Thanks in advance, can't wait to get this going!
-Kyle
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Help: Windows Specific All times are GMT - 5 Hours
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8, 9  Next
Page 7 of 9

 



Powered by phpBB © 2001, 2005 phpBB Group