. * * Juniper configuration change trap. Includes interface used to affect * the change, the user, and the system time when the change was made. * If a commit confirmed is rolled back the source is "other" and the * user is "root". * * @package LibreNMS * @link http://librenms.org * @copyright 2018 KanREN, Inc. * @author Heath Barnhart */ namespace LibreNMS\Snmptrap\Handlers; use App\Models\Device; use LibreNMS\Interfaces\SnmptrapHandler; use LibreNMS\Snmptrap\Trap; use Log; class JnxCmCfgChange implements SnmptrapHandler { /** * Handle snmptrap. * Data is pre-parsed and delivered as a Trap. * * @param Device $device * @param Trap $trap * @return void */ public function handle(Device $device, Trap $trap) { $source = $trap->getOidData($trap->findOid('JUNIPER-CFGMGMT-MIB::jnxCmCfgChgEventSource')); $user = $trap->getOidData($trap->findOid('JUNIPER-CFGMGMT-MIB::jnxCmCfgChgEventUser')); $changeTime = $trap->getOidData($trap->findOid('JUNIPER-CFGMGMT-MIB::jnxCmCfgChgEventDate')); if ($source=='other' && $user=='root') { Log::event("Config rolled back at $changeTime", $device->device_id, 'trap', 2); } else { Log::event("Config modified by $user from $source at $changeTime", $device->device_id, 'trap', 2); } } }