Hi all. I would like to monitor the size of our mail server queue. I can issue a command via SSH that will return the size of the queue.
I hoped that the SSH Test could alert me if the queue size was greater than 1000. I tried this:
Test method: SSH test
Command: exim -bpc
Check for: Text output
Alert if: expression true %Reply_Integer% > 1000
However, even if the result from the command is greater than 1000, it does not alert.
I have also tried various alternate expressions...
%Reply% > 1000
'%Reply%' > 1000
> 1000
But these do not work.
As I read the manual, it seems maybe "expression true" only works with BOOLEAN operators? So, then I could only use AND NOT OR?
Sorry for my confusion... if anyone has any ideas how I might be able to do this, I'd greatly appreciate it!!
- Scott
Help with SSH Test expression
Quote from the manual
expression true - HostMonitor will consider provided text as boolean (logical) expression, evaluate this expression using data received from the server, and set "Bad" status when retrieved data does not satisfy the required conditions. For example: if you define expression like "'No errors' and not ('Error' or 'Warning')", then HostMonitor will mark test as "Ok" when command output contains string 'No error' and does not contain either 'Error' or 'Warning'
In the expression you may use strings (must be put in quotes (') or in double quotes (")); round brackets; logical operators "and", "or", "not".
Can you modify script and return queue size as exit code or return text like scriptres:Ok:550 ?
Regards
Alex
expression true - HostMonitor will consider provided text as boolean (logical) expression, evaluate this expression using data received from the server, and set "Bad" status when retrieved data does not satisfy the required conditions. For example: if you define expression like "'No errors' and not ('Error' or 'Warning')", then HostMonitor will mark test as "Ok" when command output contains string 'No error' and does not contain either 'Error' or 'Warning'
In the expression you may use strings (must be put in quotes (') or in double quotes (")); round brackets; logical operators "and", "or", "not".
Can you modify script and return queue size as exit code or return text like scriptres:Ok:550 ?
Regards
Alex
Hi Alex.
This is an existing command from the mail server software, and when issued simply returns a number. Example:
COMMAND: exim -bpc
RESPONSE: 1234
I had hoped that HostMonitor could evaluate the response "1234" and ALERT if the response was greater than 1000.
From your reply, it does not sound possible, therefore we would have to write our own program/script to evaluate it. We were hoping for simple solution, but maybe writing a script will not be too difficult (I'm not a programmer)
- Scott
This is an existing command from the mail server software, and when issued simply returns a number. Example:
COMMAND: exim -bpc
RESPONSE: 1234
I had hoped that HostMonitor could evaluate the response "1234" and ALERT if the response was greater than 1000.
From your reply, it does not sound possible, therefore we would have to write our own program/script to evaluate it. We were hoping for simple solution, but maybe writing a script will not be too difficult (I'm not a programmer)
- Scott
You need program that will translate output into errorlevel code and simple BAT file like EximErrLevel.BAT
Start BAT file using command line like cmd /c c:\tests\EximErrLevel.BAT
Exitcode1.exe available at www.ks-soft.net/download/other/exitcode1.zip
Regards
Alex
Code: Select all
@echo off
for /f %%i in ('exim.exe -bpc') do exitcode1.exe %%i
if errorlevel 1000 goto bad1
echo scriptres:Ok:%errorlevel%
exit
:bad1
echo scriptres:Bad:%errorlevel%
Exitcode1.exe available at www.ks-soft.net/download/other/exitcode1.zip
Regards
Alex