Monitor Windows via WMI from Cacti on Linux

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

Moderators: Developers, Moderators

Post Reply
argon0
Cacti User
Posts: 460
Joined: Fri Mar 12, 2004 1:22 pm

Post by argon0 »

really? I must look into that then. If so it would solve all the WMI problems...
No longer a n00by, probably, by now an 0ldby

Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
st3rling
Posts: 20
Joined: Thu Mar 16, 2006 12:17 pm

Post by st3rling »

argon0 wrote:Pretty sure that's the old version. I've upgraded mine - but it took compiling to get it to work.
Argon0
claymen wrote:Here is a tar/bz2/zip (due to the forum not liking bz2...) of the latest wmi-client source code.
Thank you guys for your replies. I really am new to the whole Linux scene... Do you by any chance know where I can find some sort of guide how to compile things in Centos? Thank you.
argon0
Cacti User
Posts: 460
Joined: Fri Mar 12, 2004 1:22 pm

Post by argon0 »

<erm> I think I posted what I did above....

Although make sure you back everything up (make copies) before you do anything - I have to admit to using Webmin to do most file operations...
No longer a n00by, probably, by now an 0ldby

Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
Thomas.Pacce
Posts: 23
Joined: Wed Apr 15, 2009 5:19 am
Location: Amsterdam

Post by Thomas.Pacce »

Claymen, great job thanks for sharing.

I use all the scripts fine but the IIS will only display NAN.

Whenever i try the IIS scripts i get a time out error:
cacti# /usr/bin/php -q /usr/share/cacti/site/scripts/wmi.php -h '10.130.16.187' -u '/etc/cacti/cactiwmi.pw' -w 'Win32_PerfRawData_W3SVC_WebService' -n '' -k 'Name' -v '_Total' -c 'CurrentConnections,CurrentNonAnonymousUsers,CurrentAnonymousUsers,ConnectionAttemptsPersec,AnonymousUsersPersec,NonAnonymousUsersPersec,LogonAttemptsPersec'
NTSTATUS: NT_STATUS_IO_TIMEOUT - NT_STATUS_IO_TIMEOUT

cacti# /usr/bin/php -q /usr/share/cacti/site/scripts/wmi.php -h '10.130.16.187' -u '/etc/cacti/cactiwmi.pw' -w 'Win32_PerfRawData_W3SVC_WebService' -n '' -k 'Name' -v '_Total' -c 'CopyRequestsPersec,DeleteRequestsPersec,GetRequestsPersec,HeadRequestsPersec,LockRequestsPersec,MkcolRequestsPersec,MoveRequestsPersec,OptionsRequestsPersec,OtherRequestMethodsPersec,PostRequestsPersec,PropfindRequestsPersec,ProppatchRequestsPersec,PutRequestsPersec,SearchRequestsPersec,TraceRequestsPersec,UnlockRequestsPersec'
NTSTATUS: NT_STATUS_IO_TIMEOUT - NT_STATUS_IO_TIMEOUT

Any ideas?
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

That could be a bunch of issues.

Here are the main things to check
1. Log onto the box run scriptomatic and see if the WMI classes for IIS even exist (makes sure the counters are even there for wmi)
2. Try and query them make sure data comes back locally (makes sure the perf counters respond)
3. Test running the same query remotely (from another windows box) but running as your cacti.wmi credential (eliminates rpc firewalling and permission issues)
Thomas.Pacce
Posts: 23
Joined: Wed Apr 15, 2009 5:19 am
Location: Amsterdam

Post by Thomas.Pacce »

The WMI Classes exist.

I have ran scriptomatic from the monitored server and i was able to run a query script (on Win32_PerfRawData_W3SVC_WebService).

I have ran scriptomatic from another host on the network to query the monitored server and i get the right values:
...
TotalISAPIExtensionRequests: 5277
TotalLockedErrors: 0
TotalLockRequests: 0
TotalLogonAttempts: 13642
TotalMethodRequests: 15495
TotalMethodRequestsPersec: 15495
TotalMkcolRequests: 0
TotalMoveRequests: 0
TotalNonAnonymousUsers: 0
TotalNotFoundErrors: 706
TotalOptionsRequests: 0
TotalOtherRequestMethods: 0
TotalPostRequests: 1251
...
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

Flip on debug and grab the wmic string that is being called.

E.g. call wmic manually without wmi.php and what do you get?
Thomas.Pacce
Posts: 23
Joined: Wed Apr 15, 2009 5:19 am
Location: Amsterdam

Post by Thomas.Pacce »

claymen wrote:Flip on debug and grab the wmic string that is being called.

E.g. call wmic manually without wmi.php and what do you get?
I am not sure i ran the command correctly but there it goes (this is the command i get in the debug mode):
/usr/bin/wmic -U % //-h "SELECT /etc/cacti/cactiwmi.pw FROM -u WHERE -w='Win32_PerfRawData_W3SVC_WebService'"
ERROR: dcom_create_object.
ERROR: Login to remote object.
NTSTATUS: NT_STATUS_IO_TIMEOUT - NT_STATUS_IO_TIMEOUT

Now if i run the command manually i can retrieve the values:
root@amsterdam-sm09:/usr/share/cacti/site/scripts# /usr/bin/wmic -U domain/admin%password //10.130.16.187 "SELECT * FROM Win32_PerfRawData_W3SVC_WebService"
CLASS: Win32_PerfRawData_W3SVC_WebService
AnonymousUsersPersec|BytesReceivedPersec|BytesSentPersec|BytesTotalPersec|Caption|CGIRequestsPersec|ConnectionAttemptsPersec|CopyRequestsPersec|CurrentAnonymousUsers|CurrentBlockedAsyncIORequests|Currentblockedbandwidthbytes|CurrentCALcountforauthenticatedusers|CurrentCALcountforSSLconnections|CurrentCGIRequests|CurrentConnections|CurrentISAPIExtensionRequests|CurrentNonAnonymousUsers|DeleteRequestsPersec|Description|FilesPersec|FilesReceivedPersec|FilesSentPersec|Frequency_Object|Frequency_PerfTime|Frequency_Sys100NS|GetRequestsPersec|HeadRequestsPersec|ISAPIExtensionRequestsPersec|LockedErrorsPersec|LockRequestsPersec|LogonAttemptsPersec|MaximumAnonymousUsers|MaximumCALcountforauthenticatedusers|MaximumCALcountforSSLconnections|MaximumCGIRequests|MaximumConnections|MaximumISAPIExtensionRequests|MaximumNonAnonymousUsers|MeasuredAsyncIOBandwidthUsage|MkcolRequestsPersec|MoveRequestsPersec|Name|NonAnonymousUsersPersec|NotFoundErrorsPersec|OptionsRequestsPersec|OtherRequestMethodsPersec|PostRequestsPersec|PropfindRequestsPersec|ProppatchRequestsPersec|PutRequestsPersec|SearchRequestsPersec|ServiceUptime|Timestamp_Object|Timestamp_PerfTime|Timestamp_Sys100NS|TotalAllowedAsyncIORequests|TotalAnonymousUsers|TotalBlockedAsyncIORequests|Totalblockedbandwidthbytes|TotalBytesReceived|TotalBytesSent|TotalBytesTransfered|TotalCGIRequests|TotalConnectionAttemptsallinstances|TotalCopyRequests|TotalcountoffailedCALrequestsforauthenticatedusers|TotalcountoffailedCALrequestsforSSLconnections|TotalDeleteRequests|TotalFilesReceived|TotalFilesSent|TotalFilesTransferred|TotalGetRequests|TotalHeadRequests|TotalISAPIExtensionRequests|TotalLockedErrors|TotalLockRequests|TotalLogonAttempts|TotalMethodRequests|TotalMethodRequestsPersec|TotalMkcolRequests|TotalMoveRequests|TotalNonAnonymousUsers|TotalNotFoundErrors|TotalOptionsRequests|TotalOtherRequestMethods|TotalPostRequests|TotalPropfindRequests|TotalProppatchRequests|TotalPutRequests|TotalRejectedAsyncIORequests|TotalSearchRequests|TotalTraceRequests|TotalUnlockRequests|TraceRequestsPersec|UnlockRequestsPersec
63243|362093787|1856654545|2218748332|(null)|0|5871|0|0|0|0|0|0|0|29|0|0|0|(null)|17443|0|17443|0|2667980000|10000000|51284|0|34329|0|0|63243|71|0|0|0|146|39|0|0|0|0|_Total|0|1904|0|0|14684|0|0|0|0|90230|0|1308089045674845|18446742062504963616|0|63243|0|0|362093787|1856654545|2218748332|0|5871|0|0|0|0|0|17443|17443|51284|0|34329|0|0|63243|65968|65968|0|0|0|1904|0|0|14684|0|0|0|0|0|0|0|0|0
34|17849|1084017|1101866|(null)|0|6|0|0|0|0|0|0|0|0|0|0|0|(null)|24|0|24|0|2667980000|10000000|34|0|9|0|0|34|4|0|0|0|6|1|0|0|0|0|pl.myacn.eu |0|2|0|0|0|0|0|0|0|90058|0|1308089045674845|18446742062504963616|0|34|0|0|17849|1084017|1101866|0|6|0|0|0|0|0|24|24|34|0|9|0|0|34|34|34|0|0|0|2|0|0|0|0|0|0|0|0|0|0|0|0
4229|43964461|104565297|148529758|(null)|0|487|0|0|0|0|0|0|0|0|0|0|0|(null)|533|0|533|0|2667980000|10000000|2548|0|3027|0|0|4229|5|0|0|0|7|4|0|0|0|0|es.myacn.eu|0|179|0|0|1729|0|0|0|0|90230|0|1308089045674845|18446742062504963616|0|4229|0|0|43964461|104565297|148529758|0|487|0|0|0|0|0|533|533|2548|0|3027|0|0|4229|4277|4277|0|0|0|179|0|0|1729|0|0|0|0|0|0|0|0|0
18124|98528720|530286996|628815716|(null)|0|2040|0|0|0|0|0|0|0|8|0|0|0|(null)|4475|0|4475|0|2667980000|10000000|13992|0|10450|0|0|18124|9|0|0|0|22|7|0|0|0|0|fr.myacn.eu|0|345|0|0|4504|0|0|0|0|90230|0|1308089045674845|18446742062504963616|0|18124|0|0|98528720|530286996|628815716|0|2040|0|0|0|0|0|4475|4475|13992|0|10450|0|0|18124|18496|18496|0|0|0|345|0|0|4504|0|0|0|0|0|0|0|0|0
1155|3779704|20928668|24708372|(null)|0|102|0|0|0|0|0|0|0|0|0|0|0|(null)|296|0|296|0|2667980000|10000000|1055|0|306|0|0|1155|6|0|0|0|7|1|0|0|0|0|fi.myacn.eu |0|22|0|0|100|0|0|0|0|90230|0|1308089045674845|18446742062504963616|0|1155|0|0|3779704|20928668|24708372|0|102|0|0|0|0|0|296|296|1055|0|306|0|0|1155|1155|1155|0|0|0|22|0|0|100|0|0|0|0|0|0|0|0|0
35|18344|1120208|1138552|(null)|0|6|0|0|0|0|0|0|0|0|0|0|0|(null)|24|0|24|0|2667980000|10000000|35|0|10|0|0|35|4|0|0|0|6|1|0|0|0|0|at.myacn.eu |0|2|0|0|0|0|0|0|0|90048|0|1308089045674845|18446742062504963616|0|35|0|0|18344|1120208|1138552|0|6|0|0|0|0|0|24|24|35|0|10|0|0|35|35|35|0|0|0|2|0|0|0|0|0|0|0|0|0|0|0|0
13181|127745703|399853267|527598970|(null)|0|451|0|0|0|0|0|0|0|16|0|0|0|(null)|2701|0|2701|0|2667980000|10000000|8772|0|9513|0|0|13181|10|0|0|0|20|9|0|0|0|0|uk.myacn.eu|0|37|0|0|4719|0|0|0|0|90230|0|1308089045674845|18446742062504963616|0|13181|0|0|127745703|399853267|527598970|0|451|0|0|0|0|0|2701|2701|8772|0|9513|0|0|13181|13491|13491|0|0|0|37|0|0|4719|0|0|0|0|0|0|0|0|0
1234|3162426|26010472|29172898|(null)|0|66|0|0|0|0|0|0|0|0|0|0|0|(null)|319|0|319|0|2667980000|10000000|1137|0|342|0|0|1234|5|0|0|0|6|2|0|0|0|0|no.myacn.eu|0|33|0|0|97|0|0|0|0|90230|0|1308089045674845|18446742062504963616|0|1234|0|0|3162426|26010472|29172898|0|66|0|0|0|0|0|319|319|1137|0|342|0|0|1234|1234|1234|0|0|0|33|0|0|97|0|0|0|0|0|0|0|0|0
0|0|0|0|(null)|0|0|0|0|0|0|0|0|0|0|0|0|0|(null)|0|0|0|0|2667980000|10000000|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|externalAPI.myacn.eu|0|0|0|0|0|0|0|0|0|90230|0|1308089045674845|18446742062504963616|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0
2312|5337131|41480033|46817164|(null)|0|185|0|0|0|0|0|0|0|0|0|0|0|(null)|627|0|627|0|2667980000|10000000|2140|0|613|0|0|2312|6|0|0|0|12|2|0|0|0|0|se.myacn.eu|0|115|0|0|178|0|0|0|0|90230|0|1308089045674845|18446742062504963616|0|2312|0|0|5337131|41480033|46817164|0|185|0|0|0|0|0|627|627|2140|0|613|0|0|2312|2318|2318|0|0|0|115|0|0|178|0|0|0|0|0|0|0|0|0
4227|30039639|129547442|159587081|(null)|0|437|0|0|0|0|0|0|0|0|0|0|0|(null)|1281|0|1281|0|2667980000|10000000|3155|0|2316|0|0|4227|6|0|0|0|12|3|0|0|0|0|pt.myacn.eu |0|291|0|0|1084|0|0|0|0|90230|0|1308089045674845|18446742062504963616|0|4227|0|0|30039639|129547442|159587081|0|437|0|0|0|0|0|1281|1281|3155|0|2316|0|0|4227|4239|4239|0|0|0|291|0|0|1084|0|0|0|0|0|0|0|0|0
0|0|0|0|(null)|0|0|0|0|0|0|0|0|0|0|0|0|0|(null)|0|0|0|0|2667980000|10000000|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|ppsdashboard.eu.acncorp.com|0|0|0|0|0|0|0|0|0|90230|0|1308089045674845|18446742062504963616|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0
3978|20731989|124577718|145309707|(null)|0|457|0|0|0|0|0|0|0|0|0|0|0|(null)|1227|0|1227|0|2667980000|10000000|3186|0|1983|0|0|3978|5|0|0|0|15|3|0|0|0|0|it.myacn.eu|0|115|0|0|840|0|0|0|0|90230|0|1308089045674845|18446742062504963616|0|3978|0|0|20731989|124577718|145309707|0|457|0|0|0|0|0|1227|1227|3186|0|1983|0|0|3978|4026|4026|0|0|0|115|0|0|840|0|0|0|0|0|0|0|0|0
505|2790328|10571888|13362216|(null)|0|52|0|0|0|0|0|0|0|0|0|0|0|(null)|178|0|178|0|2667980000|10000000|371|0|299|0|0|505|4|0|0|0|4|2|0|0|0|0|ie.myacn.eu |0|18|0|0|134|0|0|0|0|90230|0|1308089045674845|18446742062504963616|0|505|0|0|2790328|10571888|13362216|0|52|0|0|0|0|0|178|178|371|0|299|0|0|505|505|505|0|0|0|18|0|0|134|0|0|0|0|0|0|0|0|0
0|0|0|0|(null)|0|0|0|0|0|0|0|0|0|0|0|0|0|(null)|0|0|0|0|2667980000|10000000|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|nl.myacn.eu|0|0|0|0|0|0|0|0|0|0|0|1308089045674845|18446742062504963616|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0
0|0|0|0|(null)|0|0|0|0|0|0|0|0|0|0|0|0|0|(null)|0|0|0|0|2667980000|10000000|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|ge.myacn.eu |0|0|0|0|0|0|0|0|0|0|0|1308089045674845|18446742062504963616|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0
0|0|0|0|(null)|0|0|0|0|0|0|0|0|0|0|0|0|0|(null)|0|0|0|0|2667980000|10000000|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|ch.myacn.eu |0|0|0|0|0|0|0|0|0|0|0|1308089045674845|18446742062504963616|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0
14229|25977493|466628539|492606032|(null)|0|1582|0|0|0|0|0|0|0|5|0|0|0|(null)|5758|0|5758|0|2667980000|10000000|14859|0|5461|0|0|14229|7|0|0|0|29|4|0|0|0|0|dk.myacn.eu|0|745|0|0|1299|0|0|0|0|90230|0|1308089045674845|18446742062504963616|0|14229|0|0|25977493|466628539|492606032|0|1582|0|0|0|0|0|5758|5758|14859|0|5461|0|0|14229|16158|16158|0|0|0|745|0|0|1299|0|0|0|0|0|0|0|0|0
Thomas.Pacce
Posts: 23
Joined: Wed Apr 15, 2009 5:19 am
Location: Amsterdam

Post by Thomas.Pacce »

Ok i messed up with the IIS templates and your script version so i have upgraded my templates and wmi.php to your RC1 version. I get a logon failure error now:
# /usr/bin/php -q /usr/share/cacti/site/scripts/wmi.php -h '10.130.16.187' -u '/etc/cacti/cactiwmi.pw' -w 'Win32_PerfRawData_W3SVC_WebService' -n '' -k 'Name' -v '_Total' -c 'CurrentConnections,CurrentNonAnonymousUsers,CurrentAnonymousUsers,ConnectionAttemptsPersec,AnonymousUsersPersec,NonAnonymousUsersPersec,LogonAttemptsPersec'
NTSTATUS: NT_STATUS_LOGON_FAILURE - Logon failure


Return code non-zero, debug mode enabled!



/usr/bin/wmic --namespace='root\CIMV2' --authentication-file=/etc/cacti/cactiwmi.pw //10.130.16.187 "SELECT CurrentConnections,CurrentNonAnonymousUsers,CurrentAnonymousUsers,ConnectionAttemptsPersec,AnonymousUsersPersec,NonAnonymousUsersPersec,LogonAttemptsPersec FROM Win32_PerfRawData_W3SVC_WebService WHERE Name='_Total'"
Exec Status: 1

ERROR: dcom_create_objevi /etc/cacti/cactiwmi.pw

I have created a file /etc/cacti/cactiwmi.pw that contains:
username=momagent
password=*@scom
domain=ACME
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

Can the cacti user access the cactiwmi.pw file?

Cause that's either the user doesn't have access or it can't read the file and fails.
Thomas.Pacce
Posts: 23
Joined: Wed Apr 15, 2009 5:19 am
Location: Amsterdam

Post by Thomas.Pacce »

Well even if i chmod it to 777 it doesnt work.

root@amsterdam-sm09:~# chmod 777 /etc/cacti/cactiwmi.pw
root@amsterdam-sm09:~# /usr/bin/wmic --namespace='root\CIMV2' --authentication-file=/etc/cacti/cactiwmi.pw //10.130.16.187 "SELECT CurrentConnections,CurrentNonAnonymousUsers,CurrentAnonymousUsers,ConnectionAttemptsPersec,AnonymousUsersPersec,NonAnonymousUsersPersec,LogonAttemptsPersec FROM Win32_PerfRawData_W3SVC_WebService WHERE Name='_Total'"
Failed to bind to uuid 4d9f4ab8-7d1c-11cf-861e-0020af6e7c57 - NT_STATUS_NET_WRITE_FAULT
ERROR: dcom_create_object.
ERROR: Login to remote object.
NTSTATUS: NT_STATUS_LOGON_FAILURE - Logon failure
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

Not sure what else I can say but its failing due to authentication

NTSTATUS: NT_STATUS_LOGON_FAILURE - Logon failure

Substitute a different user into cactiwmi.pw? you can try and debug further with the wmic command by adding -d2/-d3 but can't see much extra comming of it.
Thomas.Pacce
Posts: 23
Joined: Wed Apr 15, 2009 5:19 am
Location: Amsterdam

Post by Thomas.Pacce »

I am lost the credentials in the password file are ok i have tested them from the command line.

Besides now that i have upgraded templates and wmi.php to the RC1 one none of the old graphs are generating data anymore (i thought this was compatible...), old graphs seem to have issues with credential:
root@amsterdam-sm09:~# /usr/bin/php -q /usr/share/cacti/site/scripts/wmi.php -h '10.130.16.187' -u 'credential' -w 'Win32_PerfRawData_PerfDisk_LogicalDisk' -n '' -k 'Name' -v 'D\:' -c 'DiskWritesPersec,DiskWriteBytesPersec,DiskReadsPersec,DiskReadBytesPersec,CurrentDiskQueueLength'
Password for [WORKGROUP\root]:

Why is it asking for WORKGROUP\root whereas i have kept the wmi-logins.php file?
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

I'm sure I mentioned it but the credential needs to be updated on the old data sources you are using to be a path to the cactiwmi.pw file. Backwards compatibility extends in every other way but you must update the credential portion.
Thomas.Pacce
Posts: 23
Joined: Wed Apr 15, 2009 5:19 am
Location: Amsterdam

Post by Thomas.Pacce »

Strange i have recreated the pw file to another location (under /usr/share/cacti/site/scripts as i run ubuntu) and now it works...

Anyways, thanks for your time on this.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests