Monitor Windows via WMI from Cacti on Linux

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

Moderators: Developers, Moderators

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

Post by claymen »

JorisFRST wrote:Get this in the log, but rrd file is not created ??

10/12/2009 05:00:07 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/cacti/rra/hers2004_readbytespersec_1388.rrd --template QueueLength:ReadBytesPersec:ReadsPersec:WriteBytesPersec:WritesPersec N:0:5856099328:405102:11258483712:493841
10/12/2009 05:00:07 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool create /var/www/cacti/rra/hers2004_readbytespersec_1388.rrd --step 300 DS:ReadBytesPersec:COUNTER:600:0:100000000000000000 DS:WritesPersec:COUNTER:600:0:100000000000 DS:ReadsPersec:COUNTER:600:0:100000000000 DS:QueueLength:GAUGE:600:0:10000 DS:FreeSpace_Base:GAUGE:600:0:10000000 DS:FreeSpace:GAUGE:600:0:10000000 DS:WriteBytesPersec:COUNTER:600:0:100000000000000000 DS:WriteBytesPersec:COUNTER:600:0:100000000000000000 DS:ReadBytesPersec:COUNTER:600:0:100000000000000000 RRA:AVERAGE:0.5:1:500 RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MIN:0.5:1:600 RRA:MIN:0.5:6:700 RRA:MIN:0.5:24:775 RRA:MIN:0.5:288:797 RRA:MAX:0.5:1:500 RRA:MAX:0.5:1:600 RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797 RRA:LAST:0.5:1:600 RRA:LAST:0.5:6:700 RRA:LAST:0.5:24:775 RRA:LAST:0.5:288:797
10/12/2009 05:00:07 PM - CMDPHP: Poller[0] Host[90] Description[HERS2004] DS[1388] Graphs['HERS2004 - Disk I/O'] CMD: /usr/bin/php -q /var/www/cacti/scripts/wmi.php hers2004.brc.gbl credential Win32_PerfRawData_PerfDisk_LogicalDisk DiskWritesPersec,DiskWriteBytesPersec,DiskReadsPersec,DiskReadBytesPersec,CurrentDiskQueueLength Name C\:, output: CurrentDiskQueueLength:0 DiskReadBytesPersec:5856099328 DiskReadsPersec:405102 DiskWriteBytesPersec:11258483712 DiskWritesPersec:493841
Is anything working? Like any other graphs?
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

chrisru wrote:Hey Claymen,

Firstly the wmi graphing is perfect, would it be hard to build data queries for these graphs? after having a look at how you would do that I got stuck because it appears the script needs to provide a couple of methods the first being a count query to just provide a count and the second seems to be for selecting results by index. Have you looked into this at all?
I looked at doing data queries, they seem to be a right pain in the ass. I did have some test code floating around somewhere but cacti just didn't seem to want to record the data. I was toying with it for doing disk space and disk i/o.

I don't think the script as it is would be the best to for using as a base for data queries. I can think of a few ways to do it but I didn't really have the time to look at it.
User avatar
JorisFRST
Cacti User
Posts: 229
Joined: Mon Oct 02, 2006 1:22 pm
Location: Belgium
Contact:

Post by JorisFRST »

All other graphs work fine.

Cacti 0.8.7e
WMI works.
WMI memory graph works too.

Disk I/O on 2 different hosts selected, both don't write the rrd file.
Poller in debug comes up with no errors.

Bit stumped here as all other rrds are created fine, and I added a bunch of tcp ones yesterday, and they work too.

Graph debug :
RRDTool Command:

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="HERS2004 - Disk I/O" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="operations per/sec" \
--slope-mode \
--font TITLE:10: \
--font AXIS:6: \
--font LEGEND:8: \
--font UNIT:6: \
DEF:a="/var/www/cacti/rra/hers2004_readbytespersec_1388.rrd":ReadsPersec:AVERAGE \
DEF:b="/var/www/cacti/rra/hers2004_readbytespersec_1388.rrd":WritesPersec:AVERAGE \
DEF:c="/var/www/cacti/rra/hers2004_readbytespersec_1388.rrd":QueueLength:AVERAGE \
CDEF:cdefa=a,b,+ \
AREA:cdefa#BCBEB3FF:"Total\:" \
GPRINT:cdefa:LAST:" Current\:%8.2lf %s" \
GPRINT:cdefa:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:cdefa:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:a#FF0000FF:"Read\:" \
GPRINT:a:LAST:" Current\:%8.2lf %s" \
GPRINT:a:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:a:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:b#002A97FF:"Write\:" \
GPRINT:b:LAST:" Current\:%8.2lf %s" \
GPRINT:b:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:b:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:c#000000FF:"Queue Length\:" \
GPRINT:c:LAST:"Current\:%8.2lf %s" \
GPRINT:c:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:c:MAX:"Maximum\:%8.2lf %s\n"

RRDTool Says:

ERROR: opening '/var/www/cacti/rra/hers2004_readbytespersec_1388.rrd': No such file or directory
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

delete and recreate?

no idea, it seems like it refuses to create the rrd.
User avatar
JorisFRST
Cacti User
Posts: 229
Joined: Mon Oct 02, 2006 1:22 pm
Location: Belgium
Contact:

Post by JorisFRST »

deleted and recreated before, just freshly created one.

I'll have to find out if I can view a more verbose log somewhere.
User avatar
JorisFRST
Cacti User
Posts: 229
Joined: Mon Oct 02, 2006 1:22 pm
Location: Belgium
Contact:

Post by JorisFRST »

Updated everything to 0.0.6 and now get

10/19/2009 02:45:06 PM - CMDPHP: Poller[0] Host[90] Description[HERS2004] DS[1388] Graphs['HERS2004 - Disk I/O'] WARNING: Result from CMD not valid. Partial Result: U

Poller cache says :
Script: /usr/bin/php -q /var/www/cacti/scripts/wmi.php -h 'hers2004.brc.gbl' -u '/etc/cacti/credential' -w 'Win32_PerfRawData_PerfDisk_LogicalDisk' -n '' -k 'Name' -v 'C:' -c 'DiskWritesPersec,DiskWriteBytesPersec,DiskReadsPersec,DiskReadBytesPersec,CurrentDiskQueueLength'
RRD: /var/www/cacti/rra/hers2004_readbytespersec_1388.rrd

Running it manually :
[root@cacticentos ~]# /usr/bin/php -q /var/www/cacti/scripts/wmi.php -h 'hers2004.brc.gbl' -u '/etc/cacti/credential' -w 'Win32_PerfRawData_PerfDisk_LogicalDisk' -n '' -k 'Name' -v 'C:' -c 'DiskWritesPersec,DiskWriteBytesPersec,DiskReadsPersec,DiskReadBytesPersec,CurrentDiskQueueLength'
CurrentDiskQueueLength:0 DiskReadBytesPersec:6079251456 DiskReadsPersec:422512 DiskWriteBytesPersec:11981133312 DiskWritesPersec:535624 Name:C

Also the memory and Sql now give result from cmd not valid, and when I run it manually I get what looks like a perfect output.

I'm getting a bit lost with this.
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

JorisFRST wrote:Updated everything to 0.0.6 and now get

10/19/2009 02:45:06 PM - CMDPHP: Poller[0] Host[90] Description[HERS2004] DS[1388] Graphs['HERS2004 - Disk I/O'] WARNING: Result from CMD not valid. Partial Result: U

Poller cache says :
Script: /usr/bin/php -q /var/www/cacti/scripts/wmi.php -h 'hers2004.brc.gbl' -u '/etc/cacti/credential' -w 'Win32_PerfRawData_PerfDisk_LogicalDisk' -n '' -k 'Name' -v 'C:' -c 'DiskWritesPersec,DiskWriteBytesPersec,DiskReadsPersec,DiskReadBytesPersec,CurrentDiskQueueLength'
RRD: /var/www/cacti/rra/hers2004_readbytespersec_1388.rrd

Running it manually :
[root@cacticentos ~]# /usr/bin/php -q /var/www/cacti/scripts/wmi.php -h 'hers2004.brc.gbl' -u '/etc/cacti/credential' -w 'Win32_PerfRawData_PerfDisk_LogicalDisk' -n '' -k 'Name' -v 'C:' -c 'DiskWritesPersec,DiskWriteBytesPersec,DiskReadsPersec,DiskReadBytesPersec,CurrentDiskQueueLength'
CurrentDiskQueueLength:0 DiskReadBytesPersec:6079251456 DiskReadsPersec:422512 DiskWriteBytesPersec:11981133312 DiskWritesPersec:535624 Name:C

Also the memory and Sql now give result from cmd not valid, and when I run it manually I get what looks like a perfect output.

I'm getting a bit lost with this.
That's a bit weird. It's not unusual, some days I really have no idea why cacti refuses to work. Can you pull any further details from your cacti.log on high or debug mode?
User avatar
JorisFRST
Cacti User
Posts: 229
Joined: Mon Oct 02, 2006 1:22 pm
Location: Belgium
Contact:

Post by JorisFRST »

Thanks,

fixed it. The new error was basicly I f* up my security on the authentication files :oops: with messing too much about.

I did fix the Disk I/O Issue now too,

looks like in the Data Input Methods WMI - Disk I/O I had
DiskReadBytesPersec 2 times
and DiskWritesBytesPersec also 2 times.

Same thing in Data templates Windows - Disk I/O (WMI)

After deleting the doubles that pointed to the wrong value (diskquelenght) everything works now.

Thank you so much, this exercise made me learn a bit more about the cacti scripting, as I had no clue.


(and linux too, had alot of trouble compiling wmi 1.3.5 on Centos 5.3, only to see that I was doing it the difficult way, as there's now a makefile with the last releases, so anybody that wants the wmic and winexe compiled for this, I'm happy to send them or include them here)
skycode
Posts: 7
Joined: Tue Sep 08, 2009 10:15 am

Post by skycode »

Hi everybody,

I have a very obscure issue using the wmi templates. I use these templates mainly to monitor cpu activity on virtual machine that run on esx servers. Everything used to work fine ... until the night between monday and tuesday were all graphs started to report NaN as value. I investigated since then and found out that the wmi part of things seems to still work like a charm and report meaningful values. I have looked in the cacti log file and even find the following (On newly recreated graph just to be sure...)
10/22/2009 12:32:16 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/cacti/rra/application_vm_total_439.rrd --template CPU0:CPU1:Total 1256207524:30:24:27
10/22/2009 12:28:14 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/cacti/rra/application_vm_total_439.rrd --template CPU0:CPU1:Total 1256207284:17:68:43
10/22/2009 12:24:15 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/cacti/rra/application_vm_total_439.rrd --template CPU0:CPU1:Total 1256207044:0:0:0
10/22/2009 12:20:15 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/cacti/rra/application_vm_total_439.rrd --template CPU0:CPU1:Total 1256206804:43:2:23
10/22/2009 12:16:17 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/cacti/rra/application_vm_total_439.rrd --template CPU0:CPU1:Total 1256206565:12:12:12
10/22/2009 12:12:15 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/cacti/rra/application_vm_total_439.rrd --template CPU0:CPU1:Total 1256206324:15:9:12
10/22/2009 12:08:15 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/cacti/rra/application_vm_total_439.rrd --template CPU0:CPU1:Total N:0:7:3
10/22/2009 12:08:15 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool create /var/www/cacti/rra/application_vm_total_439.rrd --step 60 DS:Total:GAUGE:120:0:100 DS:CPU1:GAUGE:120:0:100 DS:CPU0:GAUGE:120:0:100 RRA:AVERAGE:0.5:1:500 RRA:AVERAGE:0.5:1:600 RRA:AVERAGE:0.5:6:700 RRA:AVERAGE:0.5:24:775 RRA:AVERAGE:0.5:288:797 RRA:MAX:0.5:1:500 RRA:MAX:0.5:1:600 RRA:MAX:0.5:6:700 RRA:MAX:0.5:24:775 RRA:MAX:0.5:288:797
So that definetly looks nice ...

but the graphs I get are desperatly empty

Do any of you have any idea what could be causing this ?

I'm also attaching the rrd file because I don't quite understand it's content related to the insetrt I see in the log. Btw If I try to run the updates by hand (with differents timestamps) it seems to work.

Thanks for your help
Attachments
The desperatly empty graph
The desperatly empty graph
application_vm_cpu.PNG (15.71 KiB) Viewed 4522 times
application_vm_total_439.zip
the associated rrd file
(719 Bytes) Downloaded 145 times
User avatar
JorisFRST
Cacti User
Posts: 229
Joined: Mon Oct 02, 2006 1:22 pm
Location: Belgium
Contact:

Post by JorisFRST »

what does the graph say in debug mode ?
skycode
Posts: 7
Joined: Tue Sep 08, 2009 10:15 am

Post by skycode »

RRDTool Command:

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-60 \
--title="application vm - CPU Usage" \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="Percent" \
--slope-mode \
--font TITLE:12: \
--font AXIS:8: \
--font LEGEND:10: \
--font UNIT:8: \
DEF:a="/var/www/cacti/rra/application_vm_total_439.rrd":Total:AVERAGE \
DEF:b="/var/www/cacti/rra/application_vm_total_439.rrd":CPU0:AVERAGE \
DEF:c="/var/www/cacti/rra/application_vm_total_439.rrd":CPU1:AVERAGE \
AREA:a#FF0000FF:"Total\:" \
GPRINT:a:LAST:"Current\:%8.2lf %s" \
GPRINT:a:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:a:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:b#000000FF:"CPU0\:" \
GPRINT:b:LAST:" Current\:%8.2lf %s" \
GPRINT:b:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:b:MAX:"Maximum\:%8.2lf %s\n" \
LINE1:c#0000FFFF:"CPU1\:" \
GPRINT:c:LAST:" Current\:%8.2lf %s" \
GPRINT:c:AVERAGE:"Average\:%8.2lf %s" \
GPRINT:c:MAX:"Maximum\:%8.2lf %s\n"

RRDTool Says:

OK

Thanks again[/quote]
chrisru
Posts: 5
Joined: Thu Jan 15, 2009 6:42 pm

Post by chrisru »

claymen wrote: I looked at doing data queries, they seem to be a right pain in the ass. I did have some test code floating around somewhere but cacti just didn't seem to want to record the data. I was toying with it for doing disk space and disk i/o.

I don't think the script as it is would be the best to for using as a base for data queries. I can think of a few ways to do it but I didn't really have the time to look at it.
Hey Claymen,

Just looking around at some of the other cacti plugins and I have realised the the discovery plugin has the ability to use templates. Could that be an option instead of data queries?

Chris
User avatar
JorisFRST
Cacti User
Posts: 229
Joined: Mon Oct 02, 2006 1:22 pm
Location: Belgium
Contact:

Post by JorisFRST »

skycode, if you look at my post just before yours, is it possible you also have double data sources ? As your graph debug looks fine ?
mamema
Posts: 5
Joined: Sun Oct 25, 2009 5:12 pm

Windows Memory usage WMI Template problem

Post by mamema »

implemented wmi and got it up and running, script runs on command line and gives values back.

Now i want to activate the windows memory usage template (v. 0.6 from first posting)

and get:

Code: Select all

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title="Name of Computer - Memory Usage" \
--base=1024 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label="Bytes" \
--slope-mode \
--font TITLE:10: \
--font AXIS:8: \
--font LEGEND:8: \
--font UNIT:8: \
DEF:a="/var/www/html/rra/Name_of_Computer_availablebytes_484.rrd":CommitLimit:AVERAGE \
DEF:b="/var/www/html/rra/Name_of_Computer_totalphysicalmemory_485.rrd":TotalPhysicalMemory:AVERAGE \
DEF:c="/var/www/html/rra/Name_of_Computer_availablebytes_484.rrd":AvailableBytes:AVERAGE \
DEF:d="/var/www/html/rra/Name_of_Computer_availablebytes_484.rrd":CommittedBytes:AVERAGE \
CDEF:cdefi=e,i,- \
AREA:a#562B29FF:"Commit Limit\:"  \
GPRINT:a:LAST:"  Current\:%8.2lf %s"  \
GPRINT:a:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:a:MAX:"Maximum\:%8.2lf %s\n"  \
AREA:b#FF5700FF:"Total RAM\:"  \
GPRINT:b:LAST:"     Current\:%8.2lf %s"  \
GPRINT:b:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:b:MAX:"Maximum\:%8.2lf %s\n"  \
AREA:cdefi#8F005CFF:"Used RAM\:"  \
GPRINT:cdefi:LAST:"      Current\:%8.2lf %s"  \
GPRINT:cdefi:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:cdefi:MAX:"Maximum\:%8.2lf %s\n"  \
LINE2:d#ffff00FF:"Commited Bytes\:"  \
GPRINT:d:LAST:"Current\:%8.2lf %s"  \
GPRINT:d:AVERAGE:"Average\:%8.2lf %s"  \
GPRINT:d:MAX:"Maximum\:%8.2lf %s\n" 
RRDTool Says:

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

i am not a template specialist. Can someone put me in the right direction, whjere i can digg after the source of the error?

regards

mamema
User avatar
JorisFRST
Cacti User
Posts: 229
Joined: Mon Oct 02, 2006 1:22 pm
Location: Belgium
Contact:

Post by JorisFRST »

as pointed out many times before, if you use a newer version of cacti as the one the template was made, you will have to change the CDEF.

The right one is somewhere in this post.
Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests