Commit version 24.12.13800

This commit is contained in:
2025-01-06 17:35:06 -05:00
parent b7f6a79c2c
commit 55d9218816
6133 changed files with 4239740 additions and 1374287 deletions

View File

@ -5,9 +5,9 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage cli
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2022 Observium Limited
* @package observium
* @subpackage cli
* @copyright (C) Adam Armstrong
*
*/
@ -16,31 +16,31 @@ chdir(dirname($argv[0]));
$options = getopt("h:qdV");
// FIXME. Config & definitions cache for 5-10 min?
include("includes/sql-config.inc.php");
include("includes/observium.inc.php");
$start = utime();
if (isset($options['V'])) {
print_message(OBSERVIUM_PRODUCT." ".OBSERVIUM_VERSION);
exit;
print_message(OBSERVIUM_PRODUCT . " " . OBSERVIUM_VERSION);
exit;
}
if ($config['poller-wrapper']['notifications']) {
print_warning("Notifications set to send inside alerter wrapper.
print_warning("Notifications set to send inside alerter wrapper.
Disable it first in config.php: \$config['poller-wrapper']['notifications'] = FALSE;");
exit;
exit;
}
if (!isset($options['q'])) {
print_cli_banner();
print_cli_banner();
}
$help = FALSE;
$help = FALSE;
$params = [];
if ($options['h'] && is_numeric($options['h'])) {
$params['device_id'] = $options['h'];
$params['device_id'] = $options['h'];
} elseif ($options['h'] !== "all") {
$help = TRUE;
$help = TRUE;
}
/* Notifications not poller locked
@ -51,7 +51,7 @@ if (isset($options['p'])) {
*/
if (!$help) {
print_message("%n
print_message("%n
USAGE:
$scriptname [-drqV] [-p poller_id] [-h device]
@ -71,20 +71,20 @@ DEBUGGING OPTIONS:
-dd More verbose debugging output.
%rInvalid arguments!%n", 'color');
exit;
exit;
}
print_cli_heading("%WStarting notifications run at ".date("Y-m-d H:i:s"), 0);
print_cli_heading("%WStarting notifications run at " . date("Y-m-d H:i:s"), 0);
if ($res = process_notifications($params)) {
$runtime = utime() - $start;
// Send all notifications (also for syslog from queue)
logfile('observium.log', count($res) . " notifications processed in ".substr($runtime, 0, 5)."s.");
$runtime = elapsed_time($start);
// Send all notifications (also for syslog from queue)
logfile('observium.log', count($res) . " notifications processed in " . substr($runtime, 0, 5) . "s.");
} else {
// For debug:
//logfile('observium.log', "No new notifications.");
// For debug:
//logfile('observium.log', "No new notifications.");
}
print_cli_heading("%WFinished notifications run at ".date("Y-m-d H:i:s"), 0);
print_cli_heading("%WFinished notifications run at " . date("Y-m-d H:i:s"), 0);
// EOF