Hi,
we use PRTG, but this is a Windows program and use Powershell/Batch/VBScript.
For Powershell it looks like this:
Call SCRIPT.ps1 <FARMNAME> server
-----------------------------------------------------------------
-----------------------------------------------------------------
$username = 'XXX'
$password = 'XXX'
$zen1 = "IP ZEN 1"
$zen2 = "IP ZEN 2"
if($args.Length -eq 2){
$farm = $args[0]
$checktyp = $args[1]
}
if($checktyp -ne "session" -and $checktyp -ne "server" -and $checktyp -ne
"master") {
$x = [string]-1 + ":Falscher checktyp!"
write-host $x
exit 2
}
# SSL Zertifikatsfehler ignorieren, bis powershell console geschlossen wird
function AllowUntrustetSSL(){
[System.Net.ServicePointManager]::ServerCertificateValidationCallback =
{$true}
$netAssembly =
[Reflection.Assembly]::GetAssembly([System.Net.Configuration.SettingsSection])
if($netAssembly)
{
$bindingFlags = [Reflection.BindingFlags]
"Static,GetProperty,NonPublic"
$settingsType =
$netAssembly.GetType("System.Net.Configuration.SettingsSectionInternal")
$instance = $settingsType.InvokeMember("Section", $bindingFlags,
$null, $null, @())
if($instance)
{
$bindingFlags = "NonPublic","Instance"
$useUnsafeHeaderParsingField =
$settingsType.GetField("useUnsafeHeaderParsing", $bindingFlags)
if($useUnsafeHeaderParsingField)
{
$useUnsafeHeaderParsingField.SetValue($instance, $true)
}
}
}
}
function DownloadWithAuth{
Param (
[string]$user,
[string]$pw,
[string]$url
)
AllowUntrustetSSL
$auth = 'Basic ' +
[System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($user+":"+$pw
))
$req = New-Object System.Net.WebClient
$req.Headers.Add('Content-Type', 'application/xml')
$req.Headers.Add('Accept', 'application/xml')
$req.Headers.Add('Authorization', $auth )
#write-host $url
try {
$Result = $req.DownloadString($url)
}
catch{
$Result = ""
}
return $Result
}
function FindInFarmStatus{
Param (
[string]$farm,
[string]$suche,
[string]$master
)
$url = "https://"+ $master
+":444/index.cgi?id=1-2&action=managefarm&farmname=" + $farm
$check = DownloadWithAuth $username $password $url
if($check.Contains($suche)){
return 0
}
else{
return 1
}
}
function GetMaster(){
$master = ""
$url = "https://" + $zen1 + ":444/index.cgi?id=1-2"
$check = DownloadWithAuth $username $password $url
if($check.Contains("this node is master")){
$master = $zen1
}
else{
$url = "https://"+$zen2+":444/index.cgi?id=1-2"
$check = DownloadWithAuth $username $password $url
if($check.Contains("this node is master")){
$master = $zen2
}
}
return $master
}
function GetServerZahlen(){
Param (
[string]$master,
[string]$farm
)
$url = "https://" + $master +
":444/index.cgi?id=1-2&action=managefarm&farmname=" + $farm
$check = DownloadWithAuth $username $password $url
$treffer = $check | select-string -pattern "(\d)*( servers, )(\d)*(
active)" -AllMatches | % { $_.Matches } | % { $_.Value }
$anz = $treffer.split(" ")
$server = @($anz[2],$anz[0])
return $server
}
function GetSessionZahlen(){
Param (
[string]$master,
[string]$farm
)
$url = "https://" + $master +
":444/index.cgi?id=1-2&action=managefarm&farmname=" + $farm
$check = DownloadWithAuth $username $password $url
$treffer = $check | select-string -pattern "(\d)*( active sessions)"
-AllMatches | % { $_.Matches } | % { $_.Value }
$anz = $treffer.split(" ")
return $anz[0]
}
$master = GetMaster
if($master -eq ""){
$x = [string]-1 + ":Kein ZEN Master!"
write-host $x
exit 2
}
elseif($checktyp -eq "session"){
$anz = GetSessionZahlen $master $farm
$x = [string] + $anz + ":Sessions"
write-host $x
exit 0
}
elseif($checktyp -eq "server"){
$anz = GetServerZahlen $master $farm
$x = [string] + $anz[0] + ":Server von " + $anz[1]
write-host $x
exit 0
}
elseif($checktyp -eq "master"){
if($master -eq $zen1){ $x = [string] 1 + ":Master " + $zen1 }
elseif($master -eq $zen2){ $x = [string] 2 + ":Master " + $zen2 }
else{ $x = [string] 0 + ":Master " + $master }
write-host $x
exit 0
}
-----------------------------------------------------------------
-----------------------------------------------------------------
Regards
Alex
Von: Abraham Macías Paredes [mailto:[email protected]]
Gesendet: Mittwoch, 7. Mai 2014 14:06
An: [email protected]
Betreff: [Zenloadbalancer-support] Magios monitoring
Hi everybody,
When you install a ZEN load balancer cluster, you know that if one server
fails the other server will take care of everything.
But I want to know if there is any way to check that both servers are alive and
working by using Nagios.
I mean, if one server is down due to a failiure and the other server fails,
then there are no more servers to keep the system online. So, how can I use
Nagios to know that one server is working and the other one is monitoring the
first one?
Thank you very much!
------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
• 3 signs your SCM is hindering your productivity
• Requirements for releasing software faster
• Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
Zenloadbalancer-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/zenloadbalancer-support