W32 DNS Statistics Perl Script using WMI

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

Moderators: Developers, Moderators

DevilSun
Cacti User
Posts: 166
Joined: Fri Jul 16, 2004 1:59 pm
Location: Oregon

W32 DNS Statistics Perl Script using WMI

Post by DevilSun »

Here is another Perl script for graphing DNS usage via WMI from a Windows 2003 Server box (may work with others)
Attachments
cacti_data_template_dns_queries.xml
Data Template
(16.93 KiB) Downloaded 2542 times
cacti_graph_template_dns_dns_queries.xml
Graph Template
(55.23 KiB) Downloaded 3007 times
w32_dns_query_stats.pl.txt
Perl Script
(3.86 KiB) Downloaded 4213 times
Last edited by DevilSun on Fri Jul 23, 2004 12:40 pm, edited 1 time in total.
DevilSun
Cacti User
Posts: 166
Joined: Fri Jul 16, 2004 1:59 pm
Location: Oregon

Post by DevilSun »

Screenshot...
Attachments
DNS Usage Graph
DNS Usage Graph
dns_graph.gif (12.9 KiB) Viewed 43221 times
jdooley
Posts: 4
Joined: Fri Sep 26, 2003 2:46 pm

Post by jdooley »

FYI: This will only work with DNS on Win2k3. The WMI DNS Provider for Win2000 doesn't include the entire MicrosoftDNS_Statistics class at all for some reason.

There are still stats you can pull, but you can't get any of the per-record type counters. Bummer.

JDooley
jayray
Posts: 27
Joined: Sat May 01, 2004 11:01 pm

Post by jayray »

How can these be modified to work with w2k?
DevilSun
Cacti User
Posts: 166
Joined: Fri Jul 16, 2004 1:59 pm
Location: Oregon

Post by DevilSun »

I don't believe it can...Microsoft is finally "coming around" and realizing that people use program statistics, and now they're starting to keep track of these statistics and use them themselves...but it seems only newer versions have these types of good statistics.

There might be some DNS statistics in Win2000 somewhere, but I doubt it'll be anything like what they expose in Win2003.
Guest

Post by Guest »

How can I interpret the graph? Is the m mili?
stucky

graph these on a linux cacti box

Post by stucky »

so this only works when running cacti on windows. What if i want to graph dns queries on a remote win2003 dns server from a cacti box runnig linux ?
SOL ?
User avatar
dev2dev
Cacti User
Posts: 60
Joined: Thu Nov 18, 2004 5:25 am
Location: Hyderabad, India
Contact:

Post by dev2dev »

http://msdn.microsoft.com/library/defau ... erview.asp

here is the link to work with the script

but, I still have the problem,
i am qurieng from win2k3 to win2k server which is my dns server
I have searched for the classes using wmi stuio (comes with the wmi tools , available at microsoft.com)
didnt find the namespace MicrosoftDNS

is there any steps I am missing?
Why me lord?
User avatar
dev2dev
Cacti User
Posts: 60
Joined: Thu Nov 18, 2004 5:25 am
Location: Hyderabad, India
Contact:

Post by dev2dev »

Why me lord?
royce
Cacti User
Posts: 79
Joined: Wed Dec 29, 2004 7:37 am
Location: Sweden

Post by royce »

There's a bug in the perl script.

There sould be no delimiter (space) at the end of the output or cactid will fail.

something like below would do the trick.

$output =~ s/.$//;

Christofer
kevin_taco
Posts: 37
Joined: Fri Feb 11, 2005 5:32 pm

Newbie - Can't get this to work

Post by kevin_taco »

Running the .pl script from the command line works (test DNS server box on being queried so really no value expected):

C:\Inetpub\wwwroot\cacti\scripts>w32_dns_query_stats.pl myserver
Total:59 Notify:0 Update:0 TKeyNego:0 Standard:59 A:59 NS:0 SOA:0 MX:0 PTR:0 SRV:0 ALL:0 IXFR:0 AXFR:0 Other:0

But I can't get any data in the graphs. Here is the Cacti Log:
02/11/2005 02:27:29 PM - SYSTEM STATS: Time: 3.3612 s, Method: cmd.php, Processes: 1, Threads: N/A, Hosts: 2, Hosts/Process: 2
02/11/2005 02:27:29 PM - POLLER: Poller[0] CACTI2RRD: c:\rrdtool\rrdtool.exe update c:\Inetpub\wwwroot\cacti\rra\myserver_total_connections_22.rrd --template 1108160846:U
02/11/2005 02:27:29 PM - POLLER: Poller[0] CACTI2RRD: c:\rrdtool\rrdtool.exe update c:\Inetpub\wwwroot\cacti\rra\myserver_total_queries_21.rrd --template 1108160846:U
02/11/2005 02:27:29 PM - CMDPHP: Poller[0] Time: 2.7863 s, Theads: N/A, Hosts: 1
02/11/2005 02:27:29 PM - PHPSVR: Poller[0] DEBUG: PHP Script Server Shutdown request received, exiting
02/11/2005 02:27:29 PM - CMDPHP: Poller[0] Host[17] CMD: perl lt;path_cactigt;/scripts/w32_iis_query_w3svc.pl lt;hostnamegt; get CurrentConnections,CurrentAnonymousUsers,CurrentNonAnonymousUsers lt;instancegt;, output: U
02/11/2005 02:27:29 PM - CMDPHP: Poller[0] Host[17] WARNING: Result from CMD not valid. Partial Result:
02/11/2005 02:27:29 PM - CMDPHP: Poller[0] Host[17] CMD: perl lt;path_cactigt;/scripts/w32_dns_query_stats.pl lt;hostnamegt;, output: U
02/11/2005 02:27:29 PM - CMDPHP: Poller[0] Host[17] WARNING: Result from CMD not valid. Partial Result:
02/11/2005 02:27:27 PM - CMDPHP: Poller[0] Host[17] RECACHE: Processing 3 items in the auto reindex cache for 'myserver'.
02/11/2005 02:27:27 PM - CMDPHP: Poller[0] Host[17] SNMP: Host responded to SNMP
02/11/2005 02:27:27 PM - CMDPHP: Poller[0] PHP Script Server Started Properly
02/11/2005 02:27:27 PM - PHPSVR: Poller[0] PHP Script Server has Started - Parent is cmd
02/11/2005 02:27:27 PM - PHPSVR: Poller[0] DEBUG: FILENM: c:\Inetpub\wwwroot\cacti\script_server.php
02/11/2005 02:27:27 PM - PHPSVR: Poller[0] DEBUG: DIRNAM: c:/inetpub/wwwroot/cacti
02/11/2005 02:27:27 PM - PHPSVR: Poller[0] DEBUG: GETCWD: c:/inetpub/wwwroot/cacti/scripts
02/11/2005 02:27:27 PM - PHPSVR: Poller[0] DEBUG: SERVER: cmd
02/11/2005 02:27:26 PM - POLLER: Poller[0] DEBUG: About to Spawn a Remote Process [CMD: c:\php\php-win.exe, ARGS: -q c:\inetpub\wwwroot\cacti/cmd.php 0 17]

Also when manuall run poller.php I get an "ERROR: Not enough arguments"

Attached is a screenshot of an error I get with viewing the details of the Data query. "Notice: Undefined variable: array_field_names in c:\inetpub\wwwroot\cacti\data_input.php on line 217

I'm also having problems getting downloaded scripts to work in general. All of them exibit this same behavior.

IIS6.0
PHP 5.0.3
rrdtool 1.0.49
mysql 4.1.9
cacti 0.8.6c

Any help is greatly appreciated.

thnx,
kevin_taco
Attachments
ss.JPG
ss.JPG (82.75 KiB) Viewed 42118 times
royce
Cacti User
Posts: 79
Joined: Wed Dec 29, 2004 7:37 am
Location: Sweden

Post by royce »

Are you missing the input hostname stanza?
kevin_taco
Posts: 37
Joined: Fri Feb 11, 2005 5:32 pm

Post by kevin_taco »

What is the hostname stanza? Am I supposed to create a hostname stanza?

Thanks,

-kevin_taco
royce
Cacti User
Posts: 79
Joined: Wed Dec 29, 2004 7:37 am
Location: Sweden

Post by royce »

There should be valid entries in the Field [Input]. I assume they are missing because there are missing input-fields in the page before the one you posted. i.e. Data template Methods.

Christofer
kevin_taco
Posts: 37
Joined: Fri Feb 11, 2005 5:32 pm

Post by kevin_taco »

Thanks for the information.

Could this be my general problem? If so how do I fix this? How do I get he Field [Input] working?

Thanks again,
kevin_taco
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests