Skip to main content

Hyper-V NSCP Rest API

Pack Assets​

Templates​

The Centreon Pack Hyper-V brings 2 host templates:

  • Virt-Hyperv-Node-Nscp-Restapi-custom
  • Virt-Hyperv-Scvmm-Nscp-Restapi-custom

It brings the following service templates:

Service AliasService TemplateDefaultDiscovery
Node-Integration-ServiceVirt-Hyperv-Node-Integration-Service-Nscp-RestapiX
Node-ReplicationVirt-Hyperv-Node-Replication-Nscp-RestapiX
Node-SnapshotVirt-Hyperv-Node-Snapshot-Nscp-RestapiX
Node-Vm-StatusVirt-Hyperv-Node-Vm-Status-Nscp-RestapiX
Scvmm-Integration-ServiceVirt-Hyperv-Scvmm-Integration-Service-Nscp-RestapiX
Scvmm-SnapshotVirt-Hyperv-Scvmm-Snapshot-Nscp-RestapiX
Scvmm-Vm-StatusVirt-Hyperv-Scvmm-Vm-Status-Nscp-RestapiX

Discovery rules​

Rule nameDescription
Virt-Hyperv-Nscp-Restapi-HostDiscovery-Scvmm-VmDiscover the VMs bound to a SCVMM

Collected metrics & status​

Metric nameDescriptionUnit
global statusGlobal status of virtual machines integration services
service statusPrimary and secondary status of each virtual machines services

Prerequisites​

NSClient Configuration​

To monitor Hyper-V through NRPE, install the Centreon packaged version of the NSClient++ agent. Please follow our official documentation.

Please download and install the last release of Centreon-NSClient-xxx.exe: https://github.com/centreon/centreon-nsclient-build/releases.

By default, the username/password is centreon/centreon.

Network flow​

The target equipment must be reachable from the Centreon poller on the TCP/8443 port.

Setup​

  1. Install the Centreon Plugin package on every Centreon poller expected to monitor Hyper-V NSCP API resources:
yum install centreon-plugin-Applications-Protocol-Nrpe
  1. On the Centreon web interface, install the Hyper-V NSCP API Centreon Pack on the Configuration > Plugin Packs page.

Configuration​

Host​

  • Add a new host and apply one of following host templates

Once the template is applied, some macros have to be configured.

MandatoryNameDescription
NSCPRESTAPIPORTPort used (Default: 8443)
NSCPRESTAPIPROTOProtocol used (Default: https)
NSCPRESTAPIUSERNAMENSClient API username
NSCPRESTAPIPASSWORDNSClient API password
NSCPRESTAPILEGACYPASSWORDNSClient API legacy authentication password
NSCPRESTAPIEXTRAOPTIONSAny extra option you may want to add to the command (eg. a --insecure)

How to check in the CLI that the configuration is OK and what are the main options for?​

Once the plugin is installed, log into your Centreon Poller CLI using the centreon-engine user account and test the Plugin by running the following command to check NSClient configuration:

/usr/lib/centreon/plugins/centreon_protocol_nrpe.pl \
--plugin=apps::protocols::nrpe::plugin \
--mode=query \
--custommode=nsclient \
--hostname='10.0.0.1' \
--username=centreon \
--password=centreon \
--insecure \
--http-backend=curl \
--command=check_version

The expected command output is shown below:

0.5.2.41 2018-04-26

Check the Hyper-V Plugin by running the following command:

/usr/lib/centreon/plugins/centreon_protocol_nrpe.pl \
--plugin=apps::protocols::nrpe::plugin \
--mode=query \
--custommode=nsclient \
--hostname='10.0.0.1' \
--username=centreon \
--password=centreon \
--insecure \
--http-backend=curl \
--command=check_centreon_plugins \
--arg='apps::microsoft::hyperv::2012::local::plugin' \
--arg='node-vm-status' \
--arg='--filter-vm="" --verbose' \
--verbose

The expected command output is shown below:

OK: All virtual machines are ok 
VM 'vm1' status: Operating normally (state: Running, is clustered: 1)
VM 'vm2' status: Operating normally (state: Running, is clustered: 0)
VM 'vm3' status: Operating normally (state: Running, is clustered: 1)

All available options for a given mode can be displayed by adding the --help parameter to the command:

/usr/lib/centreon/plugins/centreon_protocol_nrpe.pl \
--plugin=apps::protocols::nrpe::plugin \
--mode=query \
--custommode=nsclient \
--hostname='10.0.0.1' \
--username=centreon \
--password=centreon \
--insecure \
--http-backend=curl \
--command=check_centreon_plugins \
--arg='apps::microsoft::hyperv::2012::local::plugin' \
--arg='node-vm-status' \
--arg='--help'

All available modes can be displayed by adding the --list-mode parameter to the command:

/usr/lib/centreon/plugins/centreon_protocol_nrpe.pl \
--plugin=apps::protocols::nrpe::plugin \
--mode=query \
--custommode=nsclient \
--hostname='10.0.0.1' \
--username=centreon \
--password=centreon \
--insecure \
--http-backend=curl \
--command=check_centreon_plugins \
--arg='apps::microsoft::hyperv::2012::local::plugin' \
--arg='xxx' \
--arg='--list-mode'

Troubleshooting​

Please find all the troubleshooting documentation for the Centreon Plugins on the dedicated page