mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-30 16:14:21 +02:00
replace ugly shell echo by logfile()
git-svn-id: http://www.observium.org/svn/observer/trunk@1736 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
+1
-2
@@ -184,7 +184,6 @@ if($discovered_devices) {
|
|||||||
$string = $argv[0] . " $doing " . date("F j, Y, G:i") . " - $discovered_devices devices discovered in $proctime secs";
|
$string = $argv[0] . " $doing " . date("F j, Y, G:i") . " - $discovered_devices devices discovered in $proctime secs";
|
||||||
if ($debug) echo("$string\n");
|
if ($debug) echo("$string\n");
|
||||||
|
|
||||||
# FIXME EWW
|
logfile($string);
|
||||||
shell_exec("echo '".$string."' >> ".$config['log_file']);
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
+10
-1
@@ -45,11 +45,20 @@ function zeropad_lineno($num, $length)
|
|||||||
return $num;
|
return $num;
|
||||||
}
|
}
|
||||||
|
|
||||||
function only_alphanumeric( $string )
|
function only_alphanumeric($string)
|
||||||
{
|
{
|
||||||
return preg_replace('/[^a-zA-Z0-9]/', '', $string);
|
return preg_replace('/[^a-zA-Z0-9]/', '', $string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function logfile($string)
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
$fd = fopen($config['log_file'],'a');
|
||||||
|
fputs($fd,$string);
|
||||||
|
fclose($fd);
|
||||||
|
}
|
||||||
|
|
||||||
function write_dev_attrib($device_id, $attrib_type, $attrib_value)
|
function write_dev_attrib($device_id, $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` = '" . $device_id . "' AND `attrib_type` = '$attrib_type'";
|
||||||
|
|||||||
+2
-1
@@ -326,7 +326,8 @@ if($polled_devices) {
|
|||||||
|
|
||||||
$string = $argv[0] . " $doing " . date("F j, Y, G:i") . " - $polled_devices devices polled in $poller_time secs";
|
$string = $argv[0] . " $doing " . date("F j, Y, G:i") . " - $polled_devices devices polled in $poller_time secs";
|
||||||
if ($debug) echo("$string\n");
|
if ($debug) echo("$string\n");
|
||||||
shell_exec("echo '".$string."' >> ".$config['log_file']); # FIXME EWW
|
|
||||||
|
logfile($string);
|
||||||
|
|
||||||
unset($config); ### Remove this for testing
|
unset($config); ### Remove this for testing
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user