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

Badges
MCSE
Community

Cozumpark Bilisim Portali
Posted in Windows Powershell | No Comment | 1,555 views | 10/09/2009 22:30

Aşağıdaki Powershell scripti ile bir veritabanından çektirdiğiniz ip adresleri ile sunucu isimlerini, Argus yazılımının config dosyasına uygun hale getirebilirsiniz.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Add-PSSnapin -name Microsoft.SystemCenter.VirtualMachineManager
Get-Vmmserver localhost
$VMProp = Get-VM | Select-Object -Property Name,OperatingSystem
Foreach ($i in $VMProp)
{
$VMName = $i.Name
$gateway = ($prefix.split("/")[0])
$netid = [System.Net.IPAddress]("$gateway");
$bits = $netid.GetAddressBytes()
$ip1=$bits[0]
$ip2=$bits[1]
$ip3=$bits[2]
$ip5=$bits[3]+2
$strIpAddress = "$ip1.$ip2.$ip3.$ip5"
$valuebir = '        Host "' + $VMName + '" {'
$valueiki = '                hostname: ' + $strIpAddress
$valueikibucuk = '                Service Ping'
$valueuc = '                Service TCP/HTTP'
$valuedort = '        }'
add-content -path “C:\argus.txt” -value $valuebir
add-content -path “C:\argus.txt” -value $Valueiki
add-content -path “C:\argus.txt” -value $Valueikibucuk
add-content -path “C:\argus.txt” -value $valueuc
add-content -path “C:\argus.txt” -value $valuedort
}

Powershell üzerinden nasıl SQL bağlantısı yapılabileceğini site üzerinde arama yaparak bulabilirsiniz.


Posted in Virtual Machine Manager, Windows Powershell | No Comment | 7,764 views | 20/06/2009 08:42

I will list all virtual machines and their ip address, then I will export this informations to Argus, so I can see all virtual machines status with Argus or similar network traffic controller. You can’t get ip address with this method because it’s not possible, at least now. I used MSSQL server to get CIDRs of virtual machines.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Add-PSSnapin -name Microsoft.SystemCenter.VirtualMachineManager
Get-Vmmserver localhost
$VMProp = Get-VM | Select-Object -Property Name,OperatingSystem
foreach ($i in $VMProp)
{
	$VMName = $i.Name
	$VMIP = $i.IPAddress
 
             $valueone = '        Host "' + $VMName + '" {'
             $valuetwo = '                hostname: ' + $VMIP
             $valuethree = '                Service TCP/HTTP'
             $valuefour = '        }'
 
	add-content -path “C:\argus.txt” -value $valueone
	add-content -path “C:\argus.txt” -value $valuetwo
	add-content -path “C:\argus.txt” -value $valuethree
	add-content -path “C:\argus.txt” -value $valuefour
}

You can copy Argus.txt codes and past it to your Argus config file, \var\argus\config.php.