Hi,
I have written a powershell script that connects via the visualcron api dll to query job status - this will be an input to a Nagios/Icinga check.
The problem I have is that when I connect to the server, the visual cron connection method always outputs the below text to screen:
Socket connected.
License status: Activated
Nagios see's the first line (Socket connected.), and because it is not WARNING or CRITICAL, marks it as green and goes on its way.
This means however, that the script cannot pass the error details of what I want to monitor to Nagios as it will always say that.
I am wondering if there is a method to suppress this connection status info? Redirecting the object results in making it null and powershell complaing.
Relevant code snippet is:
function Get-VCServer{
[CmdletBinding()]
param ([string]$ComputerName)
$apiPath = Get-VCAPIPath
if (!(Test-Path $apiPath)) { Throw "VisualCron does not appear to be installed. API library not found at `"$apiPath`"." }
[Reflection.Assembly]::LoadFrom($apiPath) | Out-Null
$conn = New-Object VisualCronAPI.Connection
$conn.Address = "localhost"
$client = New-Object VisualCronAPI.Client
$client.Connect($conn)
}
I just want the script to output a further part of the script, which has job status details - does any one have any ideas?
Thanks