mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Add webinterface support for IPMI poller
git-svn-id: http://www.observium.org/svn/observer/trunk@1766 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -59,17 +59,17 @@ function logfile($string)
|
||||
fclose($fd);
|
||||
}
|
||||
|
||||
function write_dev_attrib($device_id, $attrib_type, $attrib_value)
|
||||
function set_dev_attrib($device, $attrib_type, $attrib_value)
|
||||
{
|
||||
$count_sql = "SELECT COUNT(*) FROM devices_attribs WHERE `device_id` = '" . $device_id . "' AND `attrib_type` = '$attrib_type'";
|
||||
$count_sql = "SELECT COUNT(*) FROM devices_attribs WHERE `device_id` = '" . mres($device['device_id']) . "' AND `attrib_type` = '$attrib_type'";
|
||||
if (mysql_result(mysql_query($count_sql),0))
|
||||
{
|
||||
$update_sql = "UPDATE devices_attribs SET attrib_value = '$attrib_value' WHERE `device_id` = '$device_id' AND `attrib_type` = '$attrib_type'";
|
||||
$update_sql = "UPDATE devices_attribs SET attrib_value = '$attrib_value' WHERE `device_id` = '" . mres($device['device_id']) . "' AND `attrib_type` = '$attrib_type'";
|
||||
mysql_query($update_sql);
|
||||
}
|
||||
else
|
||||
{
|
||||
$insert_sql = "INSERT INTO devices_attribs (`device_id`, `attrib_type`, `attrib_value`) VALUES ('$device_id', '$attrib_type', '$attrib_value')";
|
||||
$insert_sql = "INSERT INTO devices_attribs (`device_id`, `attrib_type`, `attrib_value`) VALUES ('" . mres($device['device_id'])."', '$attrib_type', '$attrib_value')";
|
||||
mysql_query($insert_sql);
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ function write_dev_attrib($device_id, $attrib_type, $attrib_value)
|
||||
|
||||
function get_dev_attrib($device, $attrib_type)
|
||||
{
|
||||
$sql = "SELECT attrib_value FROM devices_attribs WHERE `device_id` = '" . $device['device_id'] . "' AND `attrib_type` = '$attrib_type'";
|
||||
$sql = "SELECT attrib_value FROM devices_attribs WHERE `device_id` = '" . mres($device['device_id']) . "' AND `attrib_type` = '$attrib_type'";
|
||||
if ($row = mysql_fetch_assoc(mysql_query($sql)))
|
||||
{
|
||||
return $row['attrib_value'];
|
||||
@@ -89,6 +89,12 @@ function get_dev_attrib($device, $attrib_type)
|
||||
}
|
||||
}
|
||||
|
||||
function del_dev_attrib($device, $attrib_type)
|
||||
{
|
||||
$sql = "DELETE FROM devices_attribs WHERE `device_id` = '" . mres($device['device_id']) . "' AND `attrib_type` = '$attrib_type'";
|
||||
return mysql_query($sql);
|
||||
}
|
||||
|
||||
function shorthost($hostname, $len=16)
|
||||
{
|
||||
$parts = explode(".", $hostname);
|
||||
|
Reference in New Issue
Block a user