Files

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

71 lines
2.7 KiB
PHP
Raw Permalink Normal View History

2020-01-17 11:16:14 -06:00
<?php
/**
* VmwHBTest.php
* -Description-
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
2021-02-09 00:29:04 +01:00
* along with this program. If not, see <https://www.gnu.org/licenses/>.
2020-01-17 11:16:14 -06:00
*
*
* Tests vmwVmHBLost and vmwVmHBDetected traps from VMWare ESXi hosts.
*
2021-02-09 00:29:04 +01:00
* @link https://www.librenms.org
2021-09-10 20:09:53 +02:00
*
2020-01-17 11:16:14 -06:00
* @copyright 2019 KanREN, Inc
* @author Heath Barnhart <hbarnhart@kanren.net>
*/
2020-04-03 17:13:18 -05:00
namespace LibreNMS\Tests\Feature\SnmpTraps;
2020-01-17 11:16:14 -06:00
use App\Models\Device;
2023-08-05 12:12:36 -05:00
use LibreNMS\Enum\Severity;
2020-01-17 11:16:14 -06:00
class VmwHBTest extends SnmpTrapTestCase
{
2022-11-05 14:43:54 -05:00
public function testVmwVmHBLostTrap(): void
2020-01-17 11:16:14 -06:00
{
2022-11-05 14:43:54 -05:00
$guest = Device::factory()->make(); /** @var Device $guest */
$this->assertTrapLogsMessage("{{ hostname }}
UDP: [{{ ip }}]:28386->[10.10.10.100]:162
2020-01-17 11:16:14 -06:00
DISMAN-EVENT-MIB::sysUpTimeInstance 5:18:30:26.00
SNMPv2-MIB::snmpTrapOID.0 VMWARE-VMINFO-MIB::vmwVmHBLost
VMWARE-VMINFO-MIB::vmwVmID.0 28 VMWARE-VMINFO-MIB::vmwVmConfigFilePath.0 /vmfs/volumes/50101bda-eaf6ac7e-7e44-d4ae5267fb9f/$guest->hostname/$guest->hostname.vmx
VMWARE-VMINFO-MIB::vmwVmDisplayName.28 $guest->hostname
SNMP-COMMUNITY-MIB::snmpTrapAddress.0 $guest->ip
SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 \"public\"
2022-11-05 14:43:54 -05:00
SNMPv2-MIB::snmpTrapEnterprise.0 VMWARE-PRODUCTS-MIB::vmwESX",
"Heartbeat from guest $guest->hostname lost",
'Could not handle VmwVmHBLostTrap',
2023-08-05 12:12:36 -05:00
[Severity::Warning],
2022-11-05 14:43:54 -05:00
);
2020-01-17 11:16:14 -06:00
}
2022-11-05 14:43:54 -05:00
public function testVmwVmHBDetectedTrap(): void
2020-01-17 11:16:14 -06:00
{
2022-11-05 14:43:54 -05:00
$guest = Device::factory()->make(); /** @var Device $guest */
$this->assertTrapLogsMessage("{{ hostname }}
UDP: [{{ ip }}]:28386->[10.10.10.100]:162
2020-01-17 11:16:14 -06:00
DISMAN-EVENT-MIB::sysUpTimeInstance 5:18:30:26.00
SNMPv2-MIB::snmpTrapOID.0 VMWARE-VMINFO-MIB::vmwVmHBDetected
VMWARE-VMINFO-MIB::vmwVmID.0 28 VMWARE-VMINFO-MIB::vmwVmConfigFilePath.0 /vmfs/volumes/50101bda-eaf6ac7e-7e44-d4ae5267fb9f/$guest->hostname/$guest->hostname.vmx
VMWARE-VMINFO-MIB::vmwVmDisplayName.28 $guest->hostname
SNMP-COMMUNITY-MIB::snmpTrapAddress.0 $guest->ip
SNMP-COMMUNITY-MIB::snmpTrapCommunity.0 \"public\"
2022-11-05 14:43:54 -05:00
SNMPv2-MIB::snmpTrapEnterprise.0 VMWARE-PRODUCTS-MIB::vmwESX",
"Heartbeat from guest $guest->hostname detected",
'Could not handle VmwVmHBDetectedTrap',
2023-08-05 12:12:36 -05:00
[Severity::Ok],
2022-11-05 14:43:54 -05:00
);
2020-01-17 11:16:14 -06:00
}
}