Windows WMI with Cacti on Linux server

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

Moderators: Developers, Moderators

khufure
Cacti User
Posts: 203
Joined: Wed Oct 24, 2007 5:47 pm
Location: San Francisco, CA
Contact:

Post by khufure »

NRPE_NT works and is interesting. However, for those using NSCLIENT..

NC_NET is the latest. It installs via MSI. Not sure if it works with VISTA or VISTA64. (Hopefully nobody is using VISTA32 since it's abysmally slow..)
http://www.shatterit.com/nc_net/
felimwhiteley
Posts: 26
Joined: Mon Dec 10, 2007 10:14 am

Post by felimwhiteley »

If you have Debian/Ubuntu (Sid and Hardy respectivly) do this

sudo aptitude install wmi-client

I'm still working on the details of the language to query with but for instance

wmic -U DOMAIN/administrator%adminpassword //10.99.22.99 "Select * from Win32_Service"

Lists all services and their details.

Hope this helps someone
gasperazzo
Posts: 29
Joined: Wed Oct 08, 2008 11:51 am

Post by gasperazzo »

felimwhiteley,

I tried to find the wmi-client source whitout success. This package is only for Debian/Ubuntu distribution? I'm using Suse Linux 10.1 and my knowledegs about Unix system is very poor! But I'm trying to learn more about.

Do you have a link to the source of wmi-client?

I think that is the best way to monitoring Windows architeture by WMI using Unix servers.

Thanks!
felimwhiteley
Posts: 26
Joined: Mon Dec 10, 2007 10:14 am

Post by felimwhiteley »

Hiya,

You could grab the tarball on the left of:

http://packages.ubuntu.com/hardy/wmi-client

OR You could go straight to Zennos' SVN Server At:

http://dev.zenoss.com/trac/log/trunk/wmi/

Your milage may vary as it has a lot of other stuff in there too.
gasperazzo
Posts: 29
Joined: Wed Oct 08, 2008 11:51 am

Post by gasperazzo »

Thanks felimwhiteley...

I'll test right now! :)

Thanks.
felimwhiteley
Posts: 26
Joined: Mon Dec 10, 2007 10:14 am

Post by felimwhiteley »

felimwhiteley wrote:You could grab the tarball on the left
By which I actually meant right.. *sigh*
gasperazzo
Posts: 29
Joined: Wed Oct 08, 2008 11:51 am

Post by gasperazzo »

I had some dificulties to compile this package. I installed all pre requisites before install the wmi-client but does't worked!

Felimwhiteley, Did you compiled this package before?

I`m trying to get the zenoss source and look for the wmi-client.

Thanks.
felimwhiteley
Posts: 26
Joined: Mon Dec 10, 2007 10:14 am

Post by felimwhiteley »

I'm afraid not but I did compile some of the code to get winexe running. If you scroll down this page to the compilation instructions (I downloaded a SVN snapshot rather than the static tarball)

http://eol.ovh.org/winexe/

Maybe that'll help you out. What kind of error(s) did you have anyway ?
gasperazzo
Posts: 29
Joined: Wed Oct 08, 2008 11:51 am

Post by gasperazzo »

Looking at the README file we have:
Simple steps(change python path if necessary):
$ cd Samba/source
$ ./autogen.sh
$ CPPFLAGS="-I/usr/include/python2.4" ./configure
$ make proto bin/wmic bin/wmis wmi/_pywmi.so bin/winexe
First i had errors executing the ./autogen.h (about GNU M4 i think) then i commented the lines in the autogen.sh and run again, its worked.

Thus i run the "CPPFLAGS="-I/usr/include/python2.6" ./configure" but i don't know why the configure files trying to find the files (*.mk and libs) at the "/" even I pass the --srcdir parameter... So, i copied all the files that ./configure tried to use to "/" (don't worry about this :P) and run ./configure again. Apparently worked ...

Looking in the folders, i saw that files "proto bin/wmic bin/wmis wmi/_pywmi.so bin/winexe" aren't present and i cannot use the command make.

So, i think that is all...! Now i'll look the url that u send and try again!

Thanks and sorry about primate english...! I'm from Brazil and don't study english at my childhood! :) But on my next vacation I'm going to the U.S. to study English! :)
gasperazzo
Posts: 29
Joined: Wed Oct 08, 2008 11:51 am

Post by gasperazzo »

Felimwhiteley, have good news!!

I tried to install autoconf package with the source files before.

Now I deleted my VM and back their backup to try the installation of the wmi-client again... So I install autoconf package with YAST2 (yast2 -i autoconf) and try to run the ./autogen.sh. I'm expecting the same errors at the last times but for my surprise, the autogen.sh was executed without errors!!!

Thus I run "make proto bin/wmic bin/winexe" with some WARNINGs but the make running like a charm. After running make, i run install -s bin/wmic /usr/local/bin/wmic and install -s bin/winexe /usr/local/bin/winexe.

Now I have:
# wmic
Usage: [-?|--help] [--usage] [-d|--debuglevel DEBUGLEVEL] [--debug-stderr]
[-s|--configfile CONFIGFILE] [--option=name=value]
[-l|--log-basename LOGFILEBASE] [--leak-report] [--leak-report-full]
[-R|--name-resolve NAME-RESOLVE-ORDER]
[-O|--socket-options SOCKETOPTIONS] [-n|--netbiosname NETBIOSNAME]
[-W|--workgroup WORKGROUP] [--realm=REALM] [-i|--scope SCOPE]
[-m|--maxprotocol MAXPROTOCOL] [-U|--user [DOMAIN\]USERNAME[%PASSWORD]]
[-N|--no-pass] [--password=STRING] [-A|--authentication-file FILE]
[-S|--signing on|off|required] [-P|--machine-pass]
[--simple-bind-dn=STRING] [-k|--kerberos STRING]
[--use-security-mechanisms=STRING] [-V|--version] [--namespace=STRING]
//host query
hohoho! Very thanks!!! I tested the query in a host and works perfectly!!!

Thanks!!! :)
gasperazzo
Posts: 29
Joined: Wed Oct 08, 2008 11:51 am

Post by gasperazzo »

Hello, i have one question about wmic...

Every time that I execute a wmic query, for example:
wmic -U domain/user%password //server "select AllocatedBaseSize from Win32_PageFileUsage"
The query return is:
CLASS: Win32_PageFileUsage
AllocatedBaseSize|Name
50|C:\pagefile.sys
6144|E:\pagefile.sys
Why the name's object is displayed? I want only the AllocatedBaseSize object...

Thanks
felimwhiteley
Posts: 26
Joined: Mon Dec 10, 2007 10:14 am

Post by felimwhiteley »

Hi gasperazzo
First off sorry but I never got an email from the forum saying you replied so I never realised you had an issues.

I've got a wrapper application (although it's a bit round-the-houses as there's better ways I realise now) but if you have any Python you could try it

http://felimwhiteley.wordpress.com/2008 ... sing-wmic/

Currently it doesn't do much bar print it out, but if you tweak the code it'd be very easy for instance to take a variable at runtime and it would output whatever it is for you. If you have trouble I could do it pretty fast for you. Let me know. Hopefully the damn forum sends me a mail this time if you reply ! :-?
cigamit
Developer
Posts: 3367
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

There is currently a plugin that integrates into Cacti that is basically just a wrapper around this binary.

http://forums.cacti.net/viewtopic.php?t=29392
gasperazzo
Posts: 29
Joined: Wed Oct 08, 2008 11:51 am

Post by gasperazzo »

No problem felimwhiteley,

I wrote perl scripts to query wmi issues using WMIC that works like a charm. Then i wrote some of data queries on Cacti to use these scripts.

So... I'll read your post but now I'm going on vacation for 2 weeks :-)

If the question about the ouput of WMIC is true (always return the Name attribute of an instance). I'll post my dataqueries and my scripts.

Thanks man! I appreciate your help!

Cigamit,

Thanks man but this plugin won't help-me!
felimwhiteley
Posts: 26
Joined: Mon Dec 10, 2007 10:14 am

Post by felimwhiteley »

Yes it is True it does indeed (well in everything I've seen, which is a fair bit) return it each time. Glad to help, enjoy your Holidays !

Same for me Cigamit, I know the Plugin Architecture is really great and it makes more sense, but until the PA is inside normal Cacti I can't keep patching the number of Cacti boxes I have then re-patching on every distro patch and upgrade.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest