Monitor Windows via WMI from Cacti on Linux

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

Moderators: Developers, Moderators

Post Reply
jftuga
Posts: 49
Joined: Mon Feb 07, 2011 11:50 am
Location: Athens, GA

Re: Monitor Windows via WMI from Cacti on Linux

Post by jftuga »

Is anyone else having problems with these templates and the Autom8 plugin? If so, please see this thread:

http://forums.cacti.net/viewtopic.php?f=20&t=42711

Thanks,
-John
enits24
Posts: 1
Joined: Tue May 24, 2011 8:26 am

Re: Monitor Windows via WMI from Cacti on Linux

Post by enits24 »

Hi!

Would anybody know how to enable WMI accounts on hosts via GPO?

Pushing a user in appropriate groups (Monitor Performance, Log Performance and DCOM users) to a local computer should not be a problem. But I have no clue how to enable WMI and select "This namespace and subnamespaces" via group policy. Pushing an admin account to do the queries is out of the question.


Thanks in advance.
artiflo
Cacti User
Posts: 76
Joined: Wed Dec 19, 2007 2:00 pm

Re: Monitor Windows via WMI from Cacti on Linux

Post by artiflo »

I try to create enhanced template for SQL server, but it's hard.
Someone created template for SQL server ?

I need this columns (class) :
  • Buffercachehitratio (Win32_PerfFormattedData_MSSQLxxx_MSSQLxxxBufferManager)
    Databasepages,Freepages,Reservedpages,Stolenpages,Targetpages,Totalpages (Win32_PerfFormattedData_MSSQLxxx_MSSQLxxxBufferManager)
    LogicalConnections,UserConnections (Win32_PerfFormattedData_MSSQLxxx_MSSQLxxxGeneralStatistics)
    LockTimeoutsPersec,LockWaitsPersec,NumberofDeadlocksPersec,LockWaitTimems(Win32_PerfFormattedData_MSSQLxxx_MSSQLxxxLocks)
    Processesblocked (Win32_PerfFormattedData_MSSQLxxx_MSSQLxxxGeneralStatistics)
    Transactions (Win32_PerfFormattedData_MSSQLxxx_MSSQLxxxTransactions)
nweb
Posts: 1
Joined: Wed Jun 01, 2011 11:05 am
Location: Italy

Re: Monitor Windows via WMI from Cacti on Linux

Post by nweb »

Hi everybody,

I'm using this php script and the wmic binary successfully for over a month now.
Everything works fine, except some sporadic issues.
Sometimes the following situation occures: the wmic binary waits indefinetly for a response from the server, and the cacti poller reaches timeout. This happens when the probed machine is stuck for a reason or another. I would need some sort of timeout for wmic as well.
Have you ever encountered a similar behaviour? Any suggestion?
wmic is compiled from version 1.3.13 source on zenoss repository.

Thanks a lot,
and keep up the good work!
loipal031810
Posts: 14
Joined: Tue Oct 05, 2010 9:59 pm

Re: Monitor Windows via WMI from Cacti on Linux

Post by loipal031810 »

I'm totally lost and give up please help!! I'm using CactiWMI 0.0.6 and set the correct path on wmi.php and edit my credentials at /etc/cacti/cactiwmi.pw. Run debug on says ok and run wmi.php script on shell command without error but all my graphs showing NAN. I altered CDEF based on the forum but still no luck.

My info:
CentOS 5.4, Cacti-0.8.7-e, poller cmd.php, RRDTool 1.3.9, PHP-5.1.6

Thanks in advance!!
canislupus59
Posts: 14
Joined: Mon Jul 18, 2011 8:55 am

Re: Monitor Windows via WMI from Cacti on Linux

Post by canislupus59 »

I need your help cause I'm going crazy.
I have installed the last version of the WMI script (0.0.7). I have seen in the Cacti Log, i have tried to launch the script via command line, rrdtool says that's all is ok, but when i see the graph of Available Disk Space i get always NaN. I have tried to launch the realtime monitor to see if i receive data and it works greatly.
So i have launched rrdtool info on my rrd file and this is the result:

Code: Select all

rrd_version = "0003"
step = 15
last_update = 1314004501
ds[FreeSpace].type = "GAUGE"
ds[FreeSpace].minimal_heartbeat = 30
ds[FreeSpace].min = 0.0000000000e+00
ds[FreeSpace].max = 1.0000000000e+13
ds[FreeSpace].last_ds = "95310770176"
ds[FreeSpace].value = NaN
ds[FreeSpace].unknown_sec = 1
ds[Size].type = "GAUGE"
ds[Size].minimal_heartbeat = 30
ds[Size].min = 0.0000000000e+00
ds[Size].max = 1.0000000000e+13
ds[Size].last_ds = "104855834624"
ds[Size].value = NaN
ds[Size].unknown_sec = 1
rra[0].cf = "AVERAGE"
rra[0].rows = 10080
rra[0].cur_row = 5061
rra[0].pdp_per_row = 1
rra[0].xff = 5.0000000000e-01
rra[0].cdp_prep[0].value = NaN
rra[0].cdp_prep[0].unknown_datapoints = 0
rra[0].cdp_prep[1].value = NaN
rra[0].cdp_prep[1].unknown_datapoints = 0
rra[1].cf = "AVERAGE"
rra[1].rows = 25920
rra[1].cur_row = 14898
rra[1].pdp_per_row = 1
rra[1].xff = 5.0000000000e-01
rra[1].cdp_prep[0].value = NaN
rra[1].cdp_prep[0].unknown_datapoints = 0
rra[1].cdp_prep[1].value = NaN
rra[1].cdp_prep[1].unknown_datapoints = 0
rra[2].cf = "AVERAGE"
rra[2].rows = 9000
rra[2].cur_row = 5380
rra[2].pdp_per_row = 6
rra[2].xff = 5.0000000000e-01
rra[2].cdp_prep[0].value = NaN
rra[2].cdp_prep[0].unknown_datapoints = 0
rra[2].cdp_prep[1].value = NaN
rra[2].cdp_prep[1].unknown_datapoints = 0
rra[3].cf = "AVERAGE"
rra[3].rows = 2250
rra[3].cur_row = 1796
rra[3].pdp_per_row = 24
rra[3].xff = 5.0000000000e-01
rra[3].cdp_prep[0].value = NaN
rra[3].cdp_prep[0].unknown_datapoints = 12
rra[3].cdp_prep[1].value = NaN
rra[3].cdp_prep[1].unknown_datapoints = 12
rra[4].cf = "AVERAGE"
rra[4].rows = 797
rra[4].cur_row = 552
rra[4].pdp_per_row = 288
rra[4].xff = 5.0000000000e-01
rra[4].cdp_prep[0].value = NaN
rra[4].cdp_prep[0].unknown_datapoints = 204
rra[4].cdp_prep[1].value = NaN
rra[4].cdp_prep[1].unknown_datapoints = 204
rra[5].cf = "MIN"
rra[5].rows = 10080
rra[5].cur_row = 8064
rra[5].pdp_per_row = 1
rra[5].xff = 5.0000000000e-01
rra[5].cdp_prep[0].value = NaN
rra[5].cdp_prep[0].unknown_datapoints = 0
rra[5].cdp_prep[1].value = NaN
rra[5].cdp_prep[1].unknown_datapoints = 0
rra[6].cf = "MIN"
rra[6].rows = 25920
rra[6].cur_row = 24767
rra[6].pdp_per_row = 1
rra[6].xff = 5.0000000000e-01
rra[6].cdp_prep[0].value = NaN
rra[6].cdp_prep[0].unknown_datapoints = 0
rra[6].cdp_prep[1].value = NaN
rra[6].cdp_prep[1].unknown_datapoints = 0
rra[7].cf = "MIN"
rra[7].rows = 9000
rra[7].cur_row = 99
rra[7].pdp_per_row = 6
rra[7].xff = 5.0000000000e-01
rra[7].cdp_prep[0].value = NaN
rra[7].cdp_prep[0].unknown_datapoints = 0
rra[7].cdp_prep[1].value = NaN
rra[7].cdp_prep[1].unknown_datapoints = 0
rra[8].cf = "MIN"
rra[8].rows = 2250
rra[8].cur_row = 1982
rra[8].pdp_per_row = 24
rra[8].xff = 5.0000000000e-01
rra[8].cdp_prep[0].value = NaN
rra[8].cdp_prep[0].unknown_datapoints = 12
rra[8].cdp_prep[1].value = NaN
rra[8].cdp_prep[1].unknown_datapoints = 12
rra[9].cf = "MIN"
rra[9].rows = 797
rra[9].cur_row = 529
rra[9].pdp_per_row = 288
rra[9].xff = 5.0000000000e-01
rra[9].cdp_prep[0].value = NaN
rra[9].cdp_prep[0].unknown_datapoints = 204
rra[9].cdp_prep[1].value = NaN
rra[9].cdp_prep[1].unknown_datapoints = 204
rra[10].cf = "MAX"
rra[10].rows = 10080
rra[10].cur_row = 2300
rra[10].pdp_per_row = 1
rra[10].xff = 5.0000000000e-01
rra[10].cdp_prep[0].value = NaN
rra[10].cdp_prep[0].unknown_datapoints = 0
rra[10].cdp_prep[1].value = NaN
rra[10].cdp_prep[1].unknown_datapoints = 0
rra[11].cf = "MAX"
rra[11].rows = 25920
rra[11].cur_row = 22273
rra[11].pdp_per_row = 1
rra[11].xff = 5.0000000000e-01
rra[11].cdp_prep[0].value = NaN
rra[11].cdp_prep[0].unknown_datapoints = 0
rra[11].cdp_prep[1].value = NaN
rra[11].cdp_prep[1].unknown_datapoints = 0
rra[12].cf = "MAX"
rra[12].rows = 9000
rra[12].cur_row = 7939
rra[12].pdp_per_row = 6
rra[12].xff = 5.0000000000e-01
rra[12].cdp_prep[0].value = NaN
rra[12].cdp_prep[0].unknown_datapoints = 0
rra[12].cdp_prep[1].value = NaN
rra[12].cdp_prep[1].unknown_datapoints = 0
rra[13].cf = "MAX"
rra[13].rows = 2250
rra[13].cur_row = 764
rra[13].pdp_per_row = 24
rra[13].xff = 5.0000000000e-01
rra[13].cdp_prep[0].value = NaN
rra[13].cdp_prep[0].unknown_datapoints = 12
rra[13].cdp_prep[1].value = NaN
rra[13].cdp_prep[1].unknown_datapoints = 12
rra[14].cf = "MAX"
rra[14].rows = 797
rra[14].cur_row = 16
rra[14].pdp_per_row = 288
rra[14].xff = 5.0000000000e-01
rra[14].cdp_prep[0].value = NaN
rra[14].cdp_prep[0].unknown_datapoints = 204
rra[14].cdp_prep[1].value = NaN
rra[14].cdp_prep[1].unknown_datapoints = 204
rra[15].cf = "LAST"
rra[15].rows = 10080
rra[15].cur_row = 3917
rra[15].pdp_per_row = 1
rra[15].xff = 5.0000000000e-01
rra[15].cdp_prep[0].value = NaN
rra[15].cdp_prep[0].unknown_datapoints = 0
rra[15].cdp_prep[1].value = NaN
rra[15].cdp_prep[1].unknown_datapoints = 0
rra[16].cf = "LAST"
rra[16].rows = 25920
rra[16].cur_row = 23177
rra[16].pdp_per_row = 1
rra[16].xff = 5.0000000000e-01
rra[16].cdp_prep[0].value = NaN
rra[16].cdp_prep[0].unknown_datapoints = 0
rra[16].cdp_prep[1].value = NaN
rra[16].cdp_prep[1].unknown_datapoints = 0
rra[17].cf = "LAST"
rra[17].rows = 9000
rra[17].cur_row = 3335
rra[17].pdp_per_row = 6
rra[17].xff = 5.0000000000e-01
rra[17].cdp_prep[0].value = NaN
rra[17].cdp_prep[0].unknown_datapoints = 0
rra[17].cdp_prep[1].value = NaN
rra[17].cdp_prep[1].unknown_datapoints = 0
rra[18].cf = "LAST"
rra[18].rows = 2250
rra[18].cur_row = 1346
rra[18].pdp_per_row = 24
rra[18].xff = 5.0000000000e-01
rra[18].cdp_prep[0].value = NaN
rra[18].cdp_prep[0].unknown_datapoints = 12
rra[18].cdp_prep[1].value = NaN
rra[18].cdp_prep[1].unknown_datapoints = 12
rra[19].cf = "LAST"
rra[19].rows = 797
rra[19].cur_row = 163
rra[19].pdp_per_row = 288
rra[19].xff = 5.0000000000e-01
rra[19].cdp_prep[0].value = NaN
rra[19].cdp_prep[0].unknown_datapoints = 204
rra[19].cdp_prep[1].value = NaN
rra[19].cdp_prep[1].unknown_datapoints = 204
As you can see there are a lot of NaN value, but it's impossible for me to understand it.
Anyone can tell me how to debug this error ?

CentOS release 4.9 - Cacti 0.8.7g - Spine - RRDTool 1.2
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: Monitor Windows via WMI from Cacti on Linux

Post by noname »

canislupus59 wrote: ds[FreeSpace].minimal_heartbeat = 30
ds[Size].minimal_heartbeat = 30
It seems heartbeat is too short. Please check your data template.
canislupus59
Posts: 14
Joined: Mon Jul 18, 2011 8:55 am

Re: Monitor Windows via WMI from Cacti on Linux

Post by canislupus59 »

noname wrote:
canislupus59 wrote: ds[FreeSpace].minimal_heartbeat = 30
ds[Size].minimal_heartbeat = 30
It seems heartbeat is too short. Please check your data template.
You have my life saver... :D
I have changed the heartbeat and step in my data template and now it works.
I think that only 15 seconds to get data for all my servers (100+) was not the correct value.
Thanks a lot for your help. :wink:
loipal031810
Posts: 14
Joined: Tue Oct 05, 2010 9:59 pm

Re: Monitor Windows via WMI from Cacti on Linux

Post by loipal031810 »

Hi Guys!! Do you have idea on how to graph Interface Statistics using wmi? as this network interface has no template included in wmi templates. Thanks
User avatar
JorisFRST
Cacti User
Posts: 229
Joined: Mon Oct 02, 2006 1:22 pm
Location: Belgium
Contact:

