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,35 +5,42 @@
*
* This file is part of Observium.
*
* @package observium
* @subpackage snmptraps
* @copyright (C) 2006-2013 Adam Armstrong, (C) 2013-2021 Observium Limited
* @package observium
* @subpackage snmptraps
* @copyright (C) Adam Armstrong
*
*/
chdir(dirname($argv[0]));
$options = getopt("d");
if (isset($options['d'])) { array_shift($argv); } // for compatibility
if (isset($options['d'])) {
array_shift($argv);
} // for compatibility
include("includes/sql-config.inc.php");
include("includes/observium.inc.php");
$entry = explode(",", $argv[1]);
logfile('SNMPTRAP: '.$argv[1]);
logfile('SNMPTRAP: ' . $argv[1]);
#print_vars($entry);
$device = @dbFetchRow("SELECT * FROM devices WHERE `hostname` = ?", array($entry['0']));
$device = @dbFetchRow("SELECT * FROM devices WHERE `hostname` = ?", [$entry['0']]);
if (!$device['device_id'])
{
$device = @dbFetchRow("SELECT * FROM ipv4_addresses AS A, ports AS I WHERE A.ipv4_address = ? AND I.port_id = A.port_id", array($entry['0']));
if (!$device['device_id']) {
$device = @dbFetchRow("SELECT * FROM ipv4_addresses AS A, ports AS I WHERE A.ipv4_address = ? AND I.port_id = A.port_id", [$entry['0']]);
}
if (!$device['device_id']) { exit; }
if (!$device['device_id']) {
exit;
}
$file = $config['install_dir'] . "/includes/snmptrap/".$entry['1'].".inc.php";
if (is_file($file)) { include("$file"); } else { echo("unknown trap ($file)"); }
$file = $config['install_dir'] . "/includes/snmptrap/" . $entry['1'] . ".inc.php";
if (is_file($file)) {
include("$file");
} else {
echo("unknown trap ($file)");
}
// EOF