mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Veeam SNMP traps fix and extend (#13549)
* Veeam fix and extend part 1 * Veeam SNMP traps * StyleCI * StyleCI * Fix typo * Lint * Fix tests * Fix tests :fingerscrossed: * Think i get it now * This is it? * gotta be it * Final * Again
This commit is contained in:
@@ -21,11 +21,9 @@ class VeeamBackupJobCompleted implements SnmptrapHandler
|
||||
{
|
||||
$name = $trap->getOidData('VEEAM-MIB::backupJobName');
|
||||
$comment = $trap->getOidData('VEEAM-MIB::backupJobComment');
|
||||
$result = $trap->getOidData('VEEAM-MIB::backupJobResult');
|
||||
$color = ['Success' => 1, 'Warning' => 4, 'Failed' => 5];
|
||||
|
||||
if ($trap->getOidData('VEEAM-MIB::backupJobResult') == 'Success') {
|
||||
Log::event('SNMP Trap: Backup Job success - ' . $name . ' ' . $comment, $device->device_id, 'backup', 1);
|
||||
} else {
|
||||
Log::event('SNMP Trap: Backup Job failed - ' . $name . ' ' . $comment, $device->device_id, 'backup', 5);
|
||||
}
|
||||
Log::event('SNMP Trap: Backup Job ' . $result . ' - ' . $name . ' - ' . $comment, $device->device_id, 'backup', $color[$result]);
|
||||
}
|
||||
}
|
||||
|
29
LibreNMS/Snmptrap/Handlers/VeeamCdpRpoReport.php
Normal file
29
LibreNMS/Snmptrap/Handlers/VeeamCdpRpoReport.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace LibreNMS\Snmptrap\Handlers;
|
||||
|
||||
use App\Models\Device;
|
||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||
use LibreNMS\Snmptrap\Trap;
|
||||
use Log;
|
||||
|
||||
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];
|
||||
|
||||
Log::event('SNMP Trap: CDP policy RPO status change' . $result . ' - ' . $policy_name . ' ' . $vm_name, $device->device_id, 'policy', $color[$result]);
|
||||
}
|
||||
}
|
32
LibreNMS/Snmptrap/Handlers/VeeamLinuxFLRCopyToFinished.php
Normal file
32
LibreNMS/Snmptrap/Handlers/VeeamLinuxFLRCopyToFinished.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace LibreNMS\Snmptrap\Handlers;
|
||||
|
||||
use App\Models\Device;
|
||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||
use LibreNMS\Snmptrap\Trap;
|
||||
use Log;
|
||||
|
||||
class VeeamLinuxFLRCopyToFinished 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)
|
||||
{
|
||||
$initiator_name = $trap->getOidData('VEEAM-MIB::initiatorName');
|
||||
$vm_name = $trap->getOidData('VEEAM-MIB::vmName');
|
||||
$target_host = $trap->getOidData('VEEAM-MIB::targetHost');
|
||||
$target_dir = $trap->getOidData('VEEAM-MIB::targetDir');
|
||||
$time = $trap->getOidData('VEEAM-MIB::transferTime');
|
||||
$result = $trap->getOidData('VEEAM-MIB::transferStatus');
|
||||
$color = ['Success' => 1, 'Warning' => 4, 'Failed' => 5];
|
||||
|
||||
Log::event('SNMP Trap: FLR job ' . $result . ' - ' . $vm_name . ' - ' . $initiator_name . ' ' . $target_host . ' ' . $target_dir . ' Time taken: ' . $time, $device->device_id, 'backup', $color[$result]);
|
||||
}
|
||||
}
|
29
LibreNMS/Snmptrap/Handlers/VeeamLinuxFLRCopyToStarted.php
Normal file
29
LibreNMS/Snmptrap/Handlers/VeeamLinuxFLRCopyToStarted.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace LibreNMS\Snmptrap\Handlers;
|
||||
|
||||
use App\Models\Device;
|
||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||
use LibreNMS\Snmptrap\Trap;
|
||||
use Log;
|
||||
|
||||
class VeeamLinuxFLRCopyToStarted 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)
|
||||
{
|
||||
$initiator_name = $trap->getOidData('VEEAM-MIB::initiatorName');
|
||||
$vm_name = $trap->getOidData('VEEAM-MIB::vmName');
|
||||
$target_host = $trap->getOidData('VEEAM-MIB::targetHost');
|
||||
$target_dir = $trap->getOidData('VEEAM-MIB::targetDir');
|
||||
|
||||
Log::event('SNMP Trap: FLR job started - ' . $vm_name . ' - ' . $initiator_name . ' ' . $target_dir . ' ' . $target_host, $device->device_id, 'backup', 2);
|
||||
}
|
||||
}
|
27
LibreNMS/Snmptrap/Handlers/VeeamLinuxFLRMountStarted.php
Normal file
27
LibreNMS/Snmptrap/Handlers/VeeamLinuxFLRMountStarted.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace LibreNMS\Snmptrap\Handlers;
|
||||
|
||||
use App\Models\Device;
|
||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||
use LibreNMS\Snmptrap\Trap;
|
||||
use Log;
|
||||
|
||||
class VeeamLinuxFLRMountStarted 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)
|
||||
{
|
||||
$initiator_name = $trap->getOidData('VEEAM-MIB::initiatorName');
|
||||
$vm_name = $trap->getOidData('VEEAM-MIB::vmName');
|
||||
|
||||
Log::event('SNMP Trap: FLR job started - ' . $vm_name . ' - ' . $initiator_name, $device->device_id, 'backup', 2);
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace LibreNMS\Snmptrap\Handlers;
|
||||
|
||||
use App\Models\Device;
|
||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||
use LibreNMS\Snmptrap\Trap;
|
||||
use Log;
|
||||
|
||||
class VeeamLinuxFLRToOriginalFinished 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)
|
||||
{
|
||||
$initiator_name = $trap->getOidData('VEEAM-MIB::initiatorName');
|
||||
$vm_name = $trap->getOidData('VEEAM-MIB::vmName');
|
||||
$time = $trap->getOidData('VEEAM-MIB::transferTime');
|
||||
$result = $trap->getOidData('VEEAM-MIB::transferStatus');
|
||||
$color = ['Success' => 1, 'Warning' => 4, 'Failed' => 5];
|
||||
|
||||
Log::event('SNMP Trap: FLR job ' . $result . ' - ' . $vm_name . ' - ' . $initiator_name . ' Time taken: ' . $time, $device->device_id, 'backup', $color[$result]);
|
||||
}
|
||||
}
|
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace LibreNMS\Snmptrap\Handlers;
|
||||
|
||||
use App\Models\Device;
|
||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||
use LibreNMS\Snmptrap\Trap;
|
||||
use Log;
|
||||
|
||||
class VeeamLinuxFLRToOriginalStarted 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)
|
||||
{
|
||||
$initiator_name = $trap->getOidData('VEEAM-MIB::initiatorName');
|
||||
$vm_name = $trap->getOidData('VEEAM-MIB::vmName');
|
||||
|
||||
Log::event('SNMP Trap: FLR job started - ' . $vm_name . ' - ' . $initiator_name, $device->device_id, 'backup', 2);
|
||||
}
|
||||
}
|
28
LibreNMS/Snmptrap/Handlers/VeeamSobrOffloadFinished.php
Normal file
28
LibreNMS/Snmptrap/Handlers/VeeamSobrOffloadFinished.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace LibreNMS\Snmptrap\Handlers;
|
||||
|
||||
use App\Models\Device;
|
||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||
use LibreNMS\Snmptrap\Trap;
|
||||
use Log;
|
||||
|
||||
class VeeamSobrOffloadFinished 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)
|
||||
{
|
||||
$name = $trap->getOidData('VEEAM-MIB::repositoryName');
|
||||
$result = $trap->getOidData('VEEAM-MIB::repositoryStatus');
|
||||
$color = ['Success' => 1, 'Warning' => 4, 'Failed' => 5];
|
||||
|
||||
Log::event('SNMP Trap: Scale-out offload job ' . $result . ' - ' . $name, $device->device_id, 'backup', $color[$result]);
|
||||
}
|
||||
}
|
30
LibreNMS/Snmptrap/Handlers/VeeamVmBackupCompleted.php
Normal file
30
LibreNMS/Snmptrap/Handlers/VeeamVmBackupCompleted.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace LibreNMS\Snmptrap\Handlers;
|
||||
|
||||
use App\Models\Device;
|
||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||
use LibreNMS\Snmptrap\Trap;
|
||||
use Log;
|
||||
|
||||
class VeeamVmBackupCompleted 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)
|
||||
{
|
||||
$job_name = $trap->getOidData('VEEAM-MIB::backupJobName');
|
||||
$vm_name = $trap->getOidData('VEEAM-MIB::vmName');
|
||||
$comment = $trap->getOidData('VEEAM-MIB::vmBackupComment');
|
||||
$result = $trap->getOidData('VEEAM-MIB::vmBackupResult');
|
||||
$color = ['Success' => 1, 'Warning' => 4, 'Failed' => 5];
|
||||
|
||||
Log::event('SNMP Trap: VM backup ' . $result . ' - ' . $vm_name . ' Job: ' . $job_name . ' - ' . $comment, $device->device_id, 'backup', $color[$result]);
|
||||
}
|
||||
}
|
@@ -1,31 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace LibreNMS\Snmptrap\Handlers;
|
||||
|
||||
use App\Models\Device;
|
||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||
use LibreNMS\Snmptrap\Trap;
|
||||
use Log;
|
||||
|
||||
class VeeamVmBackupJobCompleted 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)
|
||||
{
|
||||
$name = $trap->getOidData('VEEAM-MIB::backupJobName');
|
||||
$comment = $trap->getOidData('VEEAM-MIB::vmName');
|
||||
|
||||
if ($trap->getOidData('VEEAM-MIB::vmBackupResult') == 'Success') {
|
||||
Log::event('SNMP Trap: VM Backup success - ' . $name . ' ' . $comment, $device->device_id, 'backup', 1);
|
||||
} else {
|
||||
Log::event('SNMP Trap: VM Backup failed - ' . $name . ' ' . $comment, $device->device_id, 'backup', 5);
|
||||
}
|
||||
}
|
||||
}
|
29
LibreNMS/Snmptrap/Handlers/VeeamWebDownloadFinished.php
Normal file
29
LibreNMS/Snmptrap/Handlers/VeeamWebDownloadFinished.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace LibreNMS\Snmptrap\Handlers;
|
||||
|
||||
use App\Models\Device;
|
||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||
use LibreNMS\Snmptrap\Trap;
|
||||
use Log;
|
||||
|
||||
class VeeamWebDownloadFinished 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)
|
||||
{
|
||||
$initiator_name = $trap->getOidData('VEEAM-MIB::initiatorName');
|
||||
$vm_name = $trap->getOidData('VEEAM-MIB::vmName');
|
||||
$result = $trap->getOidData('VEEAM-MIB::transferStatus');
|
||||
$color = ['Success' => 1, 'Warning' => 4, 'Failed' => 5];
|
||||
|
||||
Log::event('SNMP Trap: 1 click FLR job ' . $result . ' - ' . $vm_name . ' - ' . $initiator_name, $device->device_id, 'backup', $color[$result]);
|
||||
}
|
||||
}
|
27
LibreNMS/Snmptrap/Handlers/VeeamWebDownloadStart.php
Normal file
27
LibreNMS/Snmptrap/Handlers/VeeamWebDownloadStart.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace LibreNMS\Snmptrap\Handlers;
|
||||
|
||||
use App\Models\Device;
|
||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||
use LibreNMS\Snmptrap\Trap;
|
||||
use Log;
|
||||
|
||||
class VeeamWebDownloadStart 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)
|
||||
{
|
||||
$initiator_name = $trap->getOidData('VEEAM-MIB::initiatorName');
|
||||
$vm_name = $trap->getOidData('VEEAM-MIB::vmName');
|
||||
|
||||
Log::event('SNMP Trap: 1 click FLR job started - ' . $vm_name . ' - ' . $initiator_name, $device->device_id, 'backup', 2);
|
||||
}
|
||||
}
|
30
LibreNMS/Snmptrap/Handlers/VeeamWinFLRCopyToFinished.php
Normal file
30
LibreNMS/Snmptrap/Handlers/VeeamWinFLRCopyToFinished.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace LibreNMS\Snmptrap\Handlers;
|
||||
|
||||
use App\Models\Device;
|
||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||
use LibreNMS\Snmptrap\Trap;
|
||||
use Log;
|
||||
|
||||
class VeeamWinFLRCopyToFinished 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)
|
||||
{
|
||||
$initiator_name = $trap->getOidData('VEEAM-MIB::initiatorName');
|
||||
$vm_name = $trap->getOidData('VEEAM-MIB::vmName');
|
||||
$target_dir = $trap->getOidData('VEEAM-MIB::targetDir');
|
||||
$result = $trap->getOidData('VEEAM-MIB::transferStatus');
|
||||
$color = ['Success' => 1, 'Warning' => 4, 'Failed' => 5];
|
||||
|
||||
Log::event('SNMP Trap: FLR job ' . $result . ' - ' . $vm_name . ' - ' . $initiator_name . ' ' . $target_dir, $device->device_id, 'backup', $color[$result]);
|
||||
}
|
||||
}
|
28
LibreNMS/Snmptrap/Handlers/VeeamWinFLRCopyToStarted.php
Normal file
28
LibreNMS/Snmptrap/Handlers/VeeamWinFLRCopyToStarted.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace LibreNMS\Snmptrap\Handlers;
|
||||
|
||||
use App\Models\Device;
|
||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||
use LibreNMS\Snmptrap\Trap;
|
||||
use Log;
|
||||
|
||||
class VeeamWinFLRCopyToStarted 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)
|
||||
{
|
||||
$initiator_name = $trap->getOidData('VEEAM-MIB::initiatorName');
|
||||
$vm_name = $trap->getOidData('VEEAM-MIB::vmName');
|
||||
$target_dir = $trap->getOidData('VEEAM-MIB::targetDir');
|
||||
|
||||
Log::event('SNMP Trap: FLR job started - ' . $vm_name . ' - ' . $initiator_name . ' - ' . $target_dir, $device->device_id, 'backup', 2);
|
||||
}
|
||||
}
|
27
LibreNMS/Snmptrap/Handlers/VeeamWinFLRMountStarted.php
Normal file
27
LibreNMS/Snmptrap/Handlers/VeeamWinFLRMountStarted.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace LibreNMS\Snmptrap\Handlers;
|
||||
|
||||
use App\Models\Device;
|
||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||
use LibreNMS\Snmptrap\Trap;
|
||||
use Log;
|
||||
|
||||
class VeeamWinFLRMountStarted 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)
|
||||
{
|
||||
$initiator_name = $trap->getOidData('VEEAM-MIB::initiatorName');
|
||||
$vm_name = $trap->getOidData('VEEAM-MIB::vmName');
|
||||
|
||||
Log::event('SNMP Trap: FLR job started - ' . $vm_name . ' - ' . $initiator_name, $device->device_id, 'backup', 2);
|
||||
}
|
||||
}
|
29
LibreNMS/Snmptrap/Handlers/VeeamWinFLRToOriginalFinished.php
Normal file
29
LibreNMS/Snmptrap/Handlers/VeeamWinFLRToOriginalFinished.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace LibreNMS\Snmptrap\Handlers;
|
||||
|
||||
use App\Models\Device;
|
||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||
use LibreNMS\Snmptrap\Trap;
|
||||
use Log;
|
||||
|
||||
class VeeamWinFLRToOriginalFinished 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)
|
||||
{
|
||||
$initiator_name = $trap->getOidData('VEEAM-MIB::initiatorName');
|
||||
$vm_name = $trap->getOidData('VEEAM-MIB::vmName');
|
||||
$result = $trap->getOidData('VEEAM-MIB::transferStatus');
|
||||
$color = ['Success' => 1, 'Warning' => 4, 'Failed' => 5];
|
||||
|
||||
Log::event('SNMP Trap: FLR job started - ' . $vm_name . ' - ' . $initiator_name, $device->device_id, 'backup', $color[$result]);
|
||||
}
|
||||
}
|
27
LibreNMS/Snmptrap/Handlers/VeeamWinFLRToOriginalStarted.php
Normal file
27
LibreNMS/Snmptrap/Handlers/VeeamWinFLRToOriginalStarted.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace LibreNMS\Snmptrap\Handlers;
|
||||
|
||||
use App\Models\Device;
|
||||
use LibreNMS\Interfaces\SnmptrapHandler;
|
||||
use LibreNMS\Snmptrap\Trap;
|
||||
use Log;
|
||||
|
||||
class VeeamWinFLRToOriginalStarted 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)
|
||||
{
|
||||
$initiator_name = $trap->getOidData('VEEAM-MIB::initiatorName');
|
||||
$vm_name = $trap->getOidData('VEEAM-MIB::vmName');
|
||||
|
||||
Log::event('SNMP Trap: FLR job started - ' . $vm_name . ' - ' . $initiator_name, $device->device_id, 'backup', 2);
|
||||
}
|
||||
}
|
@@ -116,7 +116,21 @@ return [
|
||||
'OSPF-TRAP-MIB::ospfNbrStateChange' => \LibreNMS\Snmptrap\Handlers\OspfNbrStateChange::class,
|
||||
'UPS-MIB::upsTraps.0.1' => \LibreNMS\Snmptrap\Handlers\UpsTrapsOnBattery::class,
|
||||
'VEEAM-MIB::onBackupJobCompleted' => \LibreNMS\Snmptrap\Handlers\VeeamBackupJobCompleted::class,
|
||||
'VEEAM-MIB::onVmBackupJobCompleted' => \LibreNMS\Snmptrap\Handlers\VeeamVmBackupJobCompleted::class,
|
||||
'VEEAM-MIB::onVmBackupCompleted' => \LibreNMS\Snmptrap\Handlers\VeeamVmBackupCompleted::class,
|
||||
'VEEAM-MIB::onLinuxFLRMountStarted' => \LibreNMS\Snmptrap\Handlers\VeeamLinuxFLRMountStarted::class,
|
||||
'VEEAM-MIB::onLinuxFLRCopyToStarted' => \LibreNMS\Snmptrap\Handlers\VeeamLinuxFLRCopyToStarted::class,
|
||||
'VEEAM-MIB::onLinuxFLRToOriginalStarted' => \LibreNMS\Snmptrap\Handlers\VeeamLinuxFLRToOriginalStarted::class,
|
||||
'VEEAM-MIB::onLinuxFLRCopyToFinished' => \LibreNMS\Snmptrap\Handlers\VeeamLinuxFLRCopyToFinished::class,
|
||||
'VEEAM-MIB::onLinuxFLRToOriginalFinished' => \LibreNMS\Snmptrap\Handlers\VeeamLinuxFLRToOriginalFinished::class,
|
||||
'VEEAM-MIB::onWinFLRMountStarted' => \LibreNMS\Snmptrap\Handlers\VeeamWinFLRMountStarted::class,
|
||||
'VEEAM-MIB::onWinFLRToOriginalStarted' => \LibreNMS\Snmptrap\Handlers\VeeamWinFLRToOriginalStarted::class,
|
||||
'VEEAM-MIB::onWinFLRCopyToStarted' => \LibreNMS\Snmptrap\Handlers\VeeamWinFLRCopyToStarted::class,
|
||||
'VEEAM-MIB::onWinFLRToOriginalFinished' => \LibreNMS\Snmptrap\Handlers\VeeamWinFLRToOriginalFinished::class,
|
||||
'VEEAM-MIB::onWinFLRCopyToFinished' => \LibreNMS\Snmptrap\Handlers\VeeamWinFLRCopyToFinished::class,
|
||||
'VEEAM-MIB::onWebDownloadStart' => \LibreNMS\Snmptrap\Handlers\VeeamWebDownloadStart::class,
|
||||
'VEEAM-MIB::onWebDownloadFinished' => \LibreNMS\Snmptrap\Handlers\VeeamWebDownloadFinished::class,
|
||||
'VEEAM-MIB::onSobrOffloadFinished' => \LibreNMS\Snmptrap\Handlers\VeeamSobrOffloadFinished::class,
|
||||
'VEEAM-MIB::onCdpRpoReport' => \LibreNMS\Snmptrap\Handlers\VeeamCdpRpoReport::class,
|
||||
'HP-ICF-FAULT-FINDER-MIB::hpicfFaultFinderTrap' => \LibreNMS\Snmptrap\Handlers\HpFault::class,
|
||||
'UPS-MIB::upsTrapOnBattery' => \LibreNMS\Snmptrap\Handlers\UpsTrapOnBattery::class,
|
||||
],
|
||||
|
@@ -9,7 +9,7 @@ use Log;
|
||||
|
||||
class VeeamTrapTest extends SnmpTrapTestCase
|
||||
{
|
||||
public function testVeeamOnBackupCompleted(): void
|
||||
public function testVeeamBackupJobCompleted(): void
|
||||
{
|
||||
$device = Device::factory()->create();
|
||||
|
||||
@@ -20,18 +20,18 @@ SNMPv2-MIB::snmpTrapOID.0 VEEAM-MIB::onBackupJobCompleted
|
||||
VEEAM-MIB::backupJobId 7a1b3549-c4c7-4629-84d6-74e24fee8011
|
||||
VEEAM-MIB::backupJobName SureBackup Job 1
|
||||
VEEAM-MIB::sourceHostName hostname
|
||||
VEEAM-MIB::vmBackupComment
|
||||
VEEAM-MIB::backupJobComment comment
|
||||
VEEAM-MIB::backupJobResult Success";
|
||||
|
||||
$trap = new Trap($trapText);
|
||||
|
||||
$message = 'SNMP Trap: Backup Job success - SureBackup Job 1 ';
|
||||
$message = 'SNMP Trap: Backup Job Success - SureBackup Job 1 - comment';
|
||||
Log::shouldReceive('event')->once()->with($message, $device->device_id, 'backup', 1);
|
||||
|
||||
$this->assertTrue(Dispatcher::handle($trap), 'Could not handle VEEAM-MIB::traps');
|
||||
}
|
||||
|
||||
public function testVeeamOnBackupCompletedFails(): void
|
||||
public function testVeeamBackupJobCompletedWarning(): void
|
||||
{
|
||||
$device = Device::factory()->create();
|
||||
|
||||
@@ -42,36 +42,102 @@ SNMPv2-MIB::snmpTrapOID.0 VEEAM-MIB::onBackupJobCompleted
|
||||
VEEAM-MIB::backupJobId 7a1b3549-c4c7-4629-84d6-74e24fee8011
|
||||
VEEAM-MIB::backupJobName SureBackup Job 1
|
||||
VEEAM-MIB::sourceHostName hostname
|
||||
VEEAM-MIB::vmBackupComment
|
||||
VEEAM-MIB::vmBackupResult Failed";
|
||||
VEEAM-MIB::backupJobComment comment
|
||||
VEEAM-MIB::backupJobResult Warning";
|
||||
|
||||
$trap = new Trap($trapText);
|
||||
|
||||
$message = 'SNMP Trap: Backup Job failed - SureBackup Job 1 ';
|
||||
$message = 'SNMP Trap: Backup Job Warning - SureBackup Job 1 - comment';
|
||||
Log::shouldReceive('event')->once()->with($message, $device->device_id, 'backup', 4);
|
||||
|
||||
$this->assertTrue(Dispatcher::handle($trap), 'Could not handle VEEAM-MIB::traps');
|
||||
}
|
||||
|
||||
public function testVeeamBackupJobCompletedFailed(): void
|
||||
{
|
||||
$device = Device::factory()->create();
|
||||
|
||||
$trapText = "$device->hostname
|
||||
UDP: [$device->ip]:46024->[1.1.1.1]:162
|
||||
DISMAN-EVENT-MIB::sysUpTimeInstance 4:13:08:37.60
|
||||
SNMPv2-MIB::snmpTrapOID.0 VEEAM-MIB::onBackupJobCompleted
|
||||
VEEAM-MIB::backupJobId 7a1b3549-c4c7-4629-84d6-74e24fee8011
|
||||
VEEAM-MIB::backupJobName SureBackup Job 1
|
||||
VEEAM-MIB::sourceHostName hostname
|
||||
VEEAM-MIB::backupJobComment comment
|
||||
VEEAM-MIB::backupJobResult Failed";
|
||||
|
||||
$trap = new Trap($trapText);
|
||||
|
||||
$message = 'SNMP Trap: Backup Job Failed - SureBackup Job 1 - comment';
|
||||
Log::shouldReceive('event')->once()->with($message, $device->device_id, 'backup', 5);
|
||||
|
||||
$this->assertTrue(Dispatcher::handle($trap), 'Could not handle VEEAM-MIB::traps');
|
||||
}
|
||||
|
||||
public function testVeeamOnVmBackupCompleted(): void
|
||||
public function testVeeamVmBackupCompleted(): void
|
||||
{
|
||||
$device = Device::factory()->create();
|
||||
|
||||
$trapText = "$device->hostname
|
||||
UDP: [$device->ip]:46024->[1.1.1.1]:162
|
||||
DISMAN-EVENT-MIB::sysUpTimeInstance 4:13:08:37.60
|
||||
SNMPv2-MIB::snmpTrapOID.0 VEEAM-MIB::onVmBackupJobCompleted
|
||||
SNMPv2-MIB::snmpTrapOID.0 VEEAM-MIB::onVmBackupCompleted
|
||||
VEEAM-MIB::backupJobName Linux taeglich low
|
||||
VEEAM-MIB::vmName vmname1
|
||||
VEEAM-MIB::sourceHostName hostname
|
||||
VEEAM-MIB::vmBackupComment
|
||||
VEEAM-MIB::vmBackupComment comment
|
||||
VEEAM-MIB::vmBackupResult Success";
|
||||
|
||||
$trap = new Trap($trapText);
|
||||
|
||||
$message = 'SNMP Trap: VM Backup success - Linux taeglich low vmname1';
|
||||
$message = 'SNMP Trap: VM backup Success - vmname1 Job: Linux taeglich low - comment';
|
||||
Log::shouldReceive('event')->once()->with($message, $device->device_id, 'backup', 1);
|
||||
|
||||
$this->assertTrue(Dispatcher::handle($trap), 'Could not handle VEEAM-MIB::traps');
|
||||
}
|
||||
|
||||
public function testVeeamVmBackupCompletedWarning(): void
|
||||
{
|
||||
$device = Device::factory()->create();
|
||||
|
||||
$trapText = "$device->hostname
|
||||
UDP: [$device->ip]:46024->[1.1.1.1]:162
|
||||
DISMAN-EVENT-MIB::sysUpTimeInstance 4:13:08:37.60
|
||||
SNMPv2-MIB::snmpTrapOID.0 VEEAM-MIB::onVmBackupCompleted
|
||||
VEEAM-MIB::backupJobName Linux taeglich low
|
||||
VEEAM-MIB::vmName vmname1
|
||||
VEEAM-MIB::sourceHostName hostname
|
||||
VEEAM-MIB::vmBackupComment comment
|
||||
VEEAM-MIB::vmBackupResult Warning";
|
||||
|
||||
$trap = new Trap($trapText);
|
||||
|
||||
$message = 'SNMP Trap: VM backup Warning - vmname1 Job: Linux taeglich low - comment';
|
||||
Log::shouldReceive('event')->once()->with($message, $device->device_id, 'backup', 4);
|
||||
|
||||
$this->assertTrue(Dispatcher::handle($trap), 'Could not handle VEEAM-MIB::traps');
|
||||
}
|
||||
|
||||
public function testVeeamVmBackupCompletedFailed(): void
|
||||
{
|
||||
$device = Device::factory()->create();
|
||||
|
||||
$trapText = "$device->hostname
|
||||
UDP: [$device->ip]:46024->[1.1.1.1]:162
|
||||
DISMAN-EVENT-MIB::sysUpTimeInstance 4:13:08:37.60
|
||||
SNMPv2-MIB::snmpTrapOID.0 VEEAM-MIB::onVmBackupCompleted
|
||||
VEEAM-MIB::backupJobName Linux taeglich low
|
||||
VEEAM-MIB::vmName vmname1
|
||||
VEEAM-MIB::sourceHostName hostname
|
||||
VEEAM-MIB::vmBackupComment comment
|
||||
VEEAM-MIB::vmBackupResult Failed";
|
||||
|
||||
$trap = new Trap($trapText);
|
||||
|
||||
$message = 'SNMP Trap: VM backup Failed - vmname1 Job: Linux taeglich low - comment';
|
||||
Log::shouldReceive('event')->once()->with($message, $device->device_id, 'backup', 5);
|
||||
|
||||
$this->assertTrue(Dispatcher::handle($trap), 'Could not handle VEEAM-MIB::traps');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user