Skip to content

Commit

Permalink
Resolving issue #2140
Browse files Browse the repository at this point in the history
  • Loading branch information
netniV committed Nov 1, 2018
1 parent a96f060 commit 788a3d7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
10 changes: 5 additions & 5 deletions cmd.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ function debug_level($host_id, $level) {
}
}

require(__DIR__ . '/include/cli_check.php');
require($config['base_path'] . '/lib/snmp.php');
require($config['base_path'] . '/lib/poller.php');
require($config['base_path'] . '/lib/rrd.php');
require($config['base_path'] . '/lib/ping.php');
require_once(__DIR__ . '/include/cli_check.php');
require_once($config['base_path'] . '/lib/snmp.php');
require_once($config['base_path'] . '/lib/poller.php');
require_once($config['base_path'] . '/lib/rrd.php');
require_once($config['base_path'] . '/lib/ping.php');

// let the poller server know about cmd.php being finished
function record_cmdphp_done($pid = '') {
Expand Down
10 changes: 5 additions & 5 deletions cmd_realtime.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
+-------------------------------------------------------------------------+
*/

require(__DIR__ . '/include/cli_check.php');
require($config['base_path'] . '/lib/snmp.php');
require($config['base_path'] . '/lib/poller.php');
require($config['base_path'] . '/lib/rrd.php');
require($config['base_path'] . '/lib/ping.php');
require_once(__DIR__ . '/include/cli_check.php');
require_once($config['base_path'] . '/lib/snmp.php');
require_once($config['base_path'] . '/lib/poller.php');
require_once($config['base_path'] . '/lib/rrd.php');
require_once($config['base_path'] . '/lib/ping.php');

ini_set('max_execution_time', '0');

Expand Down
6 changes: 6 additions & 0 deletions lib/dsstats.php
Original file line number Diff line number Diff line change
Expand Up @@ -817,25 +817,31 @@ function dsstats_rrdtool_init() {
@arg $pipes - (array) An array of stdin and stdout pipes to read and write data from
@returns - (string) The output from RRDtool */
function dsstats_rrdtool_execute($command, $pipes) {
global $config;
$stdout = '';

if ($command == '') return;

$command .= "\r\n";
$return_code = fwrite($pipes[0], $command);

$return_reason = 'EOF';
while (!feof($pipes[1])) {
$stdout .= fgets($pipes[1], 4096);

if (substr_count($stdout, 'OK')) {
$return_reason = 'OK';
break;
}

if (substr_count($stdout, 'ERROR')) {
$return_reason = 'ERROR';
break;
}
}

$temp = tempnam($config['base_path'], 'dsstats');
file_put_contents("Command: $command\nReason: $return_reason\nOutput:\n$stdout", $temp);
if (strlen($stdout)) return $stdout;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/installer.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
include(dirname(__FILE__) . '/../lib/poller.php');
include_once(dirname(__FILE__) . '/../lib/poller.php');

class Installer implements JsonSerializable {
const EXIT_DB_EMPTY = 1;
Expand Down

0 comments on commit 788a3d7

Please sign in to comment.