mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 08:02:41 +02:00
Added new health admin page for thresholds
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (C) 2013 LibreNMS Contributors librenms-project@googlegroups.com
|
||||
*/
|
||||
|
||||
// FUA
|
||||
|
||||
if(!is_numeric($_POST['device_id']) || !is_numeric($_POST['sensor_id']) || (empty($_POST['data']) || !isset($_POST['data'])))
|
||||
{
|
||||
echo('error with data');
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
$update = dbUpdate(array($_POST['value_type'] => $_POST['data']), 'sensors', '`sensor_id` = ? AND `device_id` = ?', array($_POST['sensor_id'],$_POST['device_id']));
|
||||
if(!empty($update) || $update == '0')
|
||||
{
|
||||
echo('success');
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo('error');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (C) 2013 LibreNMS Contributors librenms-project@googlegroups.com
|
||||
*/
|
||||
|
||||
// FUA
|
||||
|
||||
for($x=0;$x<count($_POST['sensor_id']);$x++)
|
||||
{
|
||||
dbUpdate(array('sensor_limit' => $_POST['sensor_limit'][$x], 'sensor_limit_low' => $_POST['sensor_limit_low'][$x], 'sensor_alert' => $_POST['sensor_alert'][$x]), 'sensors', '`sensor_id` = ?', array($_POST['sensor_id'][$x]));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (C) 2013 LibreNMS Contributors librenms-project@googlegroups.com
|
||||
*/
|
||||
|
||||
// FUA
|
||||
|
||||
if(!is_numeric($_POST['device_id']) || !is_numeric($_POST['sensor_id']))
|
||||
{
|
||||
echo('error with data');
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
if($_POST['state'] == 'true')
|
||||
{
|
||||
$state = 1;
|
||||
}
|
||||
elseif($_POST['state'] == 'false')
|
||||
{
|
||||
$state = 0;
|
||||
}
|
||||
$update = dbUpdate(array('sensor_alert' => $state), 'sensors', '`sensor_id` = ? AND `device_id` = ?', array($_POST['sensor_id'],$_POST['device_id']));
|
||||
if(!empty($update) || $update == '0')
|
||||
{
|
||||
echo('success');
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
echo('error');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user