mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
* Initial push * power trap tests * vmware heartbeat trap tests * heartbeat trap test * created utilclass for common functions * Changed util class name to better reflect its use * make vm power state changes to db * Traps will modify DB * Removed unecesarry relationship * Added vminfo modelfactory, tests, and fixed format * Added suspended state to ui
70 lines
1.9 KiB
PHP
70 lines
1.9 KiB
PHP
<?php
|
|
/**
|
|
* VmwTrapUtil.php
|
|
*
|
|
* -Description-
|
|
*
|
|
* Common utility class for handling VmWare ESXi traps.
|
|
*
|
|
* Assuming VMWare Tools is installed the VMHost will receive a periodic
|
|
* heartbeat from a VMGuest. This trap is sent once a heartbeat is
|
|
* received after not receiving heartbeats for a configured period
|
|
* of time.
|
|
*
|
|
* 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
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
* @package LibreNMS
|
|
* @link http://librenms.org
|
|
* @copyright 2019 KanREN, Inc.
|
|
* @author Heath Barnhart <hbarnhart@kanren.net>
|
|
*/
|
|
|
|
namespace LibreNMS\Snmptrap\Handlers;
|
|
|
|
class VmwTrapUtil
|
|
{
|
|
/**
|
|
* Get the VMGuest hostname
|
|
*
|
|
* @param Trap $trap
|
|
* @return string
|
|
*/
|
|
public static function getGuestName($trap)
|
|
{
|
|
return $trap->getOidData($trap->findOid('VMWARE-VMINFO-MIB::vmwVmDisplayName'));
|
|
}
|
|
|
|
/**
|
|
* Get the VMGuest ID number
|
|
*
|
|
* @param Trap $trap
|
|
* @return string
|
|
*/
|
|
public static function getGuestId($trap)
|
|
{
|
|
return $trap->getOidData($trap->findOid('VMWARE-VMINFO-MIB::vmwVmID'));
|
|
}
|
|
|
|
/**
|
|
* Get the VMGuest configuration path
|
|
*
|
|
* @param Trap $trap
|
|
* @return string
|
|
*/
|
|
public static function getGuestConfigPath($trap)
|
|
{
|
|
return $trap->getOidData($trap->findOid('VMWARE-VMINFO-MIB::vmwVmConfigFilePath'));
|
|
}
|
|
}
|