Files
librenms-librenms/snmptrap.php
TheGreatDoc 9940c884f5 Fixed snmptraps. (#8898)
* Fixed snmptraps.

* Fixed space

* Added bgp down/up and authentication failure

* Fixed typo

* Fixed some typos, arrays, astext and format_hostname

* Updated documentation

* Moved code to a function

* Some refactor

* Minor fixes

* Minor fixes 2

* More minor fixes

* Changes requested by Tony

* Minor fixes

* Moved include to snmptrap.php

* Refactor traps to use object oriented code.

Should trigger events too/instead, but we'll leave that.
Testing todo

* Add tests and fix things so they actually work
Not checking events yet.

* Fixed typo and severity level

* Update composer deps, I think the lock file wasn't right.
add json and mbstring extension deps while I'm at it.

* Fix several issues with phpunit fixtures
2018-08-11 16:37:44 -05:00

29 lines
602 B
PHP
Executable File

#!/usr/bin/env php
<?php
/**
* LibreNMS
*
* This file is part of LibreNMS.
*
* @package LibreNMS
* @subpackage snmptraps
* @copyright (C) 2006 - 2012 Adam Armstrong
* @copyright (C) 2018 LibreNMS
* Adapted from old snmptrap.php handler
*/
$init_modules = ['laravel', 'alerts-cli']; // so I don't have to rebase yet
require __DIR__ . '/includes/init.php';
$options = getopt('d::');
if (set_debug(isset($options['d']))) {
echo "DEBUG!\n";
}
$text = stream_get_contents(STDIN);
$trap = new \LibreNMS\Snmptrap\Trap($text);
$trap->handle(); // create handle and send it this trap