New perl scripts for monitoring Windows servers...

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

Moderators: Developers, Moderators

jlancaster
Posts: 38
Joined: Tue Feb 04, 2003 12:05 pm
Location: Dallas, TX
Contact:

New perl scripts for monitoring Windows servers...

Post by jlancaster »

Cacti v0.6.8a Extensions

ftp://216.62.51.106/pub/cacti-ext.zip

The Extensions include a network discovery add-on and perl scripts for monitoring Windows servers, managed switches, and printers.

The Windows script, w2kperf.pl, uses WMI to provide performance for server CPU, memory, disk & interface performance, no matter how many CPUs, logical disks, or NICs the server has in it. More importantly, w2kperf.pl can automatically create the cacti DIS, DS & graphs for you. The one drawback? Because the script uses WMI to collect the data it can only be run from a Windows installation of cacti.

The other scripts should be more portable. The network discovery tool, discover.pl, uses SNMP & WMI (which can be disabled) to locate active IP addresses on your network and provides an educated guess as to what kind of device (Windows server, NetWare server, Linux server, HP printer, switch, router, etc) they are. This allows you to setup monitoring & graphing in minutes using the supplied scripts. Th discovery tool can be integrated right into the Cacti 0.6.8a menu if you so desire.

Printer.pl collects page count and interface stats from networked printers.

Switch.pl collects ifEntry and RMON etherStats for all ports (and VLANs) on a managed switch. The RMON graphs show packet size distribution and the different types of ethernet errors: CRC errors, fragments, jabbers, etc.

Finally, there are a handful of useful utilities included in the download. Some batch files, some SQL queries, some more perl scripts.

Coming soon: Linux servers, APC UPS, NetWare servers, and routers.
Last edited by jlancaster on Fri Mar 21, 2003 3:11 pm, edited 2 times in total.
VeSSer
Posts: 5
Joined: Tue Mar 11, 2003 3:28 pm

Post by VeSSer »

thanks dude! People may have more luck going into the pub dir though..

ftp://216.62.51.106/pub/cacti-ext.zip
jlancaster
Posts: 38
Joined: Tue Feb 04, 2003 12:05 pm
Location: Dallas, TX
Contact:

Post by jlancaster »

Thanks! I fixed the link in my original post.
User avatar
ablyler
Posts: 40
Joined: Tue Mar 19, 2002 7:00 pm
Location: Ann Arbor, MI
Contact:

Post by ablyler »

Jim, very nicely put together script. But I have ran into a little issue, one of my servers is returning the following:
Print results for siweb01:

Computername => SIWEB01
0 => Descr => CPU0
0 => PercentCPULoad => 0
Memory => BytesFreeMem => 1009643520
Memory => BytesFreePageFile => 3058872320
Memory => BytesFreeVirtMem => 4068515840
Memory => PercentFreeMem => 75
Memory => PercentFreePageFile => 95
Memory => PercentFreeVirtMem => 1604
Memory => TotalPageFileSpace => 3206967296
Memory => TotalPhysicalMemory => 1341685760
Memory => TotalVirtualMemory => 253685760
0 => BytesFreeDisk => 4327505408
0 => Descr => C:
0 => PercentFreeDisk => 50
0 => Size => 8589786624

Results for siweb01 complete.
I don't know why it is coming back with such a high percentage, this is a Window 2003 RC 2 box. I have 2 other Windows 2003 RC 2 boxes that return valid data.

Have you tried working with .8 yet? .8 would make this script alot easier.
jlancaster
Posts: 38
Joined: Tue Feb 04, 2003 12:05 pm
Location: Dallas, TX
Contact:

Post by jlancaster »

Thanks for the feedback. Your results are interesting. I don't have any W2K3 boxes that I can use for testing, so I'm not sure if the problem is specific to that version of Windows.

I'm using pretty basic WMI calls to get the Virtual Memory counters. Have you tried using the WMI Object Browser that is part of WMITools.exe to look at the counters directly? (If not, it is a free download from Microsoft's website.) In W2K and NT4, virtual memory just the sum of physical memory and the pagefile. I use it principally as a check figure. I would be very interested in hearing what you discover via the WMI Object Browser.

I have seen another problem in my testing that is kind of strange. One of the SNMP interface stats comes back as a negative number on one of my servers. It is incrementing correctly as new traffic crosses the interface, i.e., the negative number is growing smaller. I'm not sure what to make of it. The negative counter sure plays hell with the graph. According the the RFC, a negative number is not possible.

As to v0.8, I'm still trying to get it up and running on a Windows box. No success so far, but I'm working with raX to fix it. Once I get it working, I'll begin modifying my scripts to work with the new version.

BTW, did you install the new "Discover" menu item? I'm curious to see how that will work for the cacti community.

Jim
User avatar
ablyler
Posts: 40
Joined: Tue Mar 19, 2002 7:00 pm
Location: Ann Arbor, MI
Contact:

Post by ablyler »

FreeVirtualMemory: 3894804
TotalVirtualMemorySize: 4442044
I have not tried the Discover feature yet, but plan on doing so.
jlancaster
Posts: 38
Joined: Tue Feb 04, 2003 12:05 pm
Location: Dallas, TX
Contact:

Post by jlancaster »

Check the ftp link for the latest update. I just completed a big revision (although I don't think I've done anything that would address the VM problem you are having.)

I've also added a new script:
switch.pl - SNMP Interface/RMON Performance reporting

All of the other perl scripts had to be revised to accommodate the changes introduced by switch.pl. If you haven't installed the cacti-ext.sql, hold off until you download this update. I modified the query slightly to add a new field to the discover_hosts table.

There are a variety of other useful additions and an updated readme.txt that explains the update in more detail.

Jim
brunis
Posts: 3
Joined: Sun May 19, 2002 6:40 pm

Post by brunis »

DAMN.. i was so excited when i read this the first time.. then i download and install... to find out it has to RUN FROM Windows.. argh..
fraefel
Posts: 1
Joined: Mon Mar 10, 2003 8:47 am

Post by fraefel »

Hi Brunis !

The script relies heavily on WMI (Windows Management Instrumentation) in some modules, which is only available on the Windows platform (preinstalled from W2K and up) -> though is a lot of these values available as performance counters too, which can be made available via the SNMP interface (jlancaster uses this too...)

But maybe jlancaster should make a remark regarding the OS Requirement on the first post... :wink:

BTW. Very, very nice work, jlancaster ! :D

\Fraefel
Last edited by fraefel on Fri Mar 21, 2003 11:35 am, edited 1 time in total.
User avatar
ablyler
Posts: 40
Joined: Tue Mar 19, 2002 7:00 pm
Location: Ann Arbor, MI
Contact:

Problem Solved

Post by ablyler »

I just needed to up the RRD Max Value field. :lol:
jlancaster
Posts: 38
Joined: Tue Feb 04, 2003 12:05 pm
Location: Dallas, TX
Contact:

Post by jlancaster »

Thanks for the feedback. I've just posted (yet) another revision the scripts--mostly few bug fixes. I discovered in testing that not all ifEntry stats have corresponding RMON stats. I made an adjustment so that if RMON isn't available for a port, the script will create an ifEntry poll only.

I also had to adjust my printer.pl script for those printers that don't support the MIB2 printer standard. Now, the printer.pl script will pull page count (if there) and ifEntry stats correctly.

I'm sorry I buried the Windows requirement in the readme. It should apply only to the w2kperf.pl script because I'm using WMI to gather the data. The use of WMI in the discover.pl script can be turned off with a '-w' parameter. I'll edit my original post to prevent future confusion.

My testing with WMI has left me somewhat uneasy. It doesn't appear to be as reliable as SNMP. I use GetIf to reivew the MIBs for interesting data, then compare it to what WMI provides. In some cases I've found dramatic differences in counter values and I have no idea why. In a future revision of these extensions I will look into porting w2kperf.pl over to SNMP. This would have the obvious benefit of making the scripts more universal.

Linux server performance stats is next on my list, followed by APC UPS, then perhaps NetWare. Linux should be ready in a week or so, with the others to follow some time after.

Finally, I will be working on a reporting system. My intention is to create a system that will allow you to specify a date range, then generate templated HTML reports in from the RRDTool datafiles. We need this for reporting to our clients on a quarterly basis. I'm sure others of you out there would like the same thing. I've promised my staff to have a working draft in a couple of weeks, with distributable code by the end of April. We'll see.

What I really need from the cacti community is suggestions on graph formats. Things like what information should be combined on the different graphs, presentation format (line or area graphs, color schemes, etc.), and even short explanatory verbiage on what the graphs mean that I can include in the HTML reports.

Thanks again for the feedback.

Enjoy!

Jim
Rahvin
Posts: 3
Joined: Wed Apr 30, 2003 10:15 am
Contact:

Post by Rahvin »

jlancaster wrote:
....

I've also added a new script:
switch.pl - SNMP Interface/RMON Performance reporting
....

Jim
Hi there, i must commend you on your nice scripts.

i am having one little problem with the switch.pl script tho.

im trying to use that script on a bunch of alcatel switches an Omnis 9s/r and a whole stack of Omnistack 4024G switches.

the problem i have is that the IfDescr in the switches contains Spaces

which means that nothing will work because the .rra files may not contain space.

now im not a programmer at all. my question to you is. what do i need to add to the script.pl file so it edits out the spaces or replaces it with a dash or someother karacter that is allowed.

here is an example
CANNOT FIND DATA SOURCE: c:/apache/htdocs/cacti/rra/mer1-sw24-1-10/100mb ethernet csma/cd interface.rrd

[/Edit]

i replaced IfDescr for ifNumber so it would take the interfacenumber (its what i wanted in the first place) but this screws the Graph hirarchy up. in a really bad way.

[/Edit]
ERNY

problems with perl modules (missing)

Post by ERNY »

I hav problems with DBI.pm and NET/SNMP.pm modules.
They could not be found:(


Sample::
Can't locate DBI.pm in @INC (@INC contains: C:/Perl/lib C:/Perl/site/lib .) at w2kperf.pl line 133.
BEGIN failed--compilation aborted at w2kperf.pl line 133.


Where can I found these modules?
jlancaster
Posts: 38
Joined: Tue Feb 04, 2003 12:05 pm
Location: Dallas, TX
Contact:

Post by jlancaster »

Are you using version 5.8 of Perl? I don't think the DBI module is available for it yet.

Jim
luuk

Post by luuk »

Any update about the conversion to version 0.8?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest