nagios-irssi.pl 809 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/usr/bin/perl -w
  2. # asr - Gaetan Ryckeboer - 2014
  3. #
  4. # Nagios notification to irssi handler
  5. # Based on capture_plugin.pl v1.0 from Wolfgang Wagner, 2007.
  6. #
  7. use strict;
  8. my $FIFO="/home/tc-14/var/nagios-fifo";
  9. $FIFO = shift;
  10. # This plugin does not need any nagios utils. It just interfaces the original plugin.
  11. my ($cmd, $ret_code, $output);
  12. # First display all arguments
  13. my ($numArgs, $argnum);
  14. $numArgs = $#ARGV + 1;
  15. # create the command-line
  16. $cmd = "";
  17. $cmd = join " ", @ARGV;
  18. #print "$cmd\n";
  19. # log the start, output, retcode & end
  20. my $LogFile;
  21. # open could be better: check success later; if unsuccessful return UNKNWON to Nagios
  22. open (LogFile, ">>$FIFO") || die ("Cannot open logfile");
  23. print LogFile "$cmd\n";
  24. close(LogFile);
  25. # avoid access problems for others.
  26. #chmod 0777, $LOG_FILE;
  27. exit 1;