Re: [Nagios-users] check_ping modify output

2008-11-08 Thread The Noob
Hello,
Before your answer , I decided to do a perl script which can do what I want
for my job.
But I like your idea and I try to modify the actual source code of
check_ping
I am a total Noob in C/C++ but I try to do this  (based on check_ping
nagios-plugins-1.4.13).
It is sure Developers Masters in C/C++ will improve it.
I add three options:
-C for Critical Output Message
-W for Warning Output Message
-O for OK Output Message

I do some tests with my modified plugin check_ping:
Before:
[EMAIL PROTECTED] plugins]# ./check_ping -H 127.0.0.1 -w 100.0,20% -c
500.0,60%  -p 2

PING OK - Packet loss = 0%, RTA = 0.07
ms|rta=0.066000ms;100.00;500.00;0.00 pl=0%;20;60;0

After:
[EMAIL PROTECTED] plugins]# ./check_ping -H 127.0.0.1 -w 100.0,20% -c
500.0,60%  -p 2 -O CUSTOM_MESSAGE_OK -C CUSTOM_MESSAGE_CRITICAL -W
WARNING_MESSAGE

CUSTOM_MESSAGE_OK|rta=0.103000ms;100.00;500.00;0.00
pl=0%;20;60;0

Before:
[EMAIL PROTECTED] plugins]# ./check_ping -H 128.0.0.1 -w 100.0,20% -c
500.0,60%  -p 2
PING CRITICAL - Packet loss =
100%|rta=500.00ms;100.00;500.00;0.00 pl=100%;20;60;0

After:
[EMAIL PROTECTED] plugins]# ./check_ping -H 128.0.0.1 -w 100.0,20% -c
500.0,60%  -p 2 -O CUSTOM_MESSAGE_OK -C CUSTOM_MESSAGE_CRITICAL -W
WARNING_MESSAGE

CUSTOM_MESSAGE_CRITICAL|rta=500.00ms;100.00;500.00;0.00
pl=100%;20;60;0

Now for warning messages( tested with iptables which block some icmp
packets..):
[EMAIL PROTECTED] plugins]# ./check_ping -H 192.168.0.4 -w 100.0,20% -c
500.0,60%  -p 10 -O CUSTOM_MESSAGE_OK -C CUSTOM_MESSAGE_CRITICAL -W
WARNING_MESSAGE

WARNING_MESSAGE|rta=1.212000ms;100.00;500.00;0.00 pl=16%;20;60;0

I hope this script can help some of you.
You can found the diff at the end of my email.
Best Regards
TheNoob


74a75,77
 char *critical_output;
 char *ok_output;
 char *warning_output;
160,162c163,168
 if (pl == 100)
 printf (_(PING %s - %sPacket loss = %d%%), state_text
(this_result), warn_text,
 pl);
---
 if (pl == 100) {
 if (critical_output != NULL)
 printf(_(critical_output));
 else
 printf (_(PING %s - %sPacket loss = %d%%), state_text
(this_result), warn_text,pl);
 }
164c170,175
 printf (_(PING %s - %sPacket loss = %d%%, RTA = %2.2f ms),
---
 if ((ok_output != NULL)  (state_text (this_result) == OK))
 printf(_(ok_output));
 else if ((warning_output != NULL)  (state_text (this_result)
== WARNING))
 printf(_(warning_output));
 else
 printf (_(PING %s - %sPacket loss = %d%%, RTA = %2.2f
ms),
221c232
 c = getopt_long (argc, argv, VvhnL46t:c:w:H:p:, longopts,
option);
---
 c = getopt_long (argc, argv, VvhnL46t:c:w:H:p:C:O:W:, longopts,
option);
289a301,309
 case 'C':
 critical_output=optarg;
 break;
 case 'O':
 ok_output=optarg;
 break;
 case 'W':
 warning_output=optarg;
 break;
584a605,607
   printf ( %s\n, -C, Critical Output Message);
   printf ( %s\n, -O, OK Output Message);
   printf ( %s\n, -W, Warning Output Message);



2008/11/6 Hendrik BŠäcker [EMAIL PROTECTED]

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 Little OT but:

 Aaron Segura schrieb:
  1)   Get the source
 
  2)   Modify
 
  3)   Compile
 
  4)   ….
 
  5)   Profit!
 
 
 6) Share it back with the community ;)

 If it's nice enough send a unified patch file to the nagiosplugs-devel
 list, may be it's going upstream?

 - -
 Hendrik
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.8 (Darwin)

 iEYEARECAAYFAkkSle0ACgkQlI0PwfxLQjkmyQCfXx2rXlxkz8357NNLxuzASkM4
 c/wAoIN3Meno8l5Fnptki9S+tsEmWQW9
 =JaT7
 -END PGP SIGNATURE-

 -
 This SF.Net email is sponsored by the Moblin Your Move Developer's
 challenge
 Build the coolest Linux based applications with Moblin SDK  win great
 prizes
 Grand prize is a trip for two to an Open Source event anywhere in the world
 http://moblin-contest.org/redirect.php?banner_id=100url=/
 ___
 Nagios-users mailing list
 Nagios-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/nagios-users
 ::: Please include Nagios version, plugin version (-v) and OS when
 reporting any issue.
 ::: Messages without supporting info will risk being sent to /dev/null

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Nagios-users mailing 

[Nagios-users] check_ping modify output

2008-11-05 Thread The Noob
Hello all,

I would like to customize the output of a check_ping command.
In fact I do not want PING KO or PING CRITICAL but another message.
Is it possible to do it ?

Thanks for your help

Best Regards
The Noob
-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Re: [Nagios-users] check_ping modify output

2008-11-05 Thread Aaron Segura
1)   Get the source

2)   Modify

3)   Compile

4)   

5)   Profit!

 



From: The Noob [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 05, 2008 8:53 AM
To: nagios-users@lists.sourceforge.net
Subject: [Nagios-users] check_ping modify output

 

Hello all, 

I would like to customize the output of a check_ping command. 
In fact I do not want PING KO or PING CRITICAL but another message.
Is it possible to do it ?

Thanks for your help

Best Regards 
The Noob

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Re: [Nagios-users] check_ping modify output

2008-11-05 Thread Sean McAfee
Aaron Segura wrote:

 1) Get the source

 2) Modify

 3) Compile

 4) ….

 5) Profit!

Or write a script that wraps around check_ping, evaluates the native 
return, then returns whatever you want.

-- 
Sean McAfee
System Engineer

Collaborative Fusion, Inc.
 [EMAIL PROTECTED]
 412-422-3463 x 4025

5849 Forbes Avenue
Pittsburgh, PA 15217


IMPORTANT: This message contains confidential information
and is intended only for the individual named. If the reader of
this message is not an intended recipient (or the individual
responsible for the delivery of this message to an intended
recipient), please be advised that any re-use, dissemination,
distribution or copying of this message is prohibited. Please
notify the sender immediately by e-mail if you have received
this e-mail by mistake and delete this e-mail from your system.
E-mail transmission cannot be guaranteed to be secure or
error-free as information could be intercepted, corrupted, lost,
destroyed, arrive late or incomplete, or contain viruses. The
sender therefore does not accept liability for any errors or
omissions in the contents of this message, which arise as a
result of e-mail transmission.





IMPORTANT: This message contains confidential information and is intended only 
for the individual named. If the reader of this message is not an intended 
recipient (or the individual responsible for the delivery of this message to an 
intended recipient), please be advised that any re-use, dissemination, 
distribution or copying of this message is prohibited. Please notify the sender 
immediately by e-mail if you have received this e-mail by mistake and delete 
this e-mail from your system.



-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null


Re: [Nagios-users] check_ping modify output

2008-11-05 Thread Marouane HIMDI
The easiest way is to develop a customised plugin (based on check_ping) and
have customised output message

 

Dr Marouane HIMDI
Ingénieur RD/RD Engineer

 



KEREVAL

4, rue Hélène Boucher

Z.A. Bellevue

35235 Thorigné Fouillard 

Tel : +33 (0)2 23 20 36 64
 http://www.kereval.com/ http://www.kereval.com

 

P Pensez à l'environnement: n'imprimez ce message et ses pièces jointes que
si nécessaire !

  _  

De : Aaron Segura [mailto:[EMAIL PROTECTED] 
Envoyé : mercredi 5 novembre 2008 17:00
À : The Noob; nagios-users@lists.sourceforge.net
Objet : Re: [Nagios-users] check_ping modify output

 

1)   Get the source

2)   Modify

3)   Compile

4)   ….

5)   Profit!

 

  _  

From: The Noob [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 05, 2008 8:53 AM
To: nagios-users@lists.sourceforge.net
Subject: [Nagios-users] check_ping modify output

 

Hello all, 

I would like to customize the output of a check_ping command. 
In fact I do not want PING KO or PING CRITICAL but another message.
Is it possible to do it ?

Thanks for your help

Best Regards 
The Noob

image001.gif-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Re: [Nagios-users] check_ping modify output

2008-11-05 Thread The Noob
Thanks all for your help.
I will try to develop a new script to modify the output for PING OK, PING
critical etc..
But I don't to forget the Exit code (0 for ping ok, 1 ping warning , 2 for
ping critical)
Best Regards
The Noob

2008/11/5 Sean McAfee [EMAIL PROTECTED]

 Aaron Segura wrote:
 
  1) Get the source
 
  2) Modify
 
  3) Compile
 
  4) ….
 
  5) Profit!
 
 Or write a script that wraps around check_ping, evaluates the native
 return, then returns whatever you want.

 --
 Sean McAfee
 System Engineer

 Collaborative Fusion, Inc.
  [EMAIL PROTECTED]
  412-422-3463 x 4025

 5849 Forbes Avenue
 Pittsburgh, PA 15217

 
 IMPORTANT: This message contains confidential information
 and is intended only for the individual named. If the reader of
 this message is not an intended recipient (or the individual
 responsible for the delivery of this message to an intended
 recipient), please be advised that any re-use, dissemination,
 distribution or copying of this message is prohibited. Please
 notify the sender immediately by e-mail if you have received
 this e-mail by mistake and delete this e-mail from your system.
 E-mail transmission cannot be guaranteed to be secure or
 error-free as information could be intercepted, corrupted, lost,
 destroyed, arrive late or incomplete, or contain viruses. The
 sender therefore does not accept liability for any errors or
 omissions in the contents of this message, which arise as a
 result of e-mail transmission.
 




 IMPORTANT: This message contains confidential information and is intended
 only for the individual named. If the reader of this message is not an
 intended recipient (or the individual responsible for the delivery of this
 message to an intended recipient), please be advised that any re-use,
 dissemination, distribution or copying of this message is prohibited. Please
 notify the sender immediately by e-mail if you have received this e-mail by
 mistake and delete this e-mail from your system.



 -
 This SF.Net email is sponsored by the Moblin Your Move Developer's
 challenge
 Build the coolest Linux based applications with Moblin SDK  win great
 prizes
 Grand prize is a trip for two to an Open Source event anywhere in the world
 http://moblin-contest.org/redirect.php?banner_id=100url=/
 ___
 Nagios-users mailing list
 Nagios-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/nagios-users
 ::: Please include Nagios version, plugin version (-v) and OS when
 reporting any issue.
 ::: Messages without supporting info will risk being sent to /dev/null

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null

Re: [Nagios-users] check_ping modify output

2008-11-05 Thread Hendrik BŠäcker
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Little OT but:

Aaron Segura schrieb:
 1)   Get the source
 
 2)   Modify
 
 3)   Compile
 
 4)   ….
 
 5)   Profit!
 
  
6) Share it back with the community ;)

If it's nice enough send a unified patch file to the nagiosplugs-devel
list, may be it's going upstream?

- -
Hendrik
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAkkSle0ACgkQlI0PwfxLQjkmyQCfXx2rXlxkz8357NNLxuzASkM4
c/wAoIN3Meno8l5Fnptki9S+tsEmWQW9
=JaT7
-END PGP SIGNATURE-

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK  win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100url=/
___
Nagios-users mailing list
Nagios-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting 
any issue. 
::: Messages without supporting info will risk being sent to /dev/null