mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* Improve trap testing Add helper log() to Trap Avoid saving to the database at all * style * Move all traps to $trap->log() * Update tests * Lint and style fixes * Use correct partial mock call * more style * Add docs * debug in ci * use the correct log function.................... * all, I guess * not the first?? * 3rd? * use event_id to order
29 lines
837 B
PHP
29 lines
837 B
PHP
<?php
|
|
|
|
namespace LibreNMS\Snmptrap\Handlers;
|
|
|
|
use App\Models\Device;
|
|
use LibreNMS\Interfaces\SnmptrapHandler;
|
|
use LibreNMS\Snmptrap\Trap;
|
|
|
|
class VeeamCdpRpoReport 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)
|
|
{
|
|
$policy_name = $trap->getOidData('VEEAM-MIB::cdpPolicyName');
|
|
$vm_name = $trap->getOidData('VEEAM-MIB::vmName');
|
|
$result = $trap->getOidData('VEEAM-MIB::cdpRpoStatus');
|
|
$color = ['Success' => 1, 'Warning' => 4, 'Failed' => 5];
|
|
|
|
$trap->log('SNMP Trap: CDP policy RPO status change' . $result . ' - ' . $policy_name . ' ' . $vm_name, $color[$result], 'policy');
|
|
}
|
|
}
|