Monitor Windows via WMI from Cacti on Linux

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

Moderators: Developers, Moderators

Post Reply
mphuie
Posts: 11
Joined: Wed Feb 18, 2009 2:56 pm

Post by mphuie »

Does anyone know if there are any changes to be made to the addon (other than the PHP script) to install this for Cacti running on Windows?

I have several domain controllers where we don't want to hard code the user/pass of a domain admin account.

I've imported the XML and already modified wmi.php to use VBscript to call WMI instead of WMIC, and set the credentials in the scheduled task. I have verified that the poller command returns the correct data, but I'm getting an RRD error. SNMP graphs are fine.

RRDTool Says:
ERROR: invalid rpn expression in: e,i,-

I have CactiWMI running perfectly on a *nix machine, but I'm wondering if my configuration on Windows is good, but the addon is broken (when installed under Windows) and requires some other internal(?) change.
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Re: Graphs only kinda working...

Post by claymen »

wdennis wrote:Hi all

My environment:
Target Machine - Windows 2003 Server, Std Edn, SP2
Cacti Machine - CentOS release 5.3 (2.6.18-128.1.6.el5)
Cacti 0.8.7d
WMIC Version 4.0.0alpha3-GIT-UNKNOWN
PHP 5.1.6
Templates 0.0.6-r101
RRDTool 1.2.30

I have set up the following graphs based on these templates:
Windows - CPU Usage - 4CPU (WMI)
Windows - Disk I/O (WMI)
Windows - Disk Space (WMI)
Windows - Memory (WMI)
Windows - Total Phyiscal Memory (WMI)

The Disk Space and CPU Usage graphs appear to be working, but the Disk I/O and Memory Usage graphs are not displaying ("red X").

I appear to have wmi.php working correctly:

cacti@cactiserver cacti> /usr/bin/php -q /var/www/cacti/scripts/wmi.php -h 111.222.333.444 -u /etc/cacti/auth.txt -w Win32_PerfRawData_PerfDisk_LogicalDisk -n 'root\CIMV2' -k '' -v '' -c 'DiskWritesPersec,DiskWriteBytesPersec,DiskReadsPersec,DiskReadBytesPersec,CurrentDiskQueueLength'

CurrentDiskQueueLength0:0
DiskReadBytesPersec0:327549485568
DiskReadsPersec0:27095198
DiskWriteBytesPersec0:54619426304
DiskWritesPersec0:3332334
Name0:C
CurrentDiskQueueLength1:0
DiskReadBytesPersec1:327549485568
DiskReadsPersec1:27095198
DiskWriteBytesPersec1:54619

What should I look at?

BTW, it seems that if I turn on the '$dbug = 1;' in wmi.php, the working graphs stop recording data, and there is no log file created in /var/log/cacti/wmi/ which is the $log_location in wmi.php. (The 'cacti' user does have write perm's to that path.) Also, there is no references to wmi.php in the standard cacti log (/var/log/cacti/log)

Any help gratefully appreciated.... This is a wondeful addition to Cacti, and I'm really looking forward to getting this all working!

Thanks,
Will
Enabling debug level 1 alters the output of the script and will break data logging when cacti polls. Generally its prefered to use -d1 instead for debugging on the console. Setting debug to level 2 in the wmi.php file doesnt affect output but dumps a logging info out to wherever you specify. Just make sure that the cacti user can write there.

I've mentioned this multiple times but if your using anything other than 0.8.7b you will have to update the CDEF's! Go back through some of the older posts as it is a known issue because of the way Cacti handled its data inputs on the graph. In 0.8.7b it changed and then they changed it back in 0.8.7d.
Last edited by claymen on Tue Apr 28, 2009 7:38 pm, edited 1 time in total.
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

outspoken wrote:I just answered my above question... I went into the Graph Template for CPU and edited the Graph Item Inputs, then removed GPRINT (MAX) from all of the cores.

Not sure if this will make things report incorrectly but the graphs are working now.
No idea why you had issues, but again its probably related to 0.8.7d vs 0.8.7b. They added extra DEF's to the graph to improve the accuracy of the graph, this is why it breaks the CDEF's because they rely on the DEF's staying as they are, when you add extra's in it stops working.
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

mphuie wrote:Does anyone know if there are any changes to be made to the addon (other than the PHP script) to install this for Cacti running on Windows?

I have several domain controllers where we don't want to hard code the user/pass of a domain admin account.

I've imported the XML and already modified wmi.php to use VBscript to call WMI instead of WMIC, and set the credentials in the scheduled task. I have verified that the poller command returns the correct data, but I'm getting an RRD error. SNMP graphs are fine.

RRDTool Says:
ERROR: invalid rpn expression in: e,i,-

I have CactiWMI running perfectly on a *nix machine, but I'm wondering if my configuration on Windows is good, but the addon is broken (when installed under Windows) and requires some other internal(?) change.
Your CDEF is broken. But with that said are you even getting any data? Check your cacti logs.
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Re: Script and or template for MSSQL database size and log u

Post by claymen »

stormonts wrote:We are running Version 0.8.7b on Linux and MSSQL 2005 on a Windows server.

I was looking for a script / templates so that I could graph the size of each MSSQL database and the total size of a log file with the amount of that file used.

I tried doing this with Erwan's snmptool by assigning OIDs to the various processes, but it wasn't working reliably.

Thanks!
Grab Scriptomatic and if you can find the WMI classes which return that data then I can knock up a template for you easily enough.
mphuie
Posts: 11
Joined: Wed Feb 18, 2009 2:56 pm

Post by mphuie »

claymen wrote:
mphuie wrote:Does anyone know if there are any changes to be made to the addon (other than the PHP script) to install this for Cacti running on Windows?

I have several domain controllers where we don't want to hard code the user/pass of a domain admin account.

I've imported the XML and already modified wmi.php to use VBscript to call WMI instead of WMIC, and set the credentials in the scheduled task. I have verified that the poller command returns the correct data, but I'm getting an RRD error. SNMP graphs are fine.

RRDTool Says:
ERROR: invalid rpn expression in: e,i,-

I have CactiWMI running perfectly on a *nix machine, but I'm wondering if my configuration on Windows is good, but the addon is broken (when installed under Windows) and requires some other internal(?) change.
Your CDEF is broken. But with that said are you even getting any data? Check your cacti logs.
No errors in my cacti logs. Data is in the RRD

Code: Select all

rrdtool.exe fetch server01_availablebytes_15.rrd AVERAGE -s -1h -e -300

                 AvailableBytes         CommitLimit      CommittedBytes

1241023800: 5.3891876181e+008 4.1392332800e+009 1.2867626598e+009
1241024100: 5.5737344000e+008 4.1392332800e+009 1.2885604352e+009
1241024400: 5.5186247680e+008 4.1392332800e+009 1.2887990272e+009
1241024700: 5.5011759445e+008 4.1392332800e+009 1.2888853163e+009
Not sure what the CDEF is other than a parameter in rrdtool, can you elaborate on what I need to change? I've also tried going to the same version of rrdtool on my linux cacti machine (1.2.23 - from 1.2.30) with no luck.

I've attached the RRDtool error output.

Thanks
Attachments
rrdtool_error.txt
RRDtool output
(1.41 KiB) Downloaded 272 times
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

Under graph management then goto CDEF's.

Here is an example rrdtool graph debug from 0.8.7b

Code: Select all

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="WA - Exchange - Active Client Logons - Total" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="Logons" \
--slope-mode \
--font TITLE:8: \
--font AXIS:8: \
--font LEGEND:8: \
--font UNIT:8: \
DEF:a="/var/www/cacti/rra/_-__recvqueue_19894.rrd":ActiveClientLogons:AVERAGE \
DEF:b="/var/www/cacti/rra/_-__recvqueue_19894.rrd":ActiveClientLogons:LAST \
DEF:c="/var/www/cacti/rra/_-__recvqueue_19894.rrd":ActiveClientLogons:MIN \
DEF:d="/var/www/cacti/rra/_-__recvqueue_19894.rrd":ActiveClientLogons:MAX \
AREA:a#FF000033:""  \
LINE1:a#FF0000FF:"Total\:"  \
GPRINT:b:LAST:"Current\:%8.0lf"  \
GPRINT:a:AVERAGE:"Average\:%8.0lf"  \
GPRINT:d:MAX:"Maximum\:%8.0lf\n" 
See how it defines inputs on the graph e.g. DEF:a etc. On Cacti 0.8.7b it defines 4 for each data source. Hence a,b,c,d. On Cacti 0.8.7a and 0.8.7c and higher it uses from memory only two per data source. A CDEF is basically applying a mathematical function to the data, when it specifies that it is using e and i and suddenly those inputs don't exist or are not what it was expects it will break. E.g. on newer versions and some older versions because it has more or less defined rrd graph inputs it breaks the CDEF. You need to update your CDEF to reference the correct graph inputs as they will be different on your version of Cacti.

There is a post of mine on this link which goes through it with a direct comparasin between versions.
http://forums.cacti.net/viewtopic.php?t ... &start=105

This has been discussed a heap of times, pages 1,2 and 8 are probably the most useful ;)
tsumi
Posts: 7
Joined: Wed Apr 29, 2009 7:03 pm
Location: Austin, TX US

noobie mcnoobsalot reporting in

Post by tsumi »

SO. I think I have everything configured properly (obviously not). I am trying to use wmic to connect to the remote host and i get:

Code: Select all

root@sentry:/usr/share/cacti/site/scripts# wmic -U HMI\cacti%mypassword //10.10.10.12 "select * from Win32_ComputerSystem"
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
Now on the remote machine - a windows 2008 server - I get a success audit in security logs and an immidate logoff.

As far as permissions go, the cacti user is a member of DCOM, Domain Users, Pref Mon & Pref Log.

Can someone please point the lost noob at the delicious cake?

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

Re: noobie mcnoobsalot reporting in

Post by claymen »

tsumi wrote:SO. I think I have everything configured properly (obviously not). I am trying to use wmic to connect to the remote host and i get:

Code: Select all

root@sentry:/usr/share/cacti/site/scripts# wmic -U HM\cacti%mypassword //10.10.10.12 "select * from Win32_ComputerSystem"
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
Now on the remote machine - a windows 2008 server - I get a success audit in security logs and an immidate logoff.

As far as permissions go, the cacti user is a member of DCOM, Domain Users, Pref Mon & Pref Log.

Can someone please point the lost noob at the delicious cake?

Thanks.
I'm guessing it works with an admin credential? Does the user have permission over the WMI class CIMV2? That's about the only thing I can see you have missed.
tsumi
Posts: 7
Joined: Wed Apr 29, 2009 7:03 pm
Location: Austin, TX US

Re: noobie mcnoobsalot reporting in

Post by tsumi »

I'm guessing it works with an admin credential? Does the user have permission over the WMI class CIMV2? That's about the only thing I can see you have missed.
Does not work with admin credential (I tried that too). Yes the user has WMI class CIMV2 - root and all subs for that matter.
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

If it doesn't work with an admin credential then something else is amiss. If you run scriptomatic can you query the class? Also what about firewalls etc? Are both boxes on the same subnet etc?
tsumi
Posts: 7
Joined: Wed Apr 29, 2009 7:03 pm
Location: Austin, TX US

Post by tsumi »

claymen wrote:If it doesn't work with an admin credential then something else is amiss. If you run scriptomatic can you query the class? Also what about firewalls etc? Are both boxes on the same subnet etc?
First of all, I REALLY appreciate your timely responses and all of the work you have put into this. Thank you.

I am really new to this as of this week, I will google up "Scriptomatic" which i have seen mentioned around this and other posts.

Yes, both machines are on the same subnet. No internal firewalling.
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

Here it is attached.
Attachments
Scriptomatic2.zip
(303.31 KiB) Downloaded 269 times
tsumi
Posts: 7
Joined: Wed Apr 29, 2009 7:03 pm
Location: Austin, TX US

Post by tsumi »

claymen wrote:Here it is attached.
You rule bud. Nice work on the homebrew stuff BTW. How is that panning out?

I actually just grabbed this from http://www.microsoft.com/downloads/deta ... laylang=en and installed it on my 08 server.

I am sure that this has already been covered but I am really not sure what to do with this. Is there a previous forum post explaining what I should be doing here?
tsumi
Posts: 7
Joined: Wed Apr 29, 2009 7:03 pm
Location: Austin, TX US

Post by tsumi »

I will go ahead and read through this thread and try to dislodge my head from my bum.

Thanks so much! Good luck on the homebrew.
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests