mirror of
https://github.com/librenms/librenms.git
synced 2024-09-29 06:16:43 +00:00
commit
24ace8192b
@ -326,7 +326,7 @@ function ExtTransports($obj) {
|
|||||||
foreach ($config['alert']['transports'] as $transport => $opts) {
|
foreach ($config['alert']['transports'] as $transport => $opts) {
|
||||||
if (($opts === true || !empty($opts)) && $opts != false && file_exists($config['install_dir'].'/includes/alerts/transport.'.$transport.'.php')) {
|
if (($opts === true || !empty($opts)) && $opts != false && file_exists($config['install_dir'].'/includes/alerts/transport.'.$transport.'.php')) {
|
||||||
echo $transport.' => ';
|
echo $transport.' => ';
|
||||||
eval('$tmp = function($obj,$opts) { global $config; '.file_get_contents($config['install_dir'].'/includes/alerts/transport.'.$transport.'.php').' };');
|
eval('$tmp = function($obj,$opts) { global $config; '.file_get_contents($config['install_dir'].'/includes/alerts/transport.'.$transport.'.php').' return false; };');
|
||||||
$tmp = $tmp($obj,$opts);
|
$tmp = $tmp($obj,$opts);
|
||||||
$prefix = array( 0=>"recovery", 1=>$obj['severity']." alert", 2=>"acknowledgment" );
|
$prefix = array( 0=>"recovery", 1=>$obj['severity']." alert", 2=>"acknowledgment" );
|
||||||
$prefix[3] = &$prefix[0];
|
$prefix[3] = &$prefix[0];
|
||||||
|
@ -18,31 +18,32 @@ if (is_admin() === false) {
|
|||||||
|
|
||||||
$transport = mres($_POST['transport']);
|
$transport = mres($_POST['transport']);
|
||||||
|
|
||||||
|
require_once $config['install_dir'].'/includes/alerts.inc.php';
|
||||||
|
$tmp = array(dbFetchRow('select device_id,hostname from devices order by device_id asc limit 1'));
|
||||||
|
$tmp['contacts'] = GetContacts($tmp);
|
||||||
$obj = array(
|
$obj = array(
|
||||||
'contacts' => $config['alert']['default_mail'],
|
"hostname" => $tmp[0]['hostname'],
|
||||||
'title' => 'Testing transport from ' . $config['project_name'],
|
"device_id" => $tmp[0]['device_id'],
|
||||||
'msg' => 'This is a test alert',
|
"title" => "Testing transport from ".$config['project_name'],
|
||||||
'severity' => 'critical',
|
"elapsed" => "11s",
|
||||||
'state' => 'critical',
|
"id" => "000",
|
||||||
'hostname' => 'testing',
|
"faults" => false,
|
||||||
'name' => 'Testing rule',
|
"uid" => "000",
|
||||||
|
"severity" => "critical",
|
||||||
|
"rule" => "%macros.device = 1",
|
||||||
|
"name" => "Test-Rule",
|
||||||
|
"timestamp" => date("Y-m-d H:i:s"),
|
||||||
|
"contacts" => $tmp['contacts'],
|
||||||
|
"state" => "0",
|
||||||
|
"msg" => "This is a test alert",
|
||||||
);
|
);
|
||||||
|
|
||||||
unset($obj);
|
|
||||||
$obj['contacts'] = 'test';
|
|
||||||
$obj['title'] = 'test';
|
|
||||||
$obj['msg'] = 'test';
|
|
||||||
$obj['severity'] = 'test';
|
|
||||||
$obj['state'] = 'test';
|
|
||||||
$obj['hostname'] = 'test';
|
|
||||||
$obj['name'] = 'test';
|
|
||||||
|
|
||||||
$status = 'error';
|
$status = 'error';
|
||||||
|
|
||||||
if (file_exists($config['install_dir']."/includes/alerts/transport.$transport.php")) {
|
if (file_exists($config['install_dir']."/includes/alerts/transport.".$transport.".php")) {
|
||||||
$opts = $config['alert']['transports'][$transport];
|
$opts = $config['alert']['transports'][$transport];
|
||||||
if ($opts) {
|
if ($opts) {
|
||||||
eval('$tmp = function($obj,$opts) { global $config; '.file_get_contents($config['install_dir'].'/includes/alerts/transport.'.$transport.'.php').' };');
|
eval('$tmp = function($obj,$opts) { global $config; '.file_get_contents($config['install_dir'].'/includes/alerts/transport.'.$transport.'.php').' return false; };');
|
||||||
$tmp = $tmp($obj,$opts);
|
$tmp = $tmp($obj,$opts);
|
||||||
if ($tmp) {
|
if ($tmp) {
|
||||||
$status = 'ok';
|
$status = 'ok';
|
||||||
|
Loading…
Reference in New Issue
Block a user