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 »

How does one tell which version one has?

I run wmic -V and get
Version 4.0.0tp4-SVN-build-UNKNOWN
Also, not sure what is going on here...

I can query, and get graphs of, my SQL server 2005 instances - via the query

Code: Select all

/usr/bin/php -q /var/www/html/scripts/wmi.php 192.168.x.x cacti Win32_PerfRawData_MSSQLLIVE2005_MSSQLLIVE2005SQLStatistics BatchRequestsPersec
However if I run a similar query (the standard one you supply), it doesn't work.

Code: Select all

 /usr/bin/php -q /var/www/html/scripts/wmi.php 10.0.10.31 cacti Win32_PerfRawData_MSSQLSERVER_SQLServerSQLStatistics BatchRequestsPersec
I get:

Code: Select all

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

Notice: Undefined offset:  0 in /var/www/html/scripts/wmi.php on line 87

And no graphs (well the graphs are all 0).

But if I check the server with wbemtest the namespace is there, and I can monitor via perfmon either remotely or locally the Win32_PerfRawData_MSSQLSERVER_SQLServerSQLStatistics BatchRequestsPersec counter (for instance).

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 »

Just thought I'd post back a template I "altered" to get the % working on the Available Disk Space graph - a really simple change...
Attachments
cacti_graph_template_windows_-_available_disk_space_wmi_working.xml
(18.56 KiB) Downloaded 204 times
No longer a n00by, probably, by now an 0ldby

Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

In regards to the SQL query, turn on debugging mode 1 grab the full wmic query it is calling and try it manually.

The php error generally means wmic failed to query for some reason and I don't have much in the way of gracefully dealing with those errors although I am looking at it.

On the graph template, what wasn't working? Was it simply the CDEF?
greg4tw
Posts: 10
Joined: Thu Mar 19, 2009 4:35 am
Location: Germany

Post by greg4tw »

Hello,
I get in my Cacti Log File the following Items:

Code: Select all

03/19/2009 10:22:36 AM - SYSTEM STATS: Time:4.7661 Method:spine Processes:4 Threads:4 Hosts:107 HostsPerProcess:27 DataSources:557 RRDsProcessed:317
03/19/2009 10:22:34 AM - SPINE: Poller[0] Host[170] DS[1029] WARNING: Result from SCRIPT not valid. Partial Result: ...
03/19/2009 10:22:34 AM - SPINE: Poller[0] Host[170] ERROR: Empty result [185.30.15.10]: '/usr/bin/php -q /var/www/cacti/scripts/wmi.php 185.30.15.10 credential Win32_ComputerSystem TotalPhysicalMemory '
03/19/2009 10:22:34 AM - SPINE: Poller[0] Host[170] DS[1028] WARNING: Result from SCRIPT not valid. Partial Result: ...
03/19/2009 10:22:34 AM - SPINE: Poller[0] Host[170] ERROR: Empty result [185.30.15.10]: '/usr/bin/php -q /var/www/cacti/scripts/wmi.php 185.30.15.10 credential Win32_PerfRawData_PerfOS_Memory CommittedBytes,AvailableBytes,CommitLimit '
03/19/2009 10:22:33 AM - SPINE: Poller[0] Host[170] DS[1027] WARNING: Result from SCRIPT not valid. Partial Result: ...
03/19/2009 10:22:33 AM - SPINE: Poller[0] Host[170] ERROR: Empty result [185.30.15.10]: '/usr/bin/php -q /var/www/cacti/scripts/wmi.php 185.30.15.10 credential Win32_PerfRawData_PerfDisk_LogicalDisk DiskWritesPersec,DiskWriteBytesPersec,DiskReadsPersec,DiskReadBytesPersec,CurrentDiskQueueLength Name C'
03/19/2009 10:22:33 AM - SPINE: Poller[0] Host[170] DS[1026] WARNING: Result from SCRIPT not valid. Partial Result: ...
03/19/2009 10:22:33 AM - SPINE: Poller[0] Host[170] ERROR: Empty result [185.30.15.10]: '/usr/bin/php -q /var/www/cacti/scripts/wmi.php 185.30.15.10 credential Win32_LogicalDisk Size,FreeSpace DeviceID C'
03/19/2009 10:22:33 AM - SPINE: Poller[0] Host[170] DS[1025] WARNING: Result from SCRIPT not valid. Partial Result: ...
03/19/2009 10:22:33 AM - SPINE: Poller[0] Host[170] ERROR: Empty result [185.30.15.10]: '/usr/bin/php -q /var/www/cacti/scripts/wmi.php 185.30.15.10 credential Win32_PerfRawData_MSSQLSERVER_SQLServerTransactions Transactions '
03/19/2009 10:22:33 AM - SPINE: Poller[0] Host[170] DS[1024] WARNING: Result from SCRIPT not valid. Partial Result: ...
03/19/2009 10:22:33 AM - SPINE: Poller[0] Host[170] ERROR: Empty result [185.30.15.10]: '/usr/bin/php -q /var/www/cacti/scripts/wmi.php 185.30.15.10 credential Win32_PerfRawData_MSSQLSERVER_SQLServerSQLStatistics BatchRequestsPersec '
03/19/2009 10:22:33 AM - SPINE: Poller[0] Host[170] DS[1023] WARNING: Result from SCRIPT not valid. Partial Result: ...
03/19/2009 10:22:33 AM - SPINE: Poller[0] Host[170] ERROR: Empty result [185.30.15.10]: '/usr/bin/php -q /var/www/cacti/scripts/wmi.php 185.30.15.10 credential Win32_PerfRawData_MSSQLSERVER_SQLServerBufferManager Buffercachehitratio,Buffercachehitratio_Base ' 
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

greg4tw wrote:Hello,
I get in my Cacti Log File the following Items:
What happens when you run the command directly? E.g. grab the full script path and arguments from the poller cache and run it yourself?
greg4tw
Posts: 10
Joined: Thu Mar 19, 2009 4:35 am
Location: Germany

Post by greg4tw »

I have found my (some) Errors, but now I have new Errors :)
When I run the command directly in the Shell, i get:

COMMAND:

Code: Select all

/usr/bin/php -q /var/www/cacti/scripts/wmi.php 185.30.15.10 cacti Win32_PerfRawData_MSSQLSERVER_SQLServerBufferManager Buffercachehitratio,Buffercachehitratio_Base '
OUTPUT:

Code: Select all

NTSTATUS: NT code 0x0041017 - NT code 0xc0041017
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

Could be a few things.

1. permissions (admin or non admin calling WMI).
2. wmi classes missing.
3. calling the wrong sql class due to instancing.
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

"All" template - Unmet Dependencies

Post by mcutting »

Claymen

When importing the "All" template, there appear to be unmet dependencies

[success] Windows - Context Switches (WMI) [update]
+ Unmet Dependency: (Data Template Item)
+ Found Dependency: (GPRINT Preset) Normal
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
[success] Windows - Processor Queue Length (WMI) [update]
+ Unmet Dependency: (Data Template Item)
+ Found Dependency: (GPRINT Preset) Normal
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
[success] Windows - Processes (WMI) [update]
+ Unmet Dependency: (Data Template Item)
+ Found Dependency: (GPRINT Preset) Normal
+ Unmet Dependency: (Data Template Item)
+ Found Dependency: (GPRINT Preset) Exact Numbers
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
[success] Windows - System Calls (WMI) [update]
+ Unmet Dependency: (Data Template Item)
+ Found Dependency: (GPRINT Preset) Normal
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)
+ Unmet Dependency: (Data Template Item)

Any ideas ?

Thanks
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

To be honest not sure, I had the same issues earlier but it was exported with full dependancies. I'll re-export it shortly. Can you log a bug for it to remind me.
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Post by mcutting »

claymen wrote:To be honest not sure, I had the same issues earlier but it was exported with full dependancies. I'll re-export it shortly. Can you log a bug for it to remind me.
Done - ID 0000010
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
argon0
Cacti User
Posts: 460
Joined: Fri Mar 12, 2004 1:22 pm

Post by argon0 »

<erm> I posted the command in the first place... Its returning the error from the command line, but not from the Cacti Log.

AS to the graph, it didn't have a CDEF to calculate the percentage, it was just using the %free datasource, which seems to be returning nan...

Argon0
No longer a n00by, probably, by now an 0ldby

Now Head of Technology at RSCH, back to the prickly subject of Monitorring....
greg4tw
Posts: 10
Joined: Thu Mar 19, 2009 4:35 am
Location: Germany

Post by greg4tw »

claymen wrote:Could be a few things.

1. permissions (admin or non admin calling WMI).
2. wmi classes missing.
3. calling the wrong sql class due to instancing.
wmiadap /f has helped me :)
but i must change manuelly the credentials in the data templates..
the SQL - Performance, available disk space, cpu usage works with graphs
disk i/o only with realtime plugin, no normal graph
the other templates didnt work :(
outspoken
Posts: 17
Joined: Thu Nov 20, 2008 4:51 pm

Post by outspoken »

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

Post by claymen »

greg4tw wrote:
claymen wrote:Could be a few things.

1. permissions (admin or non admin calling WMI).
2. wmi classes missing.
3. calling the wrong sql class due to instancing.
wmiadap /f has helped me :)
but i must change manuelly the credentials in the data templates..
the SQL - Performance, available disk space, cpu usage works with graphs
disk i/o only with realtime plugin, no normal graph
the other templates didnt work :(
Why are you having to change the credential in the data templates? Ideally you could just update the wmi-logins.php reference...

If you aren't using Cacti 0.8.7b you will need to adjust CDEF's on some of the graphs because they changed the way in which they handled graph inputs which is what I develop on. Pre and post 0.8.7b they went back to the old way.
greg4tw
Posts: 10
Joined: Thu Mar 19, 2009 4:35 am
Location: Germany

Post by greg4tw »

because when i only update the wmi-logins.php, in the data templates there is still in the column credential the value credential set...
03/19/2009 10:22:34 AM - SPINE: Poller[0] Host[170] ERROR: Empty result [185.30.15.10]: '/usr/bin/php -q /var/www/cacti/scripts/wmi.php 185.30.15.10 credential Win32_ComputerSystem TotalPhysicalMemory '
I am using Cacti 0.8.7d.

How i adjust these CDEF's?
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests