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 »

Mate your filtering on the wrong value then.

Look at your readout from Scriptomatic. You query MailboxDisplayName and the name in there is not the name you have in your filter for cacti...

e.g. Your asking it to search for a record (as this is basically SQL) where the MailboxDisplayName='pgs1-Bal1' which of course won't return any records.

If you use whatever you blanked out in that pic it should work.
Taltos
Posts: 16
Joined: Wed Dec 16, 2009 6:32 am

Post by Taltos »

Ok I understand, but it doesn't work to


in fact Total Mailbox Items (WMI) works for 1 mailbox
and I need to use as filter one of the MailboxDisplayName found with scriptomatic for exemple

Code: Select all

intranet:/tmp# /usr/local/bin/wmic --namespace='root\MicrosoftExchangeV2' --authentication-file=/etc/cacti/cactiwmi.pw //172.16.1.4 "SELECT Size,TotalItems,DeletedMessageSizeExtended FROM Exchange_Mailbox WHERE MailboxDisplayName='John Doe'"
CLASS: Exchange_Mailbox
DeletedMessageSizeExtended|LegacyDN|MailboxGUID|ServerName|Size|StorageGroupName|StoreName|TotalItems
14327|/O=CDG44/OU=PREMIER GROUPE D'ADMINISTRATION/CN=RECIPIENTS/CN=J.DOE|{4A4B5D17-339C-4751-A640-F0976410497E}|SRVEXCH|49516|pgs1|Bal1|675
intranet:/tmp#

but Poller cache items continue to say

Code: Select all

intranet:/tmp# wmi.php -h '172.16.1.4' -u '/etc/cacti/cactiwmi.pw' -w 'Exchange_Mailbox' -n 'rootMicrosoftExchangeV2' -k 'MailboxDisplayName' -v 'John Doe' -c 'Size,TotalItems,DeletedMessageSizeExtended'
-bash: wmi.php: command not found
intranet:/tmp# php wmi.php -h '172.16.1.4' -u '/etc/cacti/cactiwmi.pw' -w 'Exchange_Mailbox' -n 'rootMicrosoftExchangeV2' -k 'MailboxDisplayName' -v 'John Doe' -c 'Size,TotalItems,DeletedMessageSizeExtended'


Return code non-zero, debug mode enabled!



/usr/local/bin/wmic --namespace='rootMicrosoftExchangeV2' --authentication-file=/etc/cacti/cactiwmi.pw //172.16.1.4 "SELECT Size,TotalItems,DeletedMessageSizeExtended FROM Exchange_Mailbox WHERE MailboxDisplayName='John Doe'" 2>/dev/null
Exec Status: 1

PS I understand if you stop helping me i'm not very fast :oops:

Edit:
I have found the bug poller cache send --namespace='rootMicrosoftExchangeV2'
not
--namespace='root\MicrosoftExchangeV2'
I try to find where I can modify that
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

It will be your data template. Check that to make sure the \ is in there. Cause that'd be whats breaking it now.
greg4tw
Posts: 10
Joined: Thu Mar 19, 2009 4:35 am
Location: Germany

Post by greg4tw »

Here is my Host Template for Windows Server 2003 with SQL Server 2005.
I have inserted a minimum function and corrected the width of the graphs.
Attachments
Windows2003SQLServer.xml
(255.79 KiB) Downloaded 411 times
dino2000
Posts: 7
Joined: Mon Jun 01, 2009 4:24 am

NTSTATUS: NT_STATUS_ACCESS_DENIED - Access denied

Post by dino2000 »

/usr/bin/php -q /var/www/html/scripts/wmi.php -h '10.126.208.28' -u '/etc/cacti/cactiwmi.pw' -w 'Win32_PerfFormattedData_PerfOS_Processor' -n '' -k '' -v '' -c 'PercentProcessorTime'
NTSTATUS: NT_STATUS_ACCESS_DENIED - Access denied


Return code non-zero, debug mode enabled!



/usr/local/bin/wmic --namespace='root\CIMV2' --authentication-file=/etc/cacti/cactiwmi.pw //10.126.208.28 "SELECT PercentProcessorTime FROM Win32_PerfFormattedData_PerfOS_Processor"
Exec Status: 1

Any idea what’s with this error message. :roll:
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

I hate to be blunt but...
NTSTATUS: NT_STATUS_ACCESS_DENIED - Access denied
The username/password combo you have in the auth file isn't able to run that query. Can you test it as a local admin on the server.
dino2000
Posts: 7
Joined: Mon Jun 01, 2009 4:24 am

Post by dino2000 »

claymen wrote:I hate to be blunt but...
NTSTATUS: NT_STATUS_ACCESS_DENIED - Access denied
The username/password combo you have in the auth file isn't able to run that query. Can you test it as a local admin on the server.
I understand that there is a problem of authentication, however the user is a domain admin!
And I can do about everything on that server with that user.

From what I’ve read on this forum, the password file should contain only three variables:
username=<your username>
password=<your password>
dmain=<your domain>

So if the user is cacti with password cacti123 and the domain cacti.com, the file should have:
username=<cacti>
password=<cacti123>
dmain=<cacti.com>

is this correct? :roll:
Taltos
Posts: 16
Joined: Wed Dec 16, 2009 6:32 am

Post by Taltos »

no read my post !!

http://forums.cacti.net/viewtopic.php?p=180427#180427


For claymen, just for information, In all template I can see root\MicrosoftExchangeV2 with the "\"

I have try to make a graph without template but everytime "\" get out.
perhaps a pb of charset ?
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

Taltos wrote:no read my post !!

http://forums.cacti.net/viewtopic.php?p=180427#180427


For claymen, just for information, In all template I can see root\MicrosoftExchangeV2 with the ""

I have try to make a graph without template but everytime "" get out.
perhaps a pb of charset ?
Not sure whats going on then mate but if the \ is being stripped out when it finally hits the wmi.php script it'll fail.

Not sure what your talking about reading your post?
User avatar
claymen
Cacti User
Posts: 259
Joined: Mon Aug 18, 2008 4:30 am
Location: Australia
Contact:

Post by claymen »

dino2000 wrote:
claymen wrote:I hate to be blunt but...
NTSTATUS: NT_STATUS_ACCESS_DENIED - Access denied
The username/password combo you have in the auth file isn't able to run that query. Can you test it as a local admin on the server.
I understand that there is a problem of authentication, however the user is a domain admin!
And I can do about everything on that server with that user.

From what I’ve read on this forum, the password file should contain only three variables:
username=<your username>
password=<your password>
dmain=<your domain>

So if the user is cacti with password cacti123 and the domain cacti.com, the file should have:
username=<cacti>
password=<cacti123>
dmain=<cacti.com>

is this correct? :roll:
Yer that should be all you need. Not sure if it would freak out with the fqdn as the domain, maybe try just the shortened 2k spec domain. e.g. if you had staff.something.or.rather.com use just staff (assuming that is what it is..)

Also make sure that the user your running cacti as has permission to read the password file itself!
lupick
Posts: 18
Joined: Tue Nov 28, 2006 10:44 am

Monitor windows service?!?

Post by lupick »

Hi

I'm using this great template to monitor some server via WMI from a Linux box.

Can I monitor also windows services?!?

I've tried to monitor only a process but for many windows service I've alvays svchost.exe...

thank you

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

Post by claymen »

I guess you could, you'd need to create your own template to do so.

What were you planning to monitor? Just the status so you'd have either an up or down type monitor?
lupick
Posts: 18
Joined: Tue Nov 28, 2006 10:44 am

Post by lupick »

claymen wrote:I guess you could, you'd need to create your own template to do so.

What were you planning to monitor? Just the status so you'd have either an up or down type monitor?
Yes the status should be fine;

I've found the following wmi query:

/usr/bin/wmic --namespace='root\CIMV2' --authentication-file=/etc/cacti/cactiwmi.pw //MYHOST "SELECT caption,status FROM Win32_Service"

it reply the neede info:

Windows Management Instrumentation|winmgmt|OK
Windows Remote Management (WS-Management)|WinRM|OK
VNC Server|winvnc|OK
Portable Media Serial Number Service|WmdmPmSN|OK
Windows Management Instrumentation Driver Extensions|Wmi|OK
WMI Performance Adapter|WmiApSrv|OK
Windows Media Player Network Sharing Service|WMPNetworkSvc|OK
Security Center|wscsvc|OK
Automatic Updates|wuauserv|OK
Windows Driver Foundation - User-mode Driver Framework|WudfSvc|OK
Wireless Zero Configuration|WZCSVC|OK
Network Provisioning Service|xmlprov|OK
.....

So how to use it with wmi.php? How to create a template?!?

thank you

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

Post by claymen »

You will need 3 pieces.

A data input method with suitable column names etc. Have a look at existing ones.

A data template which references the data input method and allows you to enter in which fields are hard set and which are able to be changed (e.g. your filters)

And then your graph template to suit.

Have a look at the existing ones to get an idea of how they go together. But keep in mind you are logging simply the word OK which i'm not sure how cacti is going to deal with..
lupick
Posts: 18
Joined: Tue Nov 28, 2006 10:44 am

Post by lupick »

claymen wrote:You will need 3 pieces.

A data input method with suitable column names etc. Have a look at existing ones.

A data template which references the data input method and allows you to enter in which fields are hard set and which are able to be changed (e.g. your filters)

And then your graph template to suit.

Have a look at the existing ones to get an idea of how they go together. But keep in mind you are logging simply the word OK which i'm not sure how cacti is going to deal with..
Thanks for your reply clayman,
I've just created the "Data input" that execute the following command:

/usr/bin/php -q /srv/www/cacti/scripts/wmi.php -h 'Myhost' -u '/etc/cacti/cactiwmi.pw' -w 'Win32_Service' -n '' -k 'Name' -v 'wuauserv' -c 'State'


it returns
Name:wuauserv State:Running

I wonder how to convert "Running" as 1 nad Stopped as 0 so that RRD can create a graph.

I've finished to create data input, data template enad graph template

but it's not working...... I assume due to the output of the script that give value "running"/"stopped" instead of 0/1

Any Idea?!?
Attachments
cacti_graph_template_windows_-_service_wmi.xml
(10.08 KiB) Downloaded 214 times
Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests