Monitor Windows via WMI from Cacti on Linux

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

Moderators: Developers, Moderators

Post Reply
delinquent
Posts: 10
Joined: Thu Oct 25, 2007 1:27 am

Post by delinquent »

claymen wrote:Can't say I've seen that before. Not sure to be honest, does the user running wmic have permission to read the password file? That's about all I can think of.
Yeah i thought it was strange too! I too also had that though and chmoded the file to 777 but still had the same problem.
delinquent
Posts: 10
Joined: Thu Oct 25, 2007 1:27 am

Post by delinquent »

OK, i've solved the problem.

It now appears of at least wmic-1.3.10 you now require a space before and after the equals sign.

I have two cacti setups with WMIC, one with 1.3.8 and the newer one with 1.3.10, 1.3.8 doesn't need spaces, 1.3.10 does.

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

Post by claymen »

That's a bit weird, nice find though :)
Axilla
Posts: 34
Joined: Wed Jul 21, 2010 11:35 am

Post by Axilla »

delinquent wrote:OK, i've solved the problem.

It now appears of at least wmic-1.3.10 you now require a space before and after the equals sign.

I have two cacti setups with WMIC, one with 1.3.8 and the newer one with 1.3.10, 1.3.8 doesn't need spaces, 1.3.10 does.

There you go. Weird.
you mean in the PW Auth file?
CentOS 5.5 / Cacti 0.8.7e / Spine 0.8.7e / PIA 2.6
Weathermap .97a / Thold 0.4.2
Axilla
Posts: 34
Joined: Wed Jul 21, 2010 11:35 am

Post by Axilla »

Having some CDEF issues and some others... Anyone got what they should be? Only thing graphing at the moment is Hard Drive Space. In command line Memory works, but it has a CDEF issue below.

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

Also: Here is what I see for the graphs that are showing NAN values.

07/28/2010 02:46:53 PM - CMDPHP: Poller[0] Host[22] DS[398] CMD: /usr/bin/php -q /var/www/html/cacti/scripts/wmi.php -h '192.168.x.x' -u '/etc/cacti/cactiwmi.pw' -w 'Win32_PerfRawData_PerfOS_System' -n '' -k '' -v '' -c 'Threads,SystemUpTime,SystemCallsPersec,ProcessorQueueLength,Processes,ContextSwitchesPersec', output: U
07/28/2010 02:46:53 PM - CMDPHP: Poller[0] Host[22] DS[398] WARNING: Result from CMD not valid. Partial Result: U
07/28/2010 02:46:45 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/cacti/rra/fmy-web-engines_serverdisconnects_397.rrd --template 1280342712:U
CentOS 5.5 / Cacti 0.8.7e / Spine 0.8.7e / PIA 2.6
Weathermap .97a / Thold 0.4.2
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

Axilla wrote:Having some CDEF issues and some others... Anyone got what they should be? Only thing graphing at the moment is Hard Drive Space. In command line Memory works, but it has a CDEF issue below.

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

Also: Here is what I see for the graphs that are showing NAN values.

07/28/2010 02:46:53 PM - CMDPHP: Poller[0] Host[22] DS[398] CMD: /usr/bin/php -q /var/www/html/cacti/scripts/wmi.php -h '192.168.x.x' -u '/etc/cacti/cactiwmi.pw' -w 'Win32_PerfRawData_PerfOS_System' -n '' -k '' -v '' -c 'Threads,SystemUpTime,SystemCallsPersec,ProcessorQueueLength,Processes,ContextSwitchesPersec', output: U
07/28/2010 02:46:53 PM - CMDPHP: Poller[0] Host[22] DS[398] WARNING: Result from CMD not valid. Partial Result: U
07/28/2010 02:46:45 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/cacti/rra/fmy-web-engines_serverdisconnects_397.rrd --template 1280342712:U
You have two issues there, one is your CDEF the other is the command not returning information properly. What version of the CactiWMI scripts are you using and what version of Cacti? It's been covered a number of times already but on some versions of Cacti it handles the data inputs on the graph differently so it messes with the CDEF's, you just need to drop into the graph debug and look at the inputs. Basically the version of Cacti used in dev created 4 graph inputs per data source whereas newer ones only create one which breaks the CDEF. You should be able to work out what needs to be adjusted based on your config else I believe they have been posted somewhere in the thread.

The other issue is your script not returning info, run those commands manually as the cacti poller user and make sure they actually work.
Axilla
Posts: 34
Joined: Wed Jul 21, 2010 11:35 am

Post by Axilla »

claymen wrote:
Axilla wrote:Having some CDEF issues and some others... Anyone got what they should be? Only thing graphing at the moment is Hard Drive Space. In command line Memory works, but it has a CDEF issue below.

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

Also: Here is what I see for the graphs that are showing NAN values.

07/28/2010 02:46:53 PM - CMDPHP: Poller[0] Host[22] DS[398] CMD: /usr/bin/php -q /var/www/html/cacti/scripts/wmi.php -h '192.168.x.x' -u '/etc/cacti/cactiwmi.pw' -w 'Win32_PerfRawData_PerfOS_System' -n '' -k '' -v '' -c 'Threads,SystemUpTime,SystemCallsPersec,ProcessorQueueLength,Processes,ContextSwitchesPersec', output: U
07/28/2010 02:46:53 PM - CMDPHP: Poller[0] Host[22] DS[398] WARNING: Result from CMD not valid. Partial Result: U
07/28/2010 02:46:45 PM - POLLER: Poller[0] CACTI2RRD: /usr/bin/rrdtool update /var/www/html/cacti/rra/fmy-web-engines_serverdisconnects_397.rrd --template 1280342712:U
You have two issues there, one is your CDEF the other is the command not returning information properly. What version of the CactiWMI scripts are you using and what version of Cacti? It's been covered a number of times already but on some versions of Cacti it handles the data inputs on the graph differently so it messes with the CDEF's, you just need to drop into the graph debug and look at the inputs. Basically the version of Cacti used in dev created 4 graph inputs per data source whereas newer ones only create one which breaks the CDEF. You should be able to work out what needs to be adjusted based on your config else I believe they have been posted somewhere in the thread.

The other issue is your script not returning info, run those commands manually as the cacti poller user and make sure they actually work.
0.6 for CactiWMI WMIC is 1.3.12 and my cacti version is 0.8.7e with PIA 2.6
CentOS 5.5 / Cacti 0.8.7e / Spine 0.8.7e / PIA 2.6
Weathermap .97a / Thold 0.4.2
nuzzy
Posts: 42
Joined: Mon Feb 23, 2009 10:33 am

Post by nuzzy »

I'm getting the error mentioned on page 36:

Code: Select all

RRDTool Command:

/usr/bin/rrdtool graph - \
--imgformat=PNG \
--start=-86400 \
--end=-300 \
--title='BOREAS - Active Client Logons' \
--base=1000 \
--height=120 \
--width=500 \
--alt-autoscale-max \
--lower-limit=0 \
--vertical-label='Logons' \
--slope-mode \
--font TITLE:12:'/usr/share/fonts/msttcorefonts/cour.ttf' \
--font AXIS:8:'/usr/share/fonts/msttcorefonts/cour.ttf' \
--font LEGEND:8:'/usr/share/fonts/msttcorefonts/cour.ttf' \
--font UNIT:8:'/usr/share/fonts/msttcorefonts/cour.ttf' \
LINE1:#000000FF:"Total\:"  \
GPRINT::LAST:"    Current\:%8.0lf"  \
GPRINT::AVERAGE:"Average\:%8.0lf"  \
GPRINT::MAX:"Maximum\:%8.0lf\n"  \
LINE1:#FF0000FF:"Database5\:"  \
GPRINT::LAST:"Current\:%8.0lf"  \
GPRINT::AVERAGE:"Average\:%8.0lf"  \
GPRINT::MAX:"Maximum\:%8.0lf\n"  \
LINE1:#0000FFFF:"Database4\:"  \
GPRINT::LAST:"Current\:%8.0lf"  \
GPRINT::AVERAGE:"Average\:%8.0lf"  \
GPRINT::MAX:"Maximum\:%8.0lf\n"  \
LINE1:#FFAB00FF:"Database3\:"  \
GPRINT::LAST:"Current\:%8.0lf"  \
GPRINT::AVERAGE:"Average\:%8.0lf"  \
GPRINT::MAX:"Maximum\:%8.0lf\n"  \
LINE1:#28CF21FF:"Database2\:"  \
GPRINT::LAST:"Current\:%8.0lf"  \
GPRINT::AVERAGE:"Average\:%8.0lf"  \
GPRINT::MAX:"Maximum\:%8.0lf\n"  \
LINE1:#55009DFF:"Database1\:"  \
GPRINT::LAST:"Current\:%8.0lf"  \
GPRINT::AVERAGE:"Average\:%8.0lf"  \
GPRINT::MAX:"Maximum\:%8.0lf\n" RRDTool Says:

ERROR: parameter '#000000FF' does not represent a number in line LINE1:#000000FF:Total\:
clayman said this:
claymen wrote:The active client logons is one that you have to create as a templated graph then switch to no template so that you can edit. E.g. this is because there was no way to vary the number of databases shown dynamically in cacti.

As in it can't auto detect you have 6 databases and create a single graph to show them all with correct names. You kinda can with a data query but still.. So yes create the graph, then set it to no template so you can edit and then add in your data sources for each database you want to see active client logons and then name them if you wish.

But its one you have to do some manual work on.
Where is this change made exactly?

edit: this is the data I get when running from my linux command line:

Code: Select all

wmic -d0 --authentication-file=/etc/cacti/wmi.pw //boreas "SELECT * FROM Win32_PerfRawData_MSExchangeIS_MSExchangeISMailbox"
CLASS: Win32_PerfRawData_MSExchangeIS_MSExchangeISMailbox
ActiveClientLogons|AverageDeliveryTime|Caption|CategorizationCount|ClientLogons|Description|FolderopensPersec|Frequency_Object|Frequency_PerfTime|Frequency_Sys100NS|HTTPDAVCurrentPendingNotifications|HTTPDAVCurrentSubscriptions|HTTPDAVCurrentTransactionLocks|HTTPDAVNotifyRequestsPersec|HTTPDAVTotalLocksCreated|HTTPDAVTotalNotifyRequests|HTTPDAVTotalSubscriptionsCreated|HTTPDAVTotalSubscriptionsExpired|Localdeliveries|Localdeliveryrate|LogonOperationsPersec|MessageOpensPersec|MessageRecipientsDelivered|MessageRecipientsDeliveredPermin|MessagesDelivered|MessagesDeliveredPermin|MessagesSent|MessagesSentPermin|MessagesSubmitted|MessagesSubmittedPermin|Name|PeakClientLogons|ReceiveQueueSize|RestrictedViewCacheHitRate|RestrictedViewCacheMissRate|SearchTaskRate|SendQueueSize|SingleInstanceRatio|SingleInstanceRatio_Base|SlowFindRowRate|Timestamp_Object|Timestamp_PerfTime|Timestamp_Sys100NS|TotalCountofRecoverableItems|TotalSizeofRecoverableItems
1|0|(null)|0|6|(null)|64|0|1995070000|10000000|0|0|0|0|0|0|0|0|0|0|12|0|0|0|0|0|0|0|0|0|First Storage Group-Mailbox Store (BOREAS)|6|0|0|1|0|0|521|48500|0|0|4428041523870294|3702590431000|0|0
1|0|(null)|0|6|(null)|64|0|1995070000|10000000|0|0|0|0|0|0|0|0|0|0|12|0|0|0|0|0|0|0|0|0|_Total|6|0|0|1|0|0|521|48500|0|0|4428041523870294|3702590431000|0|0
Cacti 0.8.8a on CentOS
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

Create the graph using the template, switch it to use no template. Setup your data sources, modify the graph to fit your setup. E.g. you can't just plonk the graph template on and have it auto create everything.
nuzzy
Posts: 42
Joined: Mon Feb 23, 2009 10:33 am

Post by nuzzy »

Thanks claymen. I'm getting 'nan' values in my graphs for some reason though.
Cacti 0.8.8a on CentOS
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

Do your data sources have any data in them?
nuzzy
Posts: 42
Joined: Mon Feb 23, 2009 10:33 am

Post by nuzzy »

They do, but this is what I get:

Code: Select all

/usr/bin/php -q /var/www/html/cacti/scripts/wmi.php -h 'boreas.corp.sds.l-3com.com' -u '/etc/cacti/wmi.pw' -w 'Exchange_Mailbox' -n 'rootMicrosoftExchangeV2' -k 'MailboxDisplayName' -v '' -c 'Size,TotalItems,DeletedMessageSizeExtended'
No log handling enabled - turning on stderr logging
Cannot find module (MTA-MIB): At line 0 in (none)
Cannot find module (NETWORK-SERVICES-MIB): At line 0 in (none)
Cannot find module (LM-SENSORS-MIB): At line 0 in (none)


Return code non-zero, debug mode enabled!



/usr/local/bin/wmic --namespace='rootMicrosoftExchangeV2' --authentication-file=/etc/cacti/wmi.pw //boreas.corp.sds.l-3com.com "SELECT Size,TotalItems,DeletedMessageSizeExtended FROM Exchange_Mailbox WHERE MailboxDisplayName=" 2>/dev/null
Exec Status: 1

PHP Notice:  Undefined offset:  1 in /var/www/html/cacti/scripts/wmi.php on line 126
I'm about ready to give up to be honest :cry:

update: I've made some progress, but I'm having a brain cramp trying to create the data source for ActiveClientLogons. Anyone? Here's what I'm getting now via command line:

Code: Select all

/usr/bin/php -q /var/www/html/cacti/scripts/wmi.php -h 'ma_exchange.corp.sds.l-3com.com' -u '/etc/cacti/wmi.pw' -w 'Win32_PerfRawData_MSExchangeIS_MSExchangeISMailbox' -n '' -k '' -v 'MA_EXCHANGE' -c 'ActiveClientLogons,MessagesDelivered,MessagesSent,MessagesSubmitted,ReceiveQueueSize,SendQueueSize,TotalCountofRecoverableItems,TotalSizeofRecoverableItems'
PHP Notice:  Undefined variable: condition_key in /var/www/html/cacti/scripts/wmi.php on line 119
PHP Notice:  Undefined variable: condition_val in /var/www/html/cacti/scripts/wmi.php on line 119
ActiveClientLogons0:478 MessagesDelivered0:274812 MessagesSent0:148574 MessagesSubmitted0:141576 Name0:First_Storage_Group-Mailbox_Store_(MA_EXCHANGE) ReceiveQueueSize0:0 SendQueueSize0:0 TotalCountofRecoverableItems0:450393 TotalSizeofRecoverableItems0:30860587 ActiveClientLogons1:478 MessagesDelivered1:274812 MessagesSent1:148574 MessagesSubmitted1:141576 Name1:_Total ReceiveQueueSize1:0 SendQueueSize1:0 TotalCountofRecoverableItems1:450393 TotalSizeofRecoverableItems1:30860587
Cacti 0.8.8a on CentOS
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

If your getting anything other than just the result from the script then you have something broken and Cacti will not read the data in.

E.g. if should be only something like this

ActiveClientLogons0:478 MessagesDelivered0:274812 MessagesSent0:148574 MessagesSubmitted0:141576 Name0:First_Storage_Group-Mailbox_Store_(MA_EXCHANGE) ReceiveQueueSize0:0 SendQueueSize0:0 TotalCountofRecoverableItems0:450393 TotalSizeofRecoverableItems0:30860587 ActiveClientLogons1:478 MessagesDelivered1:274812 MessagesSent1:148574 MessagesSubmitted1:141576 Name1:_Total ReceiveQueueSize1:0 SendQueueSize1:0 TotalCountofRecoverableItems1:450393 TotalSizeofRecoverableItems1:30860587
These errors your getting here are because you haven't specified a filter in your data source for the exchange. You MUST have a filter else the wmi query will return multiple rows resulting in the situation you have as cacti isn't expecting it.
PHP Notice: Undefined variable: condition_key in /var/www/html/cacti/scripts/wmi.php on line 119
PHP Notice: Undefined variable: condition_val in /var/www/html/cacti/scripts/wmi.php on line 119
And also this stuff
No log handling enabled - turning on stderr logging
Cannot find module (MTA-MIB): At line 0 in (none)
Cannot find module (NETWORK-SERVICES-MIB): At line 0 in (none)
Cannot find module (LM-SENSORS-MIB): At line 0 in (none)
Is likely to not help either, thats cause you have modules enabled in PHP that don't have everything they need. Namely the SNMP one.

Cacti expects the output of the script to be only a specific way. So your not actually getting any data into your cacti data source.
nuzzy
Posts: 42
Joined: Mon Feb 23, 2009 10:33 am

Post by nuzzy »

I fixed the php stuff...creating the Data Source for ActiveClientLogons is my priority now. I'm forgetting how to do that.
Cacti 0.8.8a on CentOS
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

You add the graph as a template, then convert it to not be a template graph, then edit it as needed. Linking in the data sources from each of your mailbox stores. It is not automated so you need to edit the graph yourself.
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests