Supress API DLL output - VisualCron - Forum

Community forum

kbrady
2015-03-17T04:12:43Z
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
ErikC
2015-03-17T06:56:22Z
Hi Kirk,

I don't know if you can change the output of the dll.

You might add a new task reading the output of the powershell task and suppress the 1st line. Modify it so Nagios can handle it.
Use the output of that task for Nogios.

Regards
Erik
Uses Visualcron since 2006.
Support
2015-03-24T14:15:45Z
You cannot suppress that output but I think in later versions >7.6.2 you do not have that output to console at all.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top