Windows WMI with Cacti on Linux server

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

Moderators: Developers, Moderators

laffen
Cacti User
Posts: 56
Joined: Tue Jul 13, 2004 2:57 am
Location: Norway

Windows WMI with Cacti on Linux server

Post by laffen »

Hi,

has anyone graphed Windows 2000/2003 servers using WMI when Cacti is installed on a *nix (Linux/FreeBSD/whatever) server? All the examples I have seen so far has been for Cacti running on Windows using PHP/Visual Basic scripts which is no good on my Debian Linux.

I suck at coding so don't want to start putting it together myself unless as a last resort, so any scripts or help would be appreciated :)
Dalamar

EISH me too

Post by Dalamar »

I am also looking for this!
8)
anthony.warren
Posts: 31
Joined: Fri Nov 22, 2002 10:50 am
Location: Rochester, UK

Post by anthony.warren »

I also would info on this topic.

Anthony
User avatar
Scipio
Posts: 22
Joined: Tue Oct 12, 2004 4:49 am
Location: Switzerland
Contact:

Post by Scipio »

Hi

I think you can use the scripts writed for win2k. They are written in perl, so normally, it works perfeclty under linux. But you must be sure to have this library: Win32::OLE

Cause the scripts use this library the interact with the wmi.

Can somone confirm that ?
Tiago Coimbra
Gruyère Energie
laffen
Cacti User
Posts: 56
Joined: Tue Jul 13, 2004 2:57 am
Location: Norway

Post by laffen »

Scipio wrote:Hi

I think you can use the scripts writed for win2k. They are written in perl, so normally, it works perfeclty under linux. But you must be sure to have this library: Win32::OLE

Cause the scripts use this library the interact with the wmi.

Can somone confirm that ?
This could be a solution, but there is no Win32::OLE perl module for Debian, and it borked when I tried to install it via CPAN.
I would prefer perl modules installed via packages (apt) instead of CPAN installed modules to keep the system consistent.
User avatar
Scipio
Posts: 22
Joined: Tue Oct 12, 2004 4:49 am
Location: Switzerland
Contact:

Post by Scipio »

So.. why don't you try with php ? :)

http://www.aspfree.com/c/a/Windows-Scri ... -with-PHP/

but, it's not an "easy way"...
Tiago Coimbra
Gruyère Energie
anthony.warren
Posts: 31
Joined: Fri Nov 22, 2002 10:50 am
Location: Rochester, UK

Post by anthony.warren »

Taken from
http://www.talkaboutprogramming.com/gro ... 63667.html
Vinod. K wrote:
> Hi All,
>
> Pls help me in installing the module, Win32-OLE-0.17 in solaris 2.6
> server.

Can't be done. Win32::OLE can be built *only* on Win32 machines.

Cheers,
Rob
So it appears that you cannot compile Win32::OLE.

I guess I will have to investigate the PHP option mentioned in the post above.

Regards,

Anthony
laffen
Cacti User
Posts: 56
Joined: Tue Jul 13, 2004 2:57 am
Location: Norway

Post by laffen »

Cool, please keep us posted about how its going :)
NC
Posts: 7
Joined: Tue Feb 24, 2004 2:15 pm
Location: FRANCE

NRPE

Post by NC »

In order to monitor Windows servers from a linux box with WMI,

you should use NRPE_NT.

Perl scripts posted in this forum can be easily adapted :

Per exemple, on cacti :
Original "input string" was :
perl <path_cacti>/scripts/w32_query_LogicalDisk.pl <hostname> <driveletter>
New "input string" :
<path_cacti>/scripts/check_nrpe -H <nrpe_hostname> -c check_disk -a <hostname> <driveletter>

where <nrpe_hostname> is the windows server where nrpe_nt is installed.

In "nrpe_nt.cfg" file, add a line like this :
command[check_disk]=c:\perl\bin\perl.exe C:\nrpe\bin\w32_query_LogicalDisk.pl $ARG1$ get size,freespace $ARG2$
maikl

NRPE

Post by maikl »

excellent NC

great tip, works perfect

thx again
UKStroller

Post by UKStroller »

Is there any way around this if you don't have access to the Windows servers to install nrpe_nt??
NC
Posts: 7
Joined: Tue Feb 24, 2004 2:15 pm
Location: FRANCE

Post by NC »

You can install nrep_nt on any windows OS (2000 workstation/server , XP, 2003).
So, in order to test, I've installed nrpe_nt on my computer (XP).
The service is launched with an account which have some administrator's rights on domain.
UKStroller
Posts: 1
Joined: Fri Nov 05, 2004 7:56 am
Location: London

Post by UKStroller »

So it doesn't need to be installed on every server???
User avatar
kwabbernoot
Cacti User
Posts: 99
Joined: Mon Oct 13, 2003 4:11 am
Location: Zottegem, Belgium

Another possibility...

Post by kwabbernoot »

Hi,

At the company where I work we use the windows Nagios agent on the NT/2000/2003 boxes that we monitor.

see this post for more info http://forums.cacti.net/viewtopic.php?t=1041

The nagios agent has the advantage that you only need to create the script on you Cacti/*nix box. On your Windoze box you only have to make sure that the agent service runs and it is stable.

The second page of the post contains an active example of a graph using the nagios agent.

The agent can be downloaded from http://nsclient.ready2run.nl/download.htm
You need to install it on every server that you want to monitor.

Regards,
Kwabbernoot
krowix
Posts: 1
Joined: Fri Dec 21, 2007 11:22 am

Post by krowix »

You can olso install cacti on a Linux machine, NRPE_NT on 1 NT/W2K/W2K3/XP host and create template which interorage others hosts via
WMI

example:

check_wmi.pl on linux host
#!/usr/bin/perl

$response=`/var/www/cacti/scripts/check_nrpe -t 1000 -H hostnameofthenrpe_nthost -c $ARGV[0] -a $ARGV[1] $ARGV[2] $ARGV[3] $ARGV[4]`;
chomp $response;
print "$response\n";

example of commands in nrpe.cfg :
#check disk $ARG1$=hostname $ARG2$=letter
command[check_disk]=cscript //nologo //T:1000 C:\nrpe\bin\scripts\check_wmi_disk.vbs $ARG1$ $ARG2$
#check mem $ARG1$=hostname
command[check_mem]=cscript //nologo //T:1000 C:\nrpe\bin\scripts\check_wmi_mem.vbs $ARG1$
#check mem $ARG1$=hostname
command[check_cpu]=cscript //nologo //T:1000 C:\nrpe\bin\scripts\check_wmi_cpu.vbs $ARG1$
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests