From Mick, 3 Years ago, written in Plain Text.
Embed
  1. /**
  2.  * Xymon
  3.  */
  4. namespace LibreNMS\Alert\Transport;
  5.  
  6. use LibreNMS\Enum\AlertState;
  7. use LibreNMS\Alert\Transport;
  8.  
  9. class Xymon extends Transport
  10. {
  11.     public function deliverAlert($obj, $opts)
  12.     {
  13.         $xymon_opts['server'] =  $this->config['xymon-server'];
  14.         return $this->contactXymon($obj, $xymon_opts);
  15.     }
  16.  
  17.     public static function contactXymon($obj, $opts)
  18.     {
  19.         shell_exec("touch /tmp/last-asa-alarm");
  20.         $filename = "/tmp/" . $obj['hostname'] . "-" . str_replace(' ', '_', $obj['rule']) . ".status";
  21.         shell_exec("/usr/lib/xymon/client/bin/xymon {$opts['server']} \"{$obj['msg']}\"");
  22.         return true;
  23.     }
  24.  
  25.     public static function configTemplate()
  26.     {
  27.         return [
  28.             'config' => [
  29.                 [
  30.                     'title' => 'Xymon Server',
  31.                     'name' => 'xymon-server',
  32.                     'descr' => 'Target Xymon Server',
  33.                     'type' => 'textarea',
  34.                 ],
  35.             ],
  36.             'validation' => [
  37.                 'xymon-server' => 'required',
  38.             ]
  39.         ];
  40.     }
  41. }
  42.