- /**
- * Xymon
- */
- namespace LibreNMS\Alert\Transport;
- use LibreNMS\Enum\AlertState;
- use LibreNMS\Alert\Transport;
- class Xymon extends Transport
- {
- public function deliverAlert($obj, $opts)
- {
- $xymon_opts['server'] = $this->config['xymon-server'];
- return $this->contactXymon($obj, $xymon_opts);
- }
- public static function contactXymon($obj, $opts)
- {
- shell_exec("touch /tmp/last-asa-alarm");
- $filename = "/tmp/" . $obj['hostname'] . "-" . str_replace(' ', '_', $obj['rule']) . ".status";
- shell_exec("/usr/lib/xymon/client/bin/xymon {$opts['server']} \"{$obj['msg']}\"");
- return true;
- }
- public static function configTemplate()
- {
- return [
- 'config' => [
- [
- 'title' => 'Xymon Server',
- 'name' => 'xymon-server',
- 'descr' => 'Target Xymon Server',
- 'type' => 'textarea',
- ],
- ],
- 'validation' => [
- 'xymon-server' => 'required',
- ]
- ];
- }
- }