search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
Posted in Windows Server | No Comment | 3,650 views | 08/09/2012 18:53

This is an example config creator for MRTG.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
function New-MRTG
{
param ($VLAN, $ID)
	$Value1 = "######################################################################"
	$Value2 = "Target[VCLOUDVLAN" + $VLAN + "]:" + $ID + ":snmpname@192.168.2.1:::::2"
	$Value3 = "Directory[VCLOUDVLAN" + $VLAN + "]:fortigate"
	$Value4 = "MaxBytes[VCLOUDVLAN" + $VLAN + "]:9999999999"
	$Value5 = "Withpeak[VCLOUDVLAN" + $VLAN + "]:wmy"
	$Value6 = "Title[VCLOUDVLAN" + $VLAN + "]:Traffic Analysis for  --VCLOUDVLAN" + $VLAN
	$Value7 = "PageTop[VCLOUDVLAN" + $VLAN + "]:<H1>Traffic Analysis for VCLOUDVLAN" + $VLAN + "</H1>"
	Add-Content -Value $Value1 -Path "C:\MRTG.cfg"
	Add-Content -Value $Value2 -Path "C:\MRTG.cfg"
	Add-Content -Value $Value3 -Path "C:\MRTG.cfg"
	Add-Content -Value $Value4 -Path "C:\MRTG.cfg"
	Add-Content -Value $Value5 -Path "C:\MRTG.cfg"
	Add-Content -Value $Value6 -Path "C:\MRTG.cfg"
	Add-Content -Value $Value7 -Path "C:\MRTG.cfg"
}

Usage of this function: “New-MRTG -VLAN 2232 -ID 512”