Files
librenms-librenms/snmptrap.php
T

45 lines
1.0 KiB
PHP
Raw Normal View History

2010-09-03 18:26:59 +00:00
#!/usr/bin/env php
<?php
/**
* Observium
*
* This file is part of Observium.
*
* @package observium
* @subpackage snmptraps
* @author Adam Armstrong <[email protected]>
* @copyright (C) 2006 - 2012 Adam Armstrong
*
*/
2011-03-16 22:04:29 +00:00
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
ini_set('log_errors', 1);
ini_set('error_reporting', E_ALL);
2011-03-16 22:04:29 +00:00
include("includes/defaults.inc.php");
include("config.php");
include("includes/definitions.inc.php");
2011-03-16 22:04:29 +00:00
include("includes/functions.php");
2011-03-16 22:04:29 +00:00
$entry = explode(",", $argv[1]);
logfile($argv[1]);
#print_r($entry);
2011-05-13 12:39:56 +00:00
$device = @dbFetchRow("SELECT * FROM devices WHERE `hostname` = ?", array($entry['0']));
2011-03-16 22:04:29 +00:00
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']));
2011-03-16 22:04:29 +00:00
}
2011-03-16 22:04:29 +00:00
if (!$device['device_id']) { exit; } else { }
2011-03-16 22:04:29 +00:00
$file = $config['install_dir'] . "/includes/snmptrap/".$entry['1'].".inc.php";
if (is_file($file)) { include("$file"); } else { echo("unknown trap ($file)"); }
2011-03-16 22:04:29 +00:00
2011-05-13 12:39:56 +00:00
?>