Monitor Windows via WMI from Cacti on Linux

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

Moderators: Developers, Moderators

Post Reply
chet
Posts: 41
Joined: Mon Feb 09, 2009 12:49 pm

Post by chet »

argon0 wrote:Suspect user was not member of Performance Log Users group?

Argon0
Well kinda, so far the only was I can do it is by giving the wmi users an admin account.
argon0
Cacti User
Posts: 460
Joined: Fri Mar 12, 2004 1:22 pm

Post by argon0 »

Ah... Just got the same feedback from my DBAs....

...making your data source WMI class field adjustable...
How do you do this then?

If I use the template you provide, it doesn't work. Is there a way of doing it so that you enter/edit the NameSpace when you create the graph?

Hmm thinks there must be, you can set credentials, etc... Aha... dashes away to look at this,.
No longer a n00by, probably, by now an 0ldby

Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
argon0
Cacti User
Posts: 460
Joined: Fri Mar 12, 2004 1:22 pm

Post by argon0 »

Chet...

I've posted, somewhere further up on this thread, how to set WMI security up... As has someone else!!!
No longer a n00by, probably, by now an 0ldby

Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
chet
Posts: 41
Joined: Mon Feb 09, 2009 12:49 pm

Post by chet »

Which I followed
argon0
Cacti User
Posts: 460
Joined: Fri Mar 12, 2004 1:22 pm

Post by argon0 »

Me: Yes there is, just goto the data template and click on the tick box: per data source value

<doh>
No longer a n00by, probably, by now an 0ldby

Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
argon0
Cacti User
Posts: 460
Joined: Fri Mar 12, 2004 1:22 pm

Post by argon0 »

Ah, some help needed...

I need to get WMI counters from a multi-homed server.

The server is on a 192.x.75.x address and on a 10.x.1.x address the Cacti server is on the 10 net.

I can query all my other servers, and can pint the 10.x.1.x address, but no the 192.x.75.x address.

When I run the wmi query at command line I get the following (rather long) error:

Code: Select all

PHP Notice:  Undefined offset:  1 in /var/www/html/scripts/wmi.php on line 101

Notice: Undefined offset:  1 in /var/www/html/scripts/wmi.php on line 101
PHP Notice:  Undefined offset:  1 in /var/www/html/scripts/wmi.php on line 101

Notice: Undefined offset:  1 in /var/www/html/scripts/wmi.php on line 101
PHP Notice:  Undefined offset:  1 in /var/www/html/scripts/wmi.php on line 101

Notice: Undefined offset:  1 in /var/www/html/scripts/wmi.php on line 101
PHP Notice:  Undefined offset:  1 in /var/www/html/scripts/wmi.php on line 101

Notice: Undefined offset:  1 in /var/www/html/scripts/wmi.php on line 101
PHP Notice:  Undefined offset:  1 in /var/www/html/scripts/wmi.php on line 101

Notice: Undefined offset:  1 in /var/www/html/scripts/wmi.php on line 101
PHP Notice:  Undefined offset:  1 in /var/www/html/scripts/wmi.php on line 101

Notice: Undefined offset:  1 in /var/www/html/scripts/wmi.php on line 101
PHP Notice:  Undefined offset:  1 in /var/www/html/scripts/wmi.php on line 101

Notice: Undefined offset:  1 in /var/www/html/scripts/wmi.php on line 101
PHP Notice:  Undefined offset:  1 in /var/www/html/scripts/wmi.php on line 101

Notice: Undefined offset:  1 in /var/www/html/scripts/wmi.php on line 101
PHP Notice:  Undefined offset:  1 in /var/www/html/scripts/wmi.php on line 101

Notice: Undefined offset:  1 in /var/www/html/scripts/wmi.php on line 101
PHP Notice:  Undefined offset:  1 in /var/www/html/scripts/wmi.php on line 101

