forked from librenms/librenms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Veeam SNMP traps fix and extend (librenms#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
- Loading branch information
Showing
19 changed files
with
524 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 changes: 32 additions & 0 deletions
32
LibreNMS/Snmptrap/Handlers/VeeamLinuxFLRCopyToFinished.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
LibreNMS/Snmptrap/Handlers/VeeamLinuxFLRToOriginalFinished.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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]); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
LibreNMS/Snmptrap/Handlers/VeeamLinuxFLRToOriginalStarted.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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]); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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]); | ||
} | ||
} |
Oops, something went wrong.