Skip to content

Commit

Permalink
Upgrade to Observium CE 20.9
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielleHuisman committed Mar 15, 2021
1 parent 78875cf commit 509a6ad
Show file tree
Hide file tree
Showing 3,065 changed files with 3,662,115 additions and 985,328 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion LICENSE.COMMUNITY
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Observium License Version 1.0

Copyright (c) 2007-2013 Adam Armstrong
(c) 2013-2018 Observium Limited
(c) 2013-2020 Observium Limited

The intent of this license is to establish the freedom to use, share and contribute to
the software regulated by this license.
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Observium CE 19.8
Observium CE 20.9
9 changes: 6 additions & 3 deletions alerter.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env php
<?php

/**
* Observium
*
Expand All @@ -9,7 +8,7 @@
* @package observium
* @subpackage poller
* @author Adam Armstrong <adama@observium.org>
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2019 Observium Limited
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2020 Observium Limited
*
*/

Expand Down Expand Up @@ -43,7 +42,11 @@
print_cli_banner();
}

if ($options['h'] == "all") { $where = " "; $doing = "all"; }
if ($options['h'] === "all")
{
$where = " ";
$doing = "all";
}
elseif ($options['h'])
{
$params = array();
Expand Down
89 changes: 0 additions & 89 deletions check-services.php

This file was deleted.

44 changes: 33 additions & 11 deletions discovery.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
chdir(dirname($argv[0]));

// Get options before definitions!
$options = getopt("h:i:m:n:dqurMV");
$options = getopt("h:i:m:n:U:dquaMV");

include("includes/sql-config.inc.php");
include("includes/discovery/functions.inc.php");
Expand Down Expand Up @@ -110,7 +110,8 @@
$doing = $options['n'] . '/' . $options['i'];
}

if (isset($options['u']) || ($where && in_array($options['h'], array('all', 'odd', 'even'))))
if (isset($options['u']) || isset($options['U']) ||
($where && in_array($options['h'], array('all', 'odd', 'even'))))
{
$options['u'] = TRUE;

Expand All @@ -128,7 +129,7 @@
unset($db_version);
}

if (!$where && !$options['u'])
if (!$where && !$options['u'] && !isset($options['a']))
{
print_message("%n
USAGE:
Expand All @@ -149,6 +150,7 @@
-i Discovery instance.
-n Discovery number.
-q Quiet output.
-a Force update Groups/Alerts table
-u Upgrade DB schema
-M Show globally enabled/disabled modules and exit.
-V Show version and exit.
Expand All @@ -166,7 +168,19 @@
include($config['install_dir'] . '/includes/versioncheck.inc.php');
}

if (!$where) { exit; }
if (!$where)
{
// Only update Group/Alert tables
if (isset($options['a']))
{
$silent = isset($options['q']);
// Not exist in CE
if (function_exists('update_group_tables')) { update_group_tables($silent); }
if (function_exists('update_alert_tables')) { update_alert_tables($silent); }
}

exit;
}

// For not new devices discovery, skip down devices
if ($options['h'] != 'new')
Expand All @@ -189,9 +203,6 @@
if ($options['h'] == 'new' || isSNMPable($device))
{
discover_device($device, $options);
// Not exist in CE
if ((!isset($options['m']) || isset($options['r'])) && function_exists('update_group_tables')) { update_group_tables(); }
if ((!isset($options['m']) || isset($options['r'])) && function_exists('update_alert_tables')) { update_alert_tables(); }
} else {
$string = "Device '" . $device['hostname'] . "' skipped, because switched off during runtime discovery process.";
print_debug($string);
Expand All @@ -205,8 +216,19 @@
$run = $end - $start;
$discovery_time = substr($run, 0, 5);

if ($discovered_devices) {
if (is_numeric($doing)) { $doing = $device['hostname']; } // Single device ID convert to hostname for log
// Update Group/Alert tables
if (($discovered_devices && !isset($options['m'])) || isset($options['a']))
{
$silent = isset($options['q']);
// Not exist in CE
if (function_exists('update_group_tables')) { update_group_tables($silent); }
if (function_exists('update_alert_tables')) { update_alert_tables($silent); }
}

if ($discovered_devices)
{
// Single device ID convert to hostname for log
if (is_numeric($doing)) { $doing = $device['hostname']; }
}
elseif (!isset($options['q']) && !$options['u'])
{
Expand All @@ -221,9 +243,9 @@
foreach (dbFetchRows("SELECT * FROM `observium_processes` WHERE `process_start` < ?", array($config['time']['fourhour'])) as $process)
{
// We found processes in DB, check if it exist on system
print_debug_vars($processes);
print_debug_vars($process);
$pid_info = get_pid_info($process['process_pid']);
if (is_array($pid_info) && strpos($pid_info['COMMAND'], $process_name) !== FALSE)
if (is_array($pid_info) && strpos($pid_info['COMMAND'], $process['process_name']) !== FALSE)
{
// Process still running
} else {
Expand Down
Loading

0 comments on commit 509a6ad

Please sign in to comment.