Monitor Serv-U FTP

Windows.Server.Webservice.BasicWatcher.Monitor.WebService.FTP.ServU (UnitMonitor)

FTP Serv-U Monitor

Element properties:

TargetWindows.Server.Webservice.BasicWatcher.Computer.FTP.ServU
Parent MonitorSystem.Health.AvailabilityState
CategoryAvailabilityHealth
EnabledTrue
Alert GenerateTrue
Alert SeverityMatchMonitorHealth
Alert PriorityNormal
Alert Auto ResolveTrue
Monitor TypeMicrosoft.Windows.TimedScript.ThreeStateMonitorType
RemotableTrue
AccessibilityInternal
Alert Message
Serv-U FTP Service Down
META INFORMATION:

Server Function: {0}

Server OU: {1}

Server Service Description: {2}



CHECK DETAILS:

Message: {3}

Result: {4}
RunAsDefault

Source Code:

<UnitMonitor ID="Windows.Server.Webservice.BasicWatcher.Monitor.WebService.FTP.ServU" Accessibility="Internal" Enabled="true" Target="Windows.Server.Webservice.BasicWatcher.Computer.FTP.ServU" ParentMonitorID="Health!System.Health.AvailabilityState" Remotable="true" Priority="Normal" TypeID="Windows!Microsoft.Windows.TimedScript.ThreeStateMonitorType" ConfirmDelivery="false">
<Category>AvailabilityHealth</Category>
<AlertSettings AlertMessage="Windows.Server.Webservice.BasicWatcher.Monitor.WebService.FTP.ServU.AlertMessage">
<AlertOnState>Error</AlertOnState>
<AutoResolve>true</AutoResolve>
<AlertPriority>Normal</AlertPriority>
<AlertSeverity>MatchMonitorHealth</AlertSeverity>
<AlertParameters>
<AlertParameter1>$Data/Context/Property[@Name='Description']$</AlertParameter1>
<AlertParameter2>$Data/Context/Property[@Name='OU']$</AlertParameter2>
<AlertParameter3>$Data/Context/Property[@Name='ServiceDescription']$</AlertParameter3>
<AlertParameter4>$Data/Context/Property[@Name='Message']$</AlertParameter4>
<AlertParameter5>$Data/Context/Property[@Name='Result']$</AlertParameter5>
</AlertParameters>
</AlertSettings>
<OperationalStates>
<OperationalState ID="Error" MonitorTypeStateID="Error" HealthState="Error"/>
<OperationalState ID="Warning" MonitorTypeStateID="Warning" HealthState="Warning"/>
<OperationalState ID="Success" MonitorTypeStateID="Success" HealthState="Success"/>
</OperationalStates>
<Configuration>
<IntervalSeconds>180</IntervalSeconds>
<SyncTime/>
<ScriptName>BasicWatcher.WebService.Monitor.vbs</ScriptName>
<Arguments>Serv-U</Arguments>
<ScriptBody><Script><![CDATA[strServiceWildcard = WScript.Arguments(0)

On Error Resume Next

Set WshNetwork = CreateObject("WScript.Network")
ComputerName = WshNetwork.ComputerName

Set objADSysInfo = CreateObject("ADSystemInfo")
strComputerName = objADSysInfo.ComputerName

Set objComputer = GetObject("LDAP://" & strComputerName)
strDistinguishedName = objComputer.DistinguishedName

Set objAPI = CreateObject("MOM.ScriptAPI")
Set objBag = objAPI.CreatePropertyBag()

strReplaceMentText = "CN=" & ComputerName &","
strOUName = Replace(strDistinguishedName,strReplaceMentText,"")


strWQL = "SELECT * FROM Win32_Service WHERE Name LIKE '%" &strServiceWildcard & "%'"
strComputer = "."

Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colRunningServices = objWMIService.ExecQuery(strWQL)

For Each objService In colRunningServices
strServiceState = objService.State
strMsg = "Service State: " & strServiceState
strServiceDescription = objService.Description
strStartupMode = objService.StartMode
Next

If strStartupMode = "Disabled" Then
strRslt = "DisabledOrManual"
strMsg = strMsg & VbCrLf & " please clean configuration instead of disabling service. "
ElseIf strStartupMode = "Manual" Then
strRslt = "DisabledOrManual"
strMsg = strMsg & VbCrLf & " Startup Mode is Manual. Cannot judge service state. "
Else
If strServiceState <> "Running" Then
strRslt = "Stopped"
Else
strRslt = "Running"
End If
End If

'objAPI.LogScriptEvent "BasicWatcher.WebService.Monitor.vbs",402,4,"Monitor sends Result:" & strRslt & " for " & strServiceWildcard & " with msg: " & strMsg

strDescription = "Not Maintained"

Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem",,48)
For Each objItem In colItems
strDescription = objItem.Description
Next

Call objBag.AddValue("Result", strRslt)
Call objBag.AddValue("Message", strMsg)
Call objBag.AddValue("ServiceDescription", strServiceDescription)
Call objBag.AddValue("Description", strDescription)
Call objBag.AddValue("OU", strOUName)

objAPI.AddItem(objBag)

objAPI.ReturnItems]]></Script></ScriptBody>
<TimeoutSeconds>30</TimeoutSeconds>
<ErrorExpression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='Result']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">Stopped</Value>
</ValueExpression>
</SimpleExpression>
</ErrorExpression>
<WarningExpression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='Result']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">DisabledOrManual</Value>
</ValueExpression>
</SimpleExpression>
</WarningExpression>
<SuccessExpression>
<SimpleExpression>
<ValueExpression>
<XPathQuery Type="String">Property[@Name='Result']</XPathQuery>
</ValueExpression>
<Operator>Equal</Operator>
<ValueExpression>
<Value Type="String">Running</Value>
</ValueExpression>
</SimpleExpression>
</SuccessExpression>
</Configuration>
</UnitMonitor>