Ok here goes.  

Take the two files and remove the .txt at the end of the file name.  The .asp file 
needs to go in your WUG web folder.  The .bat file needs to go somewhere else.  You 
will need to download the CURL program.  Change the configuration in both files to 
meet your need.  Set a scheduler to run the bat file every 5 minutes or as you want.  
I use the Windows Task Scheduler.  

Before you use ether of these scripts make sure you READ EVERY LINE of code and 
understand what it does.  If you don't completely understand it DO NOT RUN IT.

I hope this works well for you.

Jeff Cook
Network Administrator
Whatcom Educational Credit Union

-----Original Message-----
From: Jeff Cook 
Sent: Thursday, April 15, 2004 6:06 PM
To: '[EMAIL PROTECTED]'
Subject: RE: [WhatsUp Forum] Has anyone integrated MRTG with WUG


I have created an WUG asp page as a config file.  This means when ever I add or change 
a device in WUG the MRTG file gets changed.  Is that what you are looking for?

To use this you need a very good understanding of WUG asp language and MRTG.  


Jeff Cook
Network Administrator
Whatcom Educational Credit Union

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Dilan
Arumainathan
Sent: Thursday, April 15, 2004 8:37 AM
To: [EMAIL PROTECTED]
Subject: [WhatsUp Forum] Has anyone integrated MRTG with WUG


Hi,
I am looking for a temporary solution for producing trend reports on
bandwidth utilization on our routers. I am aware of Denika but I do not have
the budget to purchase it yet. I would like to know if anyone has used MRTG
to produce trending information on the data collected by WUG.

thanks
dilan


Please visit http://www.ipswitch.com/support/mailing-lists.html 
to be removed from this list.

An Archive of this list is available at:
http://www.mail-archive.com/whatsup_forum%40list.ipswitch.com/
##<pre>
#####################################################################
# Global Parameters
#####################################################################
##WorkDir: \\<Server>\logs\WUG-MRTG\Working
HTMLDir: \\<Server>\logs\WUG-MRTG\Working
ImageDir: \\<Server>\logs\WUG-MRTG\Working
LogDir: \\<Server>\logs\WUG-MRTG\LogFiles



#####################################################################
# Optional Global Parameters
#####################################################################
Refresh: 300
Interval: 5
IconDir: ../icons/
#LoadMIBs:
#RunAsDaemon: yes

#####################################################################
# Default Per Target Values
#####################################################################
RouterUptime[_]:
WithPeak[_]: ymw
AbsMax[_]:
MaxBytes[_]: 1250000
###
Options[^]: printrouter, pngdate, 
#Options[_]: noborder, nobanner, dorelpercent, printrouter, pngdate
Options[_]:
Options[$]:
###
XSize[_]: 600
YSize[_]: 200
###
Unscaled[_]:
###
PageTop[^]:
PageTop[_]:
PageTop[$]:
###
PageFoot[^]:
PageFoot[_]:
PageFoot[$]:
###
AddHead[^]:   <LINK href="/WUG-MRTG/MRTG.css" rel="stylesheet" type="text/css">
AddHead[_]:
AddHead[$]:
###
YLegend[_]:
LegendI[_]:
LegendO[_]:
Legend1[_]:
Legend2[_]:
Legend3[_]:
Legend4[_]:
ShortLegend[_]:
###
Colours[_]:
###
NoSpaceChar: ~
###
###
###
###

<%START_LOADED_MAP_LIST%>
<%START_DEVICE_LIST%>
<%IFNOT% %MATCH% (%DEVICE% HOST_TYPE, Subnet)>
<%IFNOT% %MATCH% (%DEVICE% HOST_TYPE, Container)>


<%IF% IS_MONITORING_ENABLED>
<%IF% IS_LOGGING_ENABLED>


#####################################################################################################
#####################################################################################################
### <%DEVICE% DISPLAY_NAME>-<%MAP% NAME>-<%DEVICE% IP_ADDRESS> ~
#####################################################################################################
Title[^]: <%DEVICE% DISPLAY_NAME>~
PageTop[^]: <H1><%DEVICE% DISPLAY_NAME> - <%DEVICE% HOST_TYPE>~
PNGTitle[^]: <%MAP% NAME>-<%DEVICE% DISPLAY_NAME>-<%DEVICE% HOST_TYPE>~




<%IF% %MATCH%(%DEVICE% POLL_TYPE, ICMP)>
### If the device is polled via ICMP, graph the ICMP resopnse time.
### This will take an extenal script to get this info.  I'll see if it can get the 
info from WUG and not have to repoll the device.
###
#Target[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-ICMP]: ### EDIT THIS TO RETURN PING TIME ###
#Title[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-ICMP]: - ICMP
#PageTop[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-ICMP]: - ICMP</H1>
#PNGTitle[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-ICMP]: - ICMP
###
<%ENDIF%>

<%IF% IS_SNMP_ENABLED>
Target[$]: <%DEVICE% READ_COMMUNITY>@<%DEVICE% IP_ADDRESS>~
<%ENDIF%>


