perl external command example

Marc Powell marc at ena.com
Wed Jan 28 19:13:13 CET 2009


On Jan 28, 2009, at 11:22 AM, shadih rahman wrote:

> Can someone please give me an example how to submit external command  
> using perl script.  I am trying to do this and its now working.  The  
> command I am passing to named pipe is something like this.  Thanks

> }
> sub send_to_named_pipe {
>   my ($command )  = @_;
>   chomp ( $command );
>
>   if ( defined ( $command ) ) {
>     print CF "\"$command\n\"$now";

Hi Shadih,

This format is incorrect. Based on your input of  
'ACKNOWLEDGE_SVC_PROBLEM;$host;$service;1;1;1;$username;$comment',  
what's being written to the command pipe looks like

"ACKNOWLEDGE_SVC_PROBLEM;$host;$service;1;1;1;$username;$comment
" xxxxxxxxxxx (where xxxxxxxxx == timestamp).

The correct format is

[xxxxxxxxx] ACKNOWLEDGE_SVC_PROBLEM;$host;$service;1;1;1;$username; 
$comment  (where xxxxxxx==timestamp)

You want ---

   if ( defined ( $command ) ) {
     print CF "\[$now\] $command\n";

--
Marc


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Nagios-users mailing list
Nagios-users at 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





More information about the Users mailing list