Monitor Windows via WMI from Cacti on Linux

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

Moderators: Moderators, Developers

Post Reply
Author
Message
nuzzy
Posts: 42
Joined: Mon Feb 23, 2009 10:33 am

IIS - Requests weirdness

#616 Post by nuzzy » Thu Aug 26, 2010 1:21 pm

I'm running the IIS - Request against a 2008 R2 server. I'm getting errors in my Cacti log file and when I copy the command from that I get the following (I've replaced my server with SERVERNAME):

Code: Select all

/usr/bin/php -q /var/www/html/cacti/scripts/wmi.php -h 'SERVERNAME' -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,UnlockRequestsPerse'
NTSTATUS: NT code 0x80041017 - NT code 0x80041017


Return code non-zero, debug mode enabled!



/usr/local/bin/wmic --namespace='root\CIMV2' --authentication-file=/etc/cacti/cactiwmi.pw //SERVERNAME "SELECT CopyRequestsPersec,DeleteRequestsPersec,GetRequestsPersec,HeadRequestsPersec,LockRequestsPersec,MkcolRequestsPersec,MoveRequestsPersec,OptionsRequestsPersec,OtherRequestMethodsPersec,PostRequestsPersec,PropfindRequestsPersec,ProppatchRequestsPersec,PutRequestsPersec,SearchRequestsPersec,TraceRequestsPersec,UnlockRequestsPerse FROM Win32_PerfRawData_W3SVC_WebService WHERE Name='_Total'"
Exec Status: 1

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

If I run the command from the poller cache it works fine:

Code: Select all

/usr/bin/php -q /var/www/html/cacti/scripts/wmi.php -h 'SERVERNAME' -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'
CopyRequestsPersec:0 DeleteRequestsPersec:0 GetRequestsPersec:4282 HeadRequestsPersec:192 LockRequestsPersec:0 MkcolRequestsPersec:0 MoveRequestsPersec:0 Name:_Total OptionsRequestsPersec:0 OtherRequestMethodsPersec:0 PostRequestsPersec:1213 PropfindRequestsPersec:0 ProppatchRequestsPersec:0 PutRequestsPersec:0 SearchRequestsPersec:0 TraceRequestsPersec:0 UnlockRequestsPersec:0
Any ideas as to why this is happening?
Cacti 0.8.8a on CentOS

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

#617 Post by claymen » Thu Aug 26, 2010 5:20 pm

Can you try running the command from the poller cache *as* the user the poller runs as? Make sure that user can access the password file.

nuzzy
Posts: 42
Joined: Mon Feb 23, 2009 10:33 am

#618 Post by nuzzy » Fri Aug 27, 2010 7:37 am

I know what it is. If you look at the last value 'UnlockRequestsPersec', Cacti is stripping of the last character, so it's reading 'UnlockRequestsPerse'. It looks like either a cacti bug or a character limitation issue. I'll try to just use the hostname and see if it works.
Cacti 0.8.8a on CentOS

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

#619 Post by claymen » Sun Aug 29, 2010 2:47 am

Hah, that's a new one. Ah well good find.

User avatar
phalek
Cacti Guru User
Posts: 2735
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: Monitor Windows via WMI from Cacti on Linux

#620 Post by phalek » Sun Oct 17, 2010 1:26 pm

As i was unable to find a link to a wmic binary for Centos 5.5. 32bit which is cabable of communicating with Windows 7 64bit and Windows Server 2008 R2 64 bit, i just compiled it.

You can download it here: http://www.network-outsourcing.de/uploa ... _32bit.tgz
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusTransporter | CereusReporting | nmidWebService | nmidSmokeping | nmidWeb2 |

Code: Select all

CereusServer Master:  SYSTEM STATS: Time:2.5621 Method:spine Processes:1 Threads:16 Hosts:446 HostsPerProcess:446 DataSources:14683 RRDsProcessed:7573
CereusServer Agent:   SYSTEM STATS: Time:27.4840 Method:spine Processes:1 Threads:8 Hosts:16 HostsPerProcess:16 DataSources:114576 RRDsProcessed:48061

praetor
Posts: 2
Joined: Thu Nov 25, 2010 12:39 am

Re: Monitor Windows via WMI from Cacti on Linux

#621 Post by praetor » Mon Dec 06, 2010 6:18 pm

phalek wrote:As i was unable to find a link to a wmic binary for Centos 5.5. 32bit which is cabable of communicating with Windows 7 64bit and Windows Server 2008 R2 64 bit, i just compiled it.

You can download it here: http://www.network-outsourcing.de/uploa ... _32bit.tgz
Thanks for that. Fixes an intermittant bug which others have reported all through this thread as well. All my queries run every time now :)

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

Re: Monitor Windows via WMI from Cacti on Linux

#622 Post by claymen » Mon Dec 06, 2010 8:29 pm

What actual version was that compiled from? It would be good to know for reference as the source for wmic changes reasonably often. Knowing which builds might help prevent problems :)

md88dg
Posts: 7
Joined: Tue Jan 04, 2011 1:35 am
Location: Germany

Re: Monitor Windows via WMI from Cacti on Linux

#623 Post by md88dg » Wed Jan 26, 2011 6:16 am

Hello,

i have attached three templates for Windows to get stats from a Terminalserver, 16 Core CPU and Print Spooler.
wmi_windows_ts_sessions.zip
Graph and data template for TS Sessions
(5.07 KiB) Downloaded 485 times
wmi_windows_16_cpu.zip
Graph and data template for 16 Core CPU
(11.34 KiB) Downloaded 427 times
wmi_spooler_stats.zip
Graph and data template for Spooler
(9.7 KiB) Downloaded 419 times
the templates are creates with cacti version 0.8.7g
Cacti 0.8.7g
PIA 2.8
PHP 5.1.6
MySQL 5.0.82sp1
RRDTool 1.2.23
SNMP 5.1.2

400 Hosts
4000 RRDs
8000 Data Sources

md88dg
Posts: 7
Joined: Tue Jan 04, 2011 1:35 am
Location: Germany

Re: Monitor Windows via WMI from Cacti on Linux

#624 Post by md88dg » Fri Jan 28, 2011 7:11 am

Hello,

here is the ts session template for 2008 servers, because the wmi class has changed.
wmi_windows_ts_sessions.zip
(4.96 KiB) Downloaded 498 times
Cacti 0.8.7g
PIA 2.8
PHP 5.1.6
MySQL 5.0.82sp1
RRDTool 1.2.23
SNMP 5.1.2

400 Hosts
4000 RRDs
8000 Data Sources

netlin

Re: Monitor Windows via WMI from Cacti on Linux

#625 Post by netlin » Thu Feb 10, 2011 2:34 pm

Hi there. I have a problem that I need some help with...

Until recently I only "monitored" a Windows 7 box and a XP box. No (real) problems here.

Then I got my hands on a 2003 server and a 2007 exchange server. Both virtual and both out of my domain.

If I query them through a WMI tester from another Windows machine things work fine - I get values.

If I try to query through Linux I get:

Code: Select all

[20:03][[email protected] wmi ]# /usr/local/bin/wmic -U "username%password" //ip_address "SELECT * FROM SELECT * FROM Win32_OperatingSystem"
[librpc/rpc/dcerpc_connect.c:329:dcerpc_pipe_connect_ncacn_ip_tcp_recv()] failed NT status (c0000236) in dcerpc_pipe_connect_ncacn_ip_tcp_recv
[librpc/rpc/dcerpc_connect.c:790:dcerpc_pipe_connect_b_recv()] failed NT status (c0000236) in dcerpc_pipe_connect_b_recv
[wmi/wmic.c:196:main()] ERROR: Login to remote object.
NTSTATUS: NT_STATUS_CONNECTION_REFUSED - NT_STATUS_CONNECTION_REFUSED
I use CentOS 5.4 and my WMIC built is 1.3.14. At first I used a "pre-build" WMIC for 5.5 that I snached from this thread, so at first I thought that might be the problem. Today I compiled WMIC myself and things have not changed - still works for first two hosts and does not work for the second two.

Any help would greatly be appreciated.

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

Re: Monitor Windows via WMI from Cacti on Linux

#626 Post by claymen » Thu Feb 10, 2011 7:07 pm

Something funny with auth? I'm not entirely sure. Can you manually specify the domain so it's not attempting a local logon or something.