Notice: Undefined offset:  1 in /var/www/html/scripts/wmi.php on line 101
Failed to connect host 192.168.75.157 ((null)) on port 1183 - NT_STATUS_NETWORK_UNREACHABLE.0:CLASS_Win32_PerfRawData_PerfOS_Processor Failed to connect host 192.168.75.157 ((null)) on port 1183 - NT_STATUS_NETWORK_UNREACHABLE.1:Name 1:PercentProcessorTime Failed to connect host 192.168.75.157 ((null)) on port 1183 - NT_STATUS_NETWORK_UNREACHABLE.2:0 2:4257812500 Failed to connect host 192.168.75.157 ((null)) on port 1183 - NT_STATUS_NETWORK_UNREACHABLE.3:1 3:4067812500 Failed to connect host 192.168.75.157 ((null)) on port 1183 - NT_STATUS_NETWORK_UNREACHABLE.4:2 4:4169062500 Failed to connect host 192.168.75.157 ((null)) on port 1183 - NT_STATUS_NETWORK_UNREACHABLE.5:3 5:3910468750 Failed to connect host 192.168.75.157 ((null)) on port 1183 - NT_STATUS_NETWORK_UNREACHABLE.6:4 6:4276093750 Failed to connect host 192.168.75.157 ((null)) on port 1183 - NT_STATUS_NETWORK_UNREACHABLE.7:5 7:4224843750 Failed to connect host 192.168.75.157 ((null)) on port 1183 - NT_STATUS_NETWORK_UNREACHABLE.8:6 8:4183906250 Failed to connect host 192.168.75.157 ((null)) on port 1183 - NT_STATUS_NETWORK_UNREACHABLE.9:7 9:3995625000 Failed to connect host 192.168.75.157 ((null)) on port 1183 - NT_STATUS_NETWORK_UNREACHABLE.10:_Total 10:4135703125
The important part of which is (at a guess):

Code: Select all

Failed to connect host 192.168.75.157
Now when I try to use the WMI Query tool (from Ben Coleman) on my Windows machine which can see both interfaces it works fine....

I could create a subinterface on the cacti box on the 192 subnet, but would rather not.

I suspect a binding issue at the windows server, but have not been able to find any info about "binding" wmi to specific interfaces - although I have changed the binding order so that the 10 subnet card is first in the order....

BTW the command I ran to get the error above is:

Code: Select all

 /usr/bin/php -q /var/www/html/scripts/wmi.php 10.0.254.17 cacti Win32_PerfRawData_PerfOS_Processor PercentProcessorTime
Any ideas?
No longer a n00by, probably, by now an 0ldby

Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
argon0
Cacti User
Posts: 460
Joined: Fri Mar 12, 2004 1:22 pm

Post by argon0 »

Anybody created a graph to monitor Backups - this should be doable via WMI.....

Doing WBemtest on the Backup Server shows up some namespaces/classes for Backup Exec....

If I can work out how to query them and what would be useful to query (actually the most difficult thing) I shall try and put something together after I've added all my servers (and got wmi working on them all -it seems to take me about an hour per server at the moment - particularly as I seem to keep losing the ability to query the MicrosoftExchangeV2 namespace)...
No longer a n00by, probably, by now an 0ldby

Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
dainiookas
Posts: 34
Joined: Fri Dec 05, 2008 5:49 am
Location: Vilnius, Lithuania

Post by dainiookas »

Hi,
Anybody used the disk I/O template to monitor other disks than C: ?
Everything is OK when I monitor C, but when I try to monitor D it makes empty graphs.
I checked cacti log and here's what it shows:
For drive c:
03/12/2009 01:44:07 PM - SPINE: Poller[0] Host[2938] DS[12206] SCRIPT: /usr/bin/php -q /usr/share/cacti/site/scripts/wmi.php xx.xx.xx.xx host1 Win32_PerfRawData_PerfDisk_LogicalDisk DiskWritesPersec,DiskWriteBytesPersec,DiskReadsPersec,DiskReadBytesPersec,CurrentDiskQueueLength Name C:, output: CurrentDiskQueueLength:0 DiskReadBytesPersec:58648576 DiskReadsPersec:4415 DiskWriteBytesPersec:83444736 DiskWritesPersec:13803

For drive D:

03/12/2009 01:44:07 PM - SPINE: Poller[0] Host[2938] DS[12207] SCRIPT: /usr/bin/php -q /usr/share/cacti/site/scripts/wmi.php xx.xx.xx.xx host1 Win32_PerfRawData_PerfDisk_LogicalDisk DiskWritesPersec,DiskWriteBytesPersec,DiskReadsPersec,DiskReadBytesPersec,CurrentDiskQueueLength Name D:, output: CurrentDiskQueueLength:0 DiskReadBytesPersec:165389312 DiskReadsPersec:13886 DiskWriteBytesPersec:1582001152 DiskWritesPersec:24280

This means it does read data from server and give it back in console - I just can't understand where I lose it.

I get zero values in the graph, zero values in the *.rrd file (dumped and checked it)

Any ideas from those, who use the system to monitor not only C disk.

Cheers!
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

dainiookas wrote:Hi,
Anybody used the disk I/O template to monitor other disks than C: ?
Everything is OK when I monitor C, but when I try to monitor D it makes empty graphs.
I checked cacti log and here's what it shows:
For drive c:
03/12/2009 01:44:07 PM - SPINE: Poller[0] Host[2938] DS[12206] SCRIPT: /usr/bin/php -q /usr/share/cacti/site/scripts/wmi.php xx.xx.xx.xx host1 Win32_PerfRawData_PerfDisk_LogicalDisk DiskWritesPersec,DiskWriteBytesPersec,DiskReadsPersec,DiskReadBytesPersec,CurrentDiskQueueLength Name C:, output: CurrentDiskQueueLength:0 DiskReadBytesPersec:58648576 DiskReadsPersec:4415 DiskWriteBytesPersec:83444736 DiskWritesPersec:13803

For drive D:

03/12/2009 01:44:07 PM - SPINE: Poller[0] Host[2938] DS[12207] SCRIPT: /usr/bin/php -q /usr/share/cacti/site/scripts/wmi.php xx.xx.xx.xx host1 Win32_PerfRawData_PerfDisk_LogicalDisk DiskWritesPersec,DiskWriteBytesPersec,DiskReadsPersec,DiskReadBytesPersec,CurrentDiskQueueLength Name D:, output: CurrentDiskQueueLength:0 DiskReadBytesPersec:165389312 DiskReadsPersec:13886 DiskWriteBytesPersec:1582001152 DiskWritesPersec:24280

This means it does read data from server and give it back in console - I just can't understand where I lose it.

I get zero values in the graph, zero values in the *.rrd file (dumped and checked it)

Any ideas from those, who use the system to monitor not only C disk.

Cheers!
Try turning up the debug level for Cacti and check out whats going on at the time its being called.

Also why are your drive letters not escaped? They should be C\: to ensure proper handling.
dainiookas
Posts: 34
Joined: Fri Dec 05, 2008 5:49 am
Location: Vilnius, Lithuania

Post by dainiookas »

That was quick :)

Correctec the escape character, but unfortunately it does not give a lot of information.

http://pastebin.com/m3d9b077d (extracted output)

C is ok and D is not, while the DEBUG gives completely the same messages.


BTW. Maybe you've the 8 core CPU load template? :)

Thanks!
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

Can't see why its not recording data into your RRD. My first thoughts would be permissions over the file but then if you made them both the same way they should be correct.

This is similar to what I am seeing for one of my test scripts which is a complete data query for handling disks. The data query returns the right data but cacti just doesn't want to deal with it. I've not had time to debug it but its so similar. What is throwing me off is that C: is working...

Was it writing 0's or NaN's?

I'm guessing you meant do I have an 8 core cpu graph template? There is an 8 core graph template in SVN at the moment if you want to try it out. I've always had an 8 core data template to monitor some machines, but hadn't got around to making a graph to suit till recently.
dainiookas
Posts: 34
Joined: Fri Dec 05, 2008 5:49 am
Location: Vilnius, Lithuania

Post by dainiookas »

It's writing 0's. Some kind of mystics :)
Cannot really understand that.

I took the DISK I/O template from /tags/0.0.5/templates

Maybe I should try taking it from trunk or is it the same.

Thanks for the 8 core template, try it soon :)
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

You could try the one from trunk. I don't think it's much different to be honest. I'd say you have some other funky stuff going on lol.

Also to everyone...

Please make sure you are running the latest version of wmic (1.2.2 as of writing). This fixes some issues with the CPU usage query.

The stock version with debian unstable 1.1.3 will crash when running the query on Win32_PerfFormattedData_PerfOS_Processor when using IP's (and hostnames in some cases) and also just displays some really odd behavior.
ericgearhart
Posts: 11
Joined: Wed Feb 11, 2009 12:59 pm
Contact:

Post by ericgearhart »

claymen wrote:Also to everyone...

Please make sure you are running the latest version of wmic (1.2.2 as of writing). This fixes some issues with the CPU usage query.

The stock version with debian unstable 1.1.3 will crash when running the query on Win32_PerfFormattedData_PerfOS_Processor when using IP's (and hostnames in some cases) and also just displays some really odd behavior.
Any word on where to get version 1.2.2? I've been googling like a madman and I can't find a tarball of 1.2.2

I'm running Debian Lenny and I think I've got the dreaded wmic 1.1.3 because as you said it exhibits "weird" behavior

Code: Select all

/usr/bin/php -q /var/www/cacti/scripts/wmi.php testserver credential Win32_PerfFormattedData_PerfOS_Processor PercentProcessorTime

INTERNAL ERROR: Signal 6 in pid 11364 (4.0.0alpha3-GIT-UNKNOWN)0:Please_read_the_file_BUGS.txt_in_the_distribution INTERNAL ERROR: Signal 6 in pid 11364
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

Yup that looks like the behaviour :(

Here is where u can get the latest versions
http://dev.zenoss.org/svn/trunk/inst/externallibs/

and here is a link directly to 1.2.2
http://dev.zenoss.org/svn/trunk/inst/ex ... .2.tar.bz2
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests