<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>​Why not just use the built in proc test?  All of this is well documented in the analysis.cfg file as well as the help that is included with Xymon.<br>
</p>
<p><br>
</p>
<p>=G=<br>
</p>
<p><br>
</p>
<div style="color: rgb(33, 33, 33);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Xymon <xymon-bounces@xymon.com> on behalf of Lukas Kohl <lukas.kohl@ergodirekt.de><br>
<b>Sent:</b> Friday, April 8, 2016 8:37 AM<br>
<b>To:</b> Sir Balash<br>
<b>Cc:</b> xymon@xymon.com<br>
<b>Subject:</b> Re: [Xymon] how to write custom script for Xymon</font>
<div> </div>
</div>
<div><font size="2" face="sans-serif">Hi Balash,</font> <br>
<font size="2" face="sans-serif">this may help you. Just launch it via Cron every 5 Minutes.</font>
<br>
<br>
<tt><font size="2">#!/bin/bash</font></tt> <br>
<tt><font size="2"># procs: Seperate with ","</font></tt> <br>
<tt><font size="2">PROCS="cron,http"</font></tt> <br>
<tt><font size="2">IFS=,</font></tt> <br>
<tt><font size="2">#Machine in Xymon, which should show the status</font></tt> <br>
<tt><font size="2">MACHINE="testhost"</font></tt> <br>
<tt><font size="2"># Column in Xymon</font></tt> <br>
<tt><font size="2">TEST="procs"</font></tt> <br>
<tt><font size="2">#Xymon Server</font></tt> <br>
<tt><font size="2">BBDISP=xymon-server</font></tt> <br>
<tt><font size="2"># Xymon Port</font></tt> <br>
<tt><font size="2">BBPORT=1984</font></tt> <br>
<tt><font size="2">BB=/usr/bin/netcat</font></tt> <br>
<tt><font size="2">GLOBALCOLOR=green</font></tt> <br>
<tt><font size="2">GLOBALSTATE="ALL monitored processes are running"</font></tt> <br>
<tt><font size="2">COLOR=green</font></tt> <br>
<tt><font size="2">LINE=""</font></tt> <br>
<tt><font size="2">for</font></tt><font size="2"> </font><tt><font size="2">i in</font></tt><font size="2">
</font><tt><font size="2">$PROCS</font></tt> <br>
<tt><font size="2">do</font></tt> <br>
<tt><font size="2">        COUNT="$(ps -eo cmd|grep $i|grep -v grep|wc -l)"</font></tt>
<br>
<tt><font size="2">        if</font></tt><font size="2"> </font><tt><font size="2">[ "$COUNT"</font></tt><font size="2">
</font><tt><font size="2">-gt "0"</font></tt><font size="2"> </font><tt><font size="2">]</font></tt>
<br>
<tt><font size="2">        then</font></tt> <br>
<tt><font size="2">                LINE=$LINE"</font></tt> <br>
<tt><font size="2">&green $i is running $COUNT times"</font></tt> <br>
<tt><font size="2">                COLOR=green</font></tt> <br>
<tt><font size="2">        else</font></tt> <br>
<tt><font size="2">                LINE=$LINE"</font></tt> <br>
<tt><font size="2">&red $i is *NOT* running"</font></tt> <br>
<tt><font size="2">                COLOR=red</font></tt> <br>
<tt><font size="2">        fi</font></tt> <br>
<tt><font size="2">done</font></tt> <br>
<tt><font size="2">if</font></tt><font size="2"> </font><tt><font size="2">[ -n "$(echo $LINE|grep '&red')"</font></tt><font size="2">
</font><tt><font size="2">]</font></tt> <br>
<tt><font size="2">then</font></tt> <br>
<tt><font size="2">        GLOBALCOLOR=red</font></tt> <br>
<tt><font size="2">        GLOBALSTATE="Some processes are *NOT* running"</font></tt>
<br>
<tt><font size="2">fi</font></tt> <br>
<br>
<tt><font size="2"># send via netcat</font></tt> <br>
<tt><font size="2">echo</font></tt><font size="2"> </font><tt><font size="2">"echo "status $MACHINE.$TEST $GLOBALCOLOR $(date) $GLOBALSTATE $LINE"|$BB $BBDISP $BBPORT"</font></tt>
<br>
<font size="2" face="sans-serif"><br>
<br>
Kind regards,<br>
<br>
    Lukas Kohl<br>
    ERGO Direkt Versicherungen<br>
    Systembetrieb 2<br>
    Karl-Martell-Straße 60<br>
    90344 Nürnberg<br>
    Deutschland<br>
    Tel.: +49-911-148-2857<br>
</font><br>
<br>
<br>
<br>
<font size="1" color="#5f5f5f" face="sans-serif">Von:        </font><font size="1" face="sans-serif">Sir Balash <sirbakash@gmail.com></font>
<br>
<font size="1" color="#5f5f5f" face="sans-serif">An:        </font><font size="1" face="sans-serif">xymon@xymon.com</font>
<br>
<font size="1" color="#5f5f5f" face="sans-serif">Datum:        </font><font size="1" face="sans-serif">08.04.2016 14:16</font>
<br>
<font size="1" color="#5f5f5f" face="sans-serif">Betreff:        </font><font size="1" face="sans-serif">[Xymon] how to write custom script for Xymon</font>
<br>
<font size="1" color="#5f5f5f" face="sans-serif">Gesendet von:        </font><font size="1" face="sans-serif">"Xymon" <xymon-bounces@xymon.com></font>
<br>
<hr noshade="">
<br>
<br>
<br>
<font size="3">Hello,<br>
</font><br>
<font size="3">I will appreaciate it if someone can tell me how to write custom scripts to monitor Linux process through Xymon (i.e) zombie processes, database processes.<br>
</font><br>
<font size="3">-Balash</font><tt><font size="2">_______________________________________________<br>
Xymon mailing list<br>
Xymon@xymon.com<br>
</font></tt><a href="http://lists.xymon.com/mailman/listinfo/xymon"><tt><font size="2">http://lists.xymon.com/mailman/listinfo/xymon</font></tt></a><tt><font size="2"><br>
</font></tt><br>
<br>
<br>
<font face="Arial">www.ergodirekt.de</font><br>
<br>
<font face="Arial">Blog: </font><font face="Arial"><a href="http://blog.ergodirekt.de">http://blog.ergodirekt.de</a></font><br>
<font face="Arial">Facebook: </font><font face="Arial">www.facebook.com/ERGODirekt</font><br>
<font face="Arial">Google+: </font><font face="Arial">www.google.com/+ergodirekt</font><font face="Arial">
</font><br>
<font face="Arial">Twitter: </font><font face="Arial">www.twitter.com/ERGODirekt</font><br>
<font face="Arial">YouTube: </font><font face="Arial">www.youtube.com/ERGODirekt</font><br>
<font size="4" face="Microsoft Sans Serif">_______________________</font><br>
<br>
<font face="Arial">ERGO Direkt Lebensversicherung AG </font><font face="Microsoft Sans Serif">·</font><font face="Arial"> Amtsgericht Fürth HRB 2787
</font><font face="Microsoft Sans Serif">·</font><font face="Arial"> UST-ID-Nr. DE159593454</font><br>
<font face="Arial">ERGO Direkt Versicherung AG </font><font face="Microsoft Sans Serif">·</font><font face="Arial"> Amtsgericht Fürth HRB 2934
</font><font face="Microsoft Sans Serif">·</font><font face="Arial"> UST-ID-Nr. DE159593438</font><br>
<font face="Arial">ERGO Direkt Krankenversicherung AG </font><font face="Microsoft Sans Serif">·</font><font face="Arial"> Amtsgericht Fürth HRB 4694
</font><font face="Microsoft Sans Serif">·</font><font face="Arial"> UST-ID-Nr. DE159593446</font><br>
<font face="Arial">Vorsitzender der Aufsichtsräte der ERGO Direkt Lebensversicherung AG und der ERGO Direkt Krankenversicherung AG: Dr. Clemens Muth</font><br>
<font face="Arial">Vorsitzender des Aufsichtsrats der ERGO Direkt Versicherung AG: Christian Diedrich</font><br>
<font face="Arial">Vorstände: Peter Stockhorst (Vorsitzender), Ralf Hartmann, Dr. Jörg Stoffels
</font><font face="Microsoft Sans Serif">·</font><font face="Arial"> Sitz: Fürth</font><br>
<font face="Arial">Karl-Martell-Straße 60 </font><font face="Microsoft Sans Serif">·</font><font face="Arial"> 90344 Nürnberg
</font><font face="Microsoft Sans Serif">·</font><font face="Arial"> Internet: ergodirekt.de</font><br>
<font face="Arial">UniCredit Bank AG - HypoVereinsbank Kto.-Nr.: 66 071 430 </font>
<font face="Microsoft Sans Serif">·</font><font face="Arial"> BLZ 700 202 70</font><br>
<font face="Arial">IBAN: DE63 7002 0270 0066 0714 30 </font><font face="Microsoft Sans Serif">·</font><font face="Arial"> BIC: HYVEDEMM</font></div>
</div>
</body>
</html>