acleech
Posts: 6
Joined: Thu Sep 20, 2007 10:09 am
Location: San Angelo, TX

Re: Monitor Windows via WMI from Cacti on Linux

#627 Post by acleech » Thu Mar 24, 2011 4:27 pm

Hello all,

I'm trying to get the NTDS scripts working against a 2008 R2 domain controller.

The script was returning an error when I run it from the command line, so I pulled the counters one at a time. All of them returned values, but for some reason it's not able to pull the KerberosAuthentications and NTLMAuthentications. I can't figure out what the deal is, I've searched for everything I can think of. I can see the counters in perfmon on the server, and went through wbemtest and saw they were in there.

It works fine against our 2003 server. I'm new to running this on Linux, and open to any ideas on how to fix this. Thanks for the awesome scripting, up to this point it's worked great!

Code: Select all

[[email protected] bin]#  /usr/bin/php -q /var/www/html/scripts/wmi.php -h '172.16.10.80' -u '/etc/cacti/cactiwmi.pw' -w 'Win32_PerfRawData_NTDS_NTDS' -n '' -k '' -v '' -c 'NTLMAuthentication'
NTSTATUS: NT code 0x80041017 - NT code 0x80041017


Return code non-zero, debug mode enabled!



/bin/wmic --namespace='root\CIMV2' --authentication-file=/etc/cacti/cactiwmi.pw //172.16.10.80 "SELECT NTLMAuthentication FROM Win32_PerfRawData_NTDS_NTDS"
Exec Status: 1

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

Notice: Undefined offset:  1 in /var/www/html/scripts/wmi.php on line 120
Edit: I don't know if it matters or not, but in perfmon these two counters show up under "Security System-Wide Statistics" instead "NTDS" like the other ones.
Cacti Version - 1.2.6
Poller Type - SPINE 1.2.6
Server Info - CentOS7
Database - MariaDB 10.3.17
Web Server - Apache 2.4.6
SNMP - NET-SNMP 5.7.2
RRDTool - Version 1.4.8
PHP - 7.3.9

acleech
Posts: 6
Joined: Thu Sep 20, 2007 10:09 am
Location: San Angelo, TX

Re: Monitor Windows via WMI from Cacti on Linux

#628 Post by acleech » Fri Mar 25, 2011 12:04 pm

Nevermind - I finally got it. I had to write new templates for 2008 servers - those two values are in Win32_PerfRawData_Lsa_SecuritySystemWideStatistics. So now for the NTDS stats I have two Graph Templates and two new Data Templates.

If anybody is interested I could attempt to export them and up load them here. I guess this is how you learn to do this stuff! lol
Cacti Version - 1.2.6
Poller Type - SPINE 1.2.6
Server Info - CentOS7
Database - MariaDB 10.3.17
Web Server - Apache 2.4.6
SNMP - NET-SNMP 5.7.2
RRDTool - Version 1.4.8
PHP - 7.3.9

c3226026
Cacti User
Posts: 87
Joined: Mon Jan 17, 2011 12:15 pm

Re: Monitor Windows via WMI from Cacti on Linux

#629 Post by c3226026 » Fri Mar 25, 2011 4:37 pm

acleech wrote:Nevermind - I finally got it. I had to write new templates for 2008 servers - those two values are in Win32_PerfRawData_Lsa_SecuritySystemWideStatistics. So now for the NTDS stats I have two Graph Templates and two new Data Templates.

If anybody is interested I could attempt to export them and up load them here. I guess this is how you learn to do this stuff! lol
Yes I'm interested, thanks in advanced.

User avatar
Echinocactus
Posts: 7
Joined: Mon Nov 08, 2010 2:43 pm

Re: Monitor Windows via WMI from Cacti on Linux

#630 Post by Echinocactus » Tue Apr 19, 2011 7:11 am

acleech wrote:Nevermind - I finally got it. I had to write new templates for 2008 servers - those two values are in Win32_PerfRawData_Lsa_SecuritySystemWideStatistics. So now for the NTDS stats I have two Graph Templates and two new Data Templates.

If anybody is interested I could attempt to export them and up load them here. I guess this is how you learn to do this stuff! lol
Yes, i'm interested too. :lol:

Post Reply