Hello,<br>Before your answer , I decided to do a perl script which can do what I want for my job.<br>But I like your idea and I try to modify the actual source code of check_ping<br>I am a total Noob in C/C++ but I try to do this  (based on check_ping nagios-plugins-1.4.13).<br>
It is sure Developers Masters in C/C++ will improve it.<br>I add three options: <br>-C for Critical Output Message<br>-W for Warning Output Message<br>-O for OK Output Message<br><br>I do some tests with my modified plugin check_ping: <br>
Before: <br>[root@localhost plugins]# ./check_ping -H <a href="http://127.0.0.1">127.0.0.1</a> -w 100.0,20% -c 500.0,60%  -p 2<br><br>PING OK - Packet loss = 0%, RTA = 0.07 ms|rta=0.066000ms;100.000000;500.000000;0.000000 pl=0%;20;60;0<br>
<br>After: <br>[root@localhost plugins]# ./check_ping -H <a href="http://127.0.0.1">127.0.0.1</a> -w 100.0,20% -c 500.0,60%  -p 2 -O CUSTOM_MESSAGE_OK -C CUSTOM_MESSAGE_CRITICAL -W WARNING_MESSAGE<br><br>CUSTOM_MESSAGE_OK|rta=0.103000ms;100.000000;500.000000;0.000000 pl=0%;20;60;0<br>
<br>Before: <br>[root@localhost plugins]# ./check_ping -H <a href="http://128.0.0.1">128.0.0.1</a> -w 100.0,20% -c 500.0,60%  -p 2<br>PING CRITICAL - Packet loss = 100%|rta=500.000000ms;100.000000;500.000000;0.000000 pl=100%;20;60;0<br>
<br>After: <br>[root@localhost plugins]# ./check_ping -H <a href="http://128.0.0.1">128.0.0.1</a> -w 100.0,20% -c 500.0,60%  -p 2 -O CUSTOM_MESSAGE_OK -C CUSTOM_MESSAGE_CRITICAL -W WARNING_MESSAGE<br><br>CUSTOM_MESSAGE_CRITICAL|rta=500.000000ms;100.000000;500.000000;0.000000 pl=100%;20;60;0<br>
<br>Now for warning messages( tested with iptables which block some icmp packets..): <br>[root@localhost plugins]# ./check_ping -H <a href="http://192.168.0.4">192.168.0.4</a> -w 100.0,20% -c 500.0,60%  -p 10 -O CUSTOM_MESSAGE_OK -C CUSTOM_MESSAGE_CRITICAL -W WARNING_MESSAGE<br>
<br>WARNING_MESSAGE|rta=1.212000ms;100.000000;500.000000;0.000000 pl=16%;20;60;0<br><br>I hope this script can help some of you.<br>You can found the diff at the end of my email.<br>Best Regards<br>TheNoob<br><br><br>74a75,77<br>
> char *critical_output;<br>> char *ok_output;<br>> char *warning_output;<br>160,162c163,168<br><         if (pl == 100)<br><             printf (_("PING %s - %sPacket loss = %d%%"), state_text (this_result), warn_text,<br>
<                             pl);<br>---<br>>         if (pl == 100) {<br>>             if (critical_output != NULL) <br>>                 printf(_(critical_output));<br>>             else<br>>                 printf (_("PING %s - %sPacket loss = %d%%"), state_text (this_result), warn_text,pl);        <br>
>         }<br>164c170,175<br><             printf (_("PING %s - %sPacket loss = %d%%, RTA = %2.2f ms"),<br>---<br>>             if ((ok_output != NULL) && (state_text (this_result) == "OK"))<br>
>                 printf(_(ok_output));<br>>             else if ((warning_output != NULL) && (state_text (this_result) == "WARNING"))<br>>                 printf(_(warning_output));<br>>             else<br>
>                 printf (_("PING %s - %sPacket loss = %d%%, RTA = %2.2f ms"),<br>221c232<br><         c = getopt_long (argc, argv, "VvhnL46t:c:w:H:p:", longopts, &option);<br>---<br>>         c = getopt_long (argc, argv, "VvhnL46t:c:w:H:p:C:O:W:", longopts, &option);<br>
289a301,309<br>>         case 'C':<br>>             critical_output=optarg;<br>>             break;<br>>         case 'O':<br>>             ok_output=optarg;<br>>             break;<br>>         case 'W':<br>
>             warning_output=optarg;<br>>             break;<br>584a605,607<br>>   printf (" %s\n", "-C, Critical Output Message");<br>>   printf (" %s\n", "-O, OK Output Message");<br>
>   printf (" %s\n", "-W, Warning Output Message");<br><br><br><br><div class="gmail_quote">2008/11/6 Hendrik BŠäcker <span dir="ltr"><<a href="mailto:andurin@process-zero.de">andurin@process-zero.de</a>></span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA1<br>
<br>
Little OT but:<br>
<br>
Aaron Segura schrieb:<br>
<div class="Ih2E3d">> 1)       Get the source<br>
><br>
> 2)       Modify<br>
><br>
> 3)       Compile<br>
><br>
> 4)       ….<br>
><br>
> 5)       Profit!<br>
><br>
><br>
</div>6) Share it back with the community ;)<br>
<br>
If it's nice enough send a unified patch file to the nagiosplugs-devel<br>
list, may be it's going upstream?<br>
<br>
- -<br>
Hendrik<br>
-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v1.4.8 (Darwin)<br>
<br>
iEYEARECAAYFAkkSle0ACgkQlI0PwfxLQjkmyQCfXx2rXlxkz8357NNLxuzASkM4<br>
c/wAoIN3Meno8l5Fnptki9S+tsEmWQW9<br>
=JaT7<br>
-----END PGP SIGNATURE-----<br>
<div><div></div><div class="Wj3C7c"><br>
-------------------------------------------------------------------------<br>
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge<br>
Build the coolest Linux based applications with Moblin SDK & win great prizes<br>
Grand prize is a trip for two to an Open Source event anywhere in the world<br>
<a href="http://moblin-contest.org/redirect.php?banner_id=100&url=/" target="_blank">http://moblin-contest.org/redirect.php?banner_id=100&url=/</a><br>
_______________________________________________<br>
Nagios-users mailing list<br>
<a href="mailto:Nagios-users@lists.sourceforge.net">Nagios-users@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/nagios-users" target="_blank">https://lists.sourceforge.net/lists/listinfo/nagios-users</a><br>
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.<br>
::: Messages without supporting info will risk being sent to /dev/null</div></div></blockquote></div><br>