2010-09-03 18:26:59 +00:00
|
|
|
#!/usr/bin/env php
|
2010-02-17 11:02:18 +00:00
|
|
|
<?php
|
|
|
|
|
2012-05-09 10:01:42 +00:00
|
|
|
/**
|
2013-10-28 01:46:59 -07:00
|
|
|
* LibreNMS
|
2012-05-09 10:01:42 +00:00
|
|
|
*
|
2013-10-28 01:46:59 -07:00
|
|
|
* This file is part of LibreNMS
|
2012-05-09 10:01:42 +00:00
|
|
|
*
|
2013-10-28 01:46:59 -07:00
|
|
|
* @package librenms
|
|
|
|
* @subpackage cli
|
|
|
|
* @author LibreNMS Group <librenms-project@google.groups.com>
|
|
|
|
* @copyright (C) 2006 - 2012 Adam Armstrong (as Observium)
|
|
|
|
* @copyright (C) 2013 LibreNMS Group
|
2012-05-09 10:01:42 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
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);
|
2010-02-17 11:02:18 +00:00
|
|
|
|
2011-03-16 22:04:29 +00:00
|
|
|
include("includes/defaults.inc.php");
|
|
|
|
include("config.php");
|
2012-05-09 10:01:42 +00:00
|
|
|
include("includes/definitions.inc.php");
|
2011-03-16 22:04:29 +00:00
|
|
|
include("includes/functions.php");
|
2010-02-17 11:02:18 +00:00
|
|
|
|
2011-03-16 22:04:29 +00:00
|
|
|
$entry = explode(",", $argv[1]);
|
2010-02-17 11:02:18 +00:00
|
|
|
|
2011-11-14 18:28:00 +00:00
|
|
|
logfile($argv[1]);
|
|
|
|
|
|
|
|
#print_r($entry);
|
2010-02-17 11:02:18 +00:00
|
|
|
|
2011-05-13 12:39:56 +00:00
|
|
|
$device = @dbFetchRow("SELECT * FROM devices WHERE `hostname` = ?", array($entry['0']));
|
2010-02-17 11:02:18 +00:00
|
|
|
|
2011-03-16 22:04:29 +00:00
|
|
|
if (!$device['device_id'])
|
|
|
|
{
|
2012-05-16 13:25:50 +00:00
|
|
|
$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
|
|
|
}
|
2010-02-17 11:02:18 +00:00
|
|
|
|
2011-03-16 22:04:29 +00:00
|
|
|
if (!$device['device_id']) { exit; } else { }
|
2010-02-17 11:02:18 +00:00
|
|
|
|
2011-03-16 22:04:29 +00:00
|
|
|
$file = $config['install_dir'] . "/includes/snmptrap/".$entry['1'].".inc.php";
|
2011-11-14 18:28:00 +00:00
|
|
|
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
|
|
|
?>
|