Re: Monitor Windows via WMI from Cacti on Linux

Post by JorisFRST »

What interface stats are you interested in ?

If you fire up wmitool and can find the stats you're interested in I can help you making a template.
Joris.
http://www.routerjanitor.com
User avatar
JorisFRST
Cacti User
Posts: 229
Joined: Mon Oct 02, 2006 1:22 pm
Location: Belgium
Contact:

Re: Monitor Windows via WMI from Cacti on Linux

Post by JorisFRST »

For instance :
wmi explorer.png
wmi explorer.png (55.02 KiB) Viewed 5985 times
Joris.
http://www.routerjanitor.com
ffeijo
Posts: 12
Joined: Sat Apr 24, 2010 9:05 pm
Location: USA

Migrating a big Linux WMI-based install to Windows

Post by ffeijo »

I got a problem not without a healthy dose of irony.

I have been using the beautiful script from this forum successfully to monitor about 250 Windows servers over WMI. Management recently requested me to move the Cacti server to Windows. Migration went fine, all the SNMP-based probes started working right away.

Of course, the WMI stuff broke. Since I am in Windows now, I thought it would be easy to find a workaround, but my search has not been fruitful. So here it goes -

1- Is there a way to replace the script but leave the rest of the monitoring framework in place, replacing the input string in <Data Input Methods>? Instead of the old "/usr/bin/php -q <path_cacti>/scripts/wmi.php", it would show the path to a windows-based collector. If that worked all thousands of charts like "Disk I/O in drive D: of server X" would magically come back to life, just using a different input string and collector.

2- If #1 is not feasible and the entire monitoring framework needs to be rebuilt for all Windows servers, what would you guys recommend as the best script to start building on. I found several in the forums, but none as complete as this Linux-based one. Oh, the irony. :-?

Thanks for any pointers in the right direction.
User avatar
JorisFRST
Cacti User
Posts: 229
Joined: Mon Oct 02, 2006 1:22 pm
Location: Belgium
Contact:

Re: Monitor Windows via WMI from Cacti on Linux

Post by JorisFRST »

This should help you,

I haven't tried it myself though.

http://technet.microsoft.com/en-us/libr ... 42610.aspx

probably you'll have to edit wmi.php to use the windows based wmic ?


Actually, this isn't free: http://www.ks-soft.net/hostmon.eng/wmi/index.htm But looks like it requires less work to get it working.
Joris.
http://www.routerjanitor.com
ffeijo
Posts: 12
Joined: Sat Apr 24, 2010 9:05 pm
Location: USA

Re: Monitor Windows via WMI from Cacti on Linux

Post by ffeijo »

JorisFRST,

Great tips, both of them. It looks like after surgery on the script code to replace syntax, both have a shot. The $100 option does not seem to let me off the hook about editing, though, so I will start with el cheapo one.

Thanks, appreciated. Now I got something to try that might save 4,000 graphs. :D
ffeijo
Posts: 12
Joined: Sat Apr 24, 2010 9:05 pm
Location: USA

wmi.php in windows - function getopt not available

Post by ffeijo »

I have been working on adapting wmi.php to run in Windows wrapping the Microsoft wmic command line utility.

I am no php programmer, but it seemed doable, at least while I worked on the text file only :)

I got the wrapper reflecting the new raw executable syntax, but when I tried to actually run the script, there is a function used in the code, getopt, that is not available in Windows PHP until release 5.3. I just came back from php.net and they have the 5.3 Windows binaries there, but only for IIS users, not Apache, which is what I use.

Trying another approach, I looked at modifying the code and replace getopt with another function, since getopt is used only once to fetch the command line variables. I found Console_Getopt on something called Pear, but the Pear installer is erroing out. Another door apparently slammed, or more likely my php lack of skills showing.

I think the best shot here is to rewrite the getopt functionality, since waiting for php 5.3 for Apache Windows is open ended. I realize this is not a php help forum but perhaps someone can point in the right direction, or come up with a better idea. Thanks for any help.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests