Hyper-V Windows

This document describes the functionality of HyperV.exe for Windows in PandoraFMS.

Introduction

The Hyper-V plugin for Pandora FMS discovers the Hyper-V host and its virtual machines, collecting status and performance metrics (CPU, memory, network, and storage) to create the corresponding monitoring modules. It can run in local mode on the Hyper-V server itself, generating a JSON with the definition of agents and modules for later use.

Compatibility matrix

Systems where it has been tested
Windows Server 2022 (Hyper-V) running the plugin in local mode.
Systems where it works
Local mode: Windows Server with Hyper-V (and PowerShell) where the .exe / script is executed.

Prerequisites

The plugin is a binary that contains the dependencies packaged, so no installation of any kind of dependency is required for its use.

Configure WinRM
Enable-PSRemoting -Force -SkipNetworkProfileCheck
winrm quickconfig -force
winrm set winrm/config/service/auth '@{Basic="true"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
winrm set winrm/config/service '@{MaxTimeoutms="600000"}'

Allow HTTP 401
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f

Allow WinRM Firewall
New-NetFirewallRule -DisplayName "WinRM HTTP In" -Direction Inbound -Protocol TCP -LocalPort 5985 -Action Allow -Profile Any -Force

Restart services
Restart-Service WinRM -Force
Start-Service vmms

Check all
winrm get winrm/config/service/auth
Get-VM

Parameters and configuration

Parameters

--help Message with the parameters
--confg Path to the configuration file
--execute_local Parameter to indicate that it will be executed from the Hyper-V host itself and not from the Pandora server.
--save_file

Parameter that requires --execute_local in order to be used. This parameter will save the JSON output to a file .txt

Configuration file (--conf)

agent_prefix = HyperV
agents_group_id = 2
scan_vm = 1
scan_networking = 1
scan_storage = 0
scan_hypervisor = 1

 

Manual execution

The format for executing the plugin is as follows:

.\pandora_hyperV.exe --conf < ruta del .conf > --execute_local

Example:

.\pandora_hyperV.exe --conf pandora_hyperv.conf --execute_local

Example getting .txt with JSON

.\pandora_hyperV.exe --conf pandora_hyperv.conf --execute_local --save_file

Example output JSON:

[
  {
    "agent_data": {
      "agent_name": "HyperV WIN-BKM50GV4DF9",
      "agent_alias": "HyperV WIN-BKM50GV4DF9",
      "os": "Windows",
      "os_version": "Windows Server",
      "interval": 300,
      "id_group": 2,
      "address": "WIN-BKM50GV4DF9",
      "description": "Hyper-V host WIN-BKM50GV4DF9 (WIN-BKM50GV4DF9)"
    },
    "module_data": [
      {
        "name": "HyperV Local Status",
        "type": "generic_proc",
        "data": 1,
        "description": "Hyper-V plugin running locally (1=OK, 0=Fail)"
      }
    ]
  },
  {
    "agent_data": {
      "agent_name": "HyperV ubuntu server",
      "agent_alias": "HyperV ubuntu server",
      "os": "Windows",
      "os_version": "Windows",
      "interval": 300,
      "id_group": 2,
      "address": "WIN-BKM50GV4DF9",
      "description": "VM ubuntu server on Hyper-V host WIN-BKM50GV4DF9"
    },
    "module_data": [
      {
        "name": "State",
        "type": "generic_data",
        "data": 3,
        "description": "VM state: 2=Running 3=Off 32768=Paused 32769=Saved 32770=Starting 32771=Stopping 32772=Pausing 32773=Resuming 32774=Saving 32775=FastSaved 0=Unknown. Current: Off",
        "min_critical": 3,
        "max_critical": 3.1
      }
    ]
  }
]

Agents and modules generated by the plugin

With the Scan hypervisor token the plugin creates:

 

With the Scan VM token the plugin creates:

 

With the Scan Networking token the plugin creates:

 

With the Scan Storage token the plugin creates:

 

An example of agents created with the plugin would be the following:

Agentes.png

The hypervisor host modules will be as follows:

hyper v.png

detallados hyperV.png

 

For a Windows VM, we can see that the following modules are created:

modulos windows.png

detallados windows.png

For an Ubuntu VM, we can see the following modules:

modulos ubuntu.png

detallados ubuntu.png