<%START_DEVICE_SERVICE_LIST%>


<%IF% %MATCH%(%SERVICE% NAME, Interface)>
### If the device has a interface service, graph the in and out bit count.
###
Target[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-Interface<%SERVICE% ARGUMENT>]: <%SERVICE% 
ARGUMENT>:
Title[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-Interface<%SERVICE% ARGUMENT>]:  
-Interface(<%SERVICE% ARGUMENT>)<%SERVICE% COMMENT>:
PageTop[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-Interface<%SERVICE% ARGUMENT>]:  
-Interface(<%SERVICE% ARGUMENT>)<%SERVICE% COMMENT>:</H1>
PNGTitle[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-Interface<%SERVICE% ARGUMENT>]:  
-Interface(<%SERVICE% ARGUMENT>)<%SERVICE% COMMENT>:
   <%IF% %FIND_STRING% (FastEthernet,%SERVICE% COMMENT)>
MaxBytes[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-Interface<%SERVICE% ARGUMENT>]: 1250000
#AbsMax[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-Interface<%SERVICE% ARGUMENT>]:  1250000
   <%ELSEIF% %FIND_STRING% (GigabitEthernet,%SERVICE% COMMENT)>
MaxBytes[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-Interface<%SERVICE% ARGUMENT>]: 125000000
#AbsMax[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-Interface<%SERVICE% ARGUMENT>]: 125000000
   <%ENDIF%>


<%ELSEIF% %MATCH%(%SERVICE% NAME, SNMP)>
### If the device has a SNMP service, graph the ARGUMENT.
###
Target[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-<%SERVICE% COMMENT>]: <%SERVICE% ARGUMENT>:
Title[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-<%SERVICE% COMMENT>]: - <%SERVICE% COMMENT>:
PageTop[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-<%SERVICE% COMMENT>]: - <%SERVICE% 
COMMENT>:</H1>
PNGTitle[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-<%SERVICE% COMMENT>]: -<%SERVICE% COMMENT>:
###


<%ELSEIF% %MATCH%(%SERVICE% NAME, Room Temp)>
### If the device has a 'Room Temp' service, graph the temp.
### This OID is based off the one needed for the APC UPS.
###
Target[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomTemp]: 1.3.6.1.<%SERVICE% 
ARGUMENT>&1.3.6.1.<%SERVICE% ARGUMENT>:
Title[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomTemp]: - <%SERVICE% Name>:
PageTop[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomTemp]: - <%SERVICE% Name>:</H1>
PNGTitle[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomTemp]: -<%SERVICE% Name>:
MaxBytes[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomTemp]: 21
AbsMax[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomTemp]: 100
YLegend[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomTemp]: Temp. (c)
LegendI[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomTemp]: Temp.
Legend1[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomTemp]: Temp.
Legend3[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomTemp]: Maximal 5 Minute Temp.
ShortLegend[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomTemp]: Celsius
WithPeak[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomTemp]: ymw
Options[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomTemp]: gauge, unknaszero, nopercent, noo
#Colours[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomTemp]: 
WHITE#ffffff,BLUE#0000ff,WHITE#ffffff,BLUE#0000ff
###




<%ELSEIF% %MATCH%(%SERVICE% NAME, Room Humidity)>
### If the device has a 'Room Humidity' service, graph the humidity.
### This OID is based off the one needed for the APC UPS.
###
Target[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomHumidity]: 1.3.6.1.<%SERVICE% 
ARGUMENT>&1.3.6.1.<%SERVICE% ARGUMENT>:
Title[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomHumidity]: - <%SERVICE% Name>:
PageTop[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomHumidity]: - <%SERVICE% Name>:</H1>
PNGTitle[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomHumidity]: -<%SERVICE% Name>:
MaxBytes[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomHumidity]: 50
AbsMax[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomHumidity]: 100
YLegend[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomHumidity]: % Humidity
LegendO[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomHumidity]: Humidity
Legend2[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomHumidity]: Humidity
Legend4[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomHumidity]: Maximal 5 Minute Humidity
ShortLegend[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomHumidity]: %
WithPeak[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomHumidity]: ymw
Options[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomHumidity]: gauge, unknaszero, 
nopercent, noi
#Colours[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-RoomHumidity]: 
WHITE#ffffff,BLUE#0000ff,WHITE#ffffff,BLUE#0000ff
###




<%ELSEIF% %MATCH%(%SERVICE% NAME, Battery % Remaining)>
### If the device has a 'Battery % Remaining' service, graph it.
### This OID is based off the one needed for the APC UPS.
###
Target[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-BattRemaining]: 
1.3.6.1.4.1.318.1.1.1.2.2.1.0&1.3.6.1.4.1.318.1.1.1.2.2.1.0:
Title[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-BattRemaining]: - <%SERVICE% Name>:
PageTop[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-BattRemaining]: - <%SERVICE% Name>:</H1>
PNGTitle[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-BattRemaining]: -<%SERVICE% Name>:
MaxBytes[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-BattRemaining]: 100
YLegend[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-BattRemaining]: Batt % Remaining
LegendO[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-BattRemaining]: Remaining
Legend2[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-BattRemaining]: % Remaining
Legend4[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-BattRemaining]: Maximal 5 Minute % Remaining
ShortLegend[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-BattRemaining]: %
Options[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-BattRemaining]: unknaszero, noi, gauge, 
nopercent
Unscaled[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-BattRemaining]: dwmy
###




<%ELSEIF% %MATCH%(%SERVICE% NAME, Input Voltage)>
### If the device has a 'Input Voltage' service, graph the Input and Output Voltage.
### This OID is based off the one needed for the APC UPS.
###
Target[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-Voltage]: 
1.3.6.1.4.1.318.1.1.1.3.2.1.0&1.3.6.1.4.1.318.1.1.1.4.2.1.0:
Title[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-Voltage]: - Input and Output Voltage:
PageTop[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-Voltage]: - Input and Output Voltage:</H1>
PNGTitle[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-Voltage]: -Voltage:
MaxBytes[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-Voltage]: 400
YLegend[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-Voltage]: Volts AC
LegendI[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-Voltage]: Input Volts
LegendO[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-Voltage]: Output Volts
Legend1[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-Voltage]: Input Volts
Legend2[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-Voltage]: Output Volts
Legend3[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-Voltage]: Maximal 5 Minute Input Volts
Legend4[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-Voltage]: Maximal 5 Minute Output Volts
ShortLegend[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-Voltage]: Volts AC
Options[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-Voltage]: unknaszero, gauge, nopercent, 
withzeroes
###


<%ELSEIF% %MATCH%(%SERVICE% NAME, Output Load %)>
### If the device has a 'Output Load %' service, graph the Input and Output Voltage.
### This OID is based off the one needed for the APC UPS.
###
Target[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-OutputLoad]: 
1.3.6.1.4.1.318.1.1.1.4.2.3.0&1.3.6.1.4.1.318.1.1.1.4.2.3.0:
Title[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-OutputLoad]: - <%SERVICE% Name>:
PageTop[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-OutputLoad]: - <%SERVICE% Name>:</H1>
PNGTitle[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-OutputLoad]: -OutputLoad:
MaxBytes[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-OutputLoad]: 100
YLegend[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-OutputLoad]: UPS Load %
LegendI[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-OutputLoad]: Load
Legend1[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-OutputLoad]: % Load
Legend3[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-OutputLoad]: Maximal 5 Minute % Load
ShortLegend[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-OutputLoad]: %
Options[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-OutputLoad]: unknaszero, noo, gauge, 
nopercent, withzeroes
Unscaled[<%MAP% NAME>-<%DEVICE% IP_ADDRESS>-OutputLoad]: dwmy
###





<%ENDIF%>
<%END_DEVICE_SERVICE_LIST%>

<%ENDIF%>



<%ENDIF%>
<%ENDIF%>

<%ENDIF%>
<%ENDIF%>


    <%END_DEVICE_LIST%>
  <%END_LOADED_MAP_LIST%>



##</pre>
set WUGUser=<username>
set WUGPass=<password>
set WUGServer=<Server>:<Port>
set WUGPath=/MRTG-Config.asp


set pathmrtg=d:\mrtg-2.10.5\bin
set pathperl=d:\perl-5.6.0.618\bin
set pathRRD=d:\rrdtool-1.0.40

set pathcfg=\\<Server>\logs\WUG-MRTG
set pathlog=\\<Server>\logs\WUG-MRTG
set pathcurl=\\<Server>\scripts\Utils

@echo.
@echo.
set path=%path%;%pathperl%;%pathmrtg%;%pathcurl%

@echo.
@echo.


@echo Get new config file from Whatsup Gold.
%pathcurl%\curl.exe http://%WUGUser%:[EMAIL PROTECTED] > %pathcfg%\wugmrtg.new
@echo.
@echo.


@echo Test new config file.
%pathperl%\perl.exe %pathmrtg%\mrtg  %pathcfg%\wugmrtg.new --logging 
%pathlog%\wugmrtgnew.log --check
set MRTGTestError=%ERRORLEVEL%
@echo.
@echo.

@echo If the new file is good replace the old file.
@echo Error Level: %MRTGTestError%
if %MRTGTestError% == 0 copy  %pathcfg%\wugmrtg.new  %pathcfg%\wugmrtg.mrtg
if not %MRTGTestError% == 0 net send <Server> WUG MRTG Config file bad.
@echo.
@echo.

@echo Run MRTG
%pathperl%\perl.exe %pathmrtg%\mrtg  %pathcfg%\wugmrtg.mrtg --logging 
%pathlog%\wugmrtg.log 
@echo.
@echo.

time /t >> %pathlog%\wugmrtg.log





Reply via email to