-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add Hyper-V integration * more benchmarks
- Loading branch information
Showing
23 changed files
with
421 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# CHANGELOG - Hyper-V | ||
|
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,11 @@ | ||
graft datadog_checks | ||
graft tests | ||
|
||
include MANIFEST.in | ||
include README.md | ||
include requirements.in | ||
include requirements.txt | ||
include requirements-dev.txt | ||
include manifest.json | ||
|
||
global-exclude *.py[cod] __pycache__ |
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,47 @@ | ||
# Agent Check: Hyper-V | ||
|
||
## Overview | ||
|
||
This check monitors [Hyper-V][1] through the Datadog Agent. | ||
|
||
## Setup | ||
|
||
### Installation | ||
|
||
The Hyper-V check is included in the [Datadog Agent][2] package. No additional installation is needed on your server. | ||
|
||
### Configuration | ||
|
||
1. Edit the `hyperv.d/conf.yaml` file, in the `conf.d/` folder at the root of your Agent's configuration directory to collect your Hyper-V performance data. See the [sample hyperv.d/conf.yaml][3] for all available configuration options. | ||
|
||
2. [Restart the Agent][4]. | ||
|
||
### Validation | ||
|
||
[Run the Agent's status subcommand][5] and look for `hyperv` under the Checks section. | ||
|
||
## Data Collected | ||
|
||
### Metrics | ||
|
||
See [metadata.csv][6] for a list of metrics provided by this integration. | ||
|
||
### Service Checks | ||
|
||
Hyper-V does not include any service checks at this time. | ||
|
||
### Events | ||
|
||
Hyper-V does not include any events at this time. | ||
|
||
## Troubleshooting | ||
|
||
Need help? Contact [Datadog support][7]. | ||
|
||
[1]: https://docs.microsoft.com/en-us/windows-server/virtualization/hyper-v/hyper-v-on-windows-server | ||
[2]: https://docs.datadoghq.com/agent/basic_agent_usage/windows/ | ||
[3]: https://github.com/DataDog/integrations-core/blob/master/hyperv/datadog_checks/hyperv/data/conf.yaml.example | ||
[4]: https://docs.datadoghq.com/agent/faq/agent-commands/#start-stop-restart-the-agent | ||
[5]: https://docs.datadoghq.com/agent/faq/agent-commands/#agent-status-and-information | ||
[6]: https://github.com/DataDog/integrations-core/blob/master/hyperv/metadata.csv | ||
[7]: https://docs.datadoghq.com/help/ |
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,4 @@ | ||
# (C) Datadog, Inc. 2018 | ||
# All rights reserved | ||
# Licensed under a 3-clause BSD style license (see LICENSE) | ||
__path__ = __import__('pkgutil').extend_path(__path__, __name__) |
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,4 @@ | ||
# (C) Datadog, Inc. 2018 | ||
# All rights reserved | ||
# Licensed under a 3-clause BSD style license (see LICENSE) | ||
__version__ = '0.0.1' |
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,10 @@ | ||
# (C) Datadog, Inc. 2018 | ||
# All rights reserved | ||
# Licensed under a 3-clause BSD style license (see LICENSE) | ||
from .__about__ import __version__ | ||
from .hyperv import HypervCheck | ||
|
||
__all__ = [ | ||
'__version__', | ||
'HypervCheck' | ||
] |
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,4 @@ | ||
init_config: | ||
|
||
instances: | ||
- {} |
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,12 @@ | ||
# (C) Datadog, Inc. 2018 | ||
# All rights reserved | ||
# Licensed under a 3-clause BSD style license (see LICENSE) | ||
from datadog_checks.base import PDHBaseCheck | ||
from .metrics import DEFAULT_COUNTERS | ||
|
||
|
||
class HypervCheck(PDHBaseCheck): | ||
def __init__(self, name, init_config, agentConfig, instances=None): | ||
super(HypervCheck, self).__init__( | ||
name, init_config, agentConfig, instances=instances, counter_list=DEFAULT_COUNTERS | ||
) |
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,135 @@ | ||
# (C) Datadog, Inc. 2018 | ||
# All rights reserved | ||
# Licensed under a 3-clause BSD style license (see LICENSE) | ||
|
||
|
||
# [object, instance of counter, counter name, metric name, metric type] | ||
# | ||
# This set is (mostly) from the Microsoft recommended counters to monitor Hyper-V: | ||
# https://docs.microsoft.com/en-us/windows-server/administration/performance-tuning/role/hyper-v-server | ||
# https://blogs.technet.microsoft.com/neales/2016/10/24/hyper-v-performance-cpu | ||
# TODO: Investigate additional recommended counters from: | ||
# https://blogs.technet.microsoft.com/chrisavis/2013/03/25/performance-management-monitoring-cpu-resources | ||
DEFAULT_COUNTERS = [ | ||
# Memory | ||
[ | ||
'Hyper-V Dynamic Memory Balancer', | ||
None, | ||
'Available Memory', | ||
'hyperv.dynamic_memory_balancer.available_memory', | ||
'gauge' | ||
], | ||
[ | ||
'Hyper-V Dynamic Memory Balancer', | ||
None, | ||
'Average Pressure', | ||
'hyperv.dynamic_memory_balancer.average_pressure', | ||
'gauge' | ||
], | ||
|
||
# Network | ||
[ | ||
'Hyper-V Virtual Network Adapter', | ||
None, | ||
'Bytes/sec', | ||
'hyperv.virtual_network_adapter.bytes_per_sec', | ||
'gauge' | ||
], | ||
|
||
# Processor | ||
[ | ||
'Hyper-V Hypervisor Logical Processor', | ||
None, | ||
'% Guest Run Time', | ||
'hyperv.hypervisor_logical_processor.guest_run_time', | ||
'gauge' | ||
], | ||
[ | ||
'Hyper-V Hypervisor Logical Processor', | ||
None, | ||
'% Hypervisor Run Time', | ||
'hyperv.hypervisor_logical_processor.hypervisor_run_time', | ||
'gauge' | ||
], | ||
[ | ||
'Hyper-V Hypervisor Logical Processor', | ||
None, | ||
'% Idle Time', | ||
'hyperv.hypervisor_logical_processor.idle_time', | ||
'gauge' | ||
], | ||
[ | ||
'Hyper-V Hypervisor Logical Processor', | ||
None, | ||
'% Total Run Time', | ||
'hyperv.hypervisor_logical_processor.total_run_time', | ||
'gauge' | ||
], | ||
[ | ||
'Hyper-V Hypervisor Logical Processor', | ||
None, | ||
'Context Switches/sec', | ||
'hyperv.hypervisor_logical_processor.context_switches_per_sec', | ||
'gauge' | ||
], | ||
|
||
[ | ||
'Hyper-V Hypervisor Root Virtual Processor', | ||
None, | ||
'% Guest Run Time', | ||
'hyperv.hypervisor_root_virtual_processor.guest_run_time', | ||
'gauge' | ||
], | ||
[ | ||
'Hyper-V Hypervisor Root Virtual Processor', | ||
None, | ||
'% Hypervisor Run Time', | ||
'hyperv.hypervisor_root_virtual_processor.hypervisor_run_time', | ||
'gauge' | ||
], | ||
[ | ||
'Hyper-V Hypervisor Root Virtual Processor', | ||
None, | ||
'% Total Run Time', | ||
'hyperv.hypervisor_root_virtual_processor.total_run_time', | ||
'gauge' | ||
], | ||
|
||
[ | ||
'Hyper-V Hypervisor Virtual Processor', | ||
None, | ||
'% Guest Run Time', | ||
'hyperv.hypervisor_virtual_processor.guest_run_time', | ||
'gauge' | ||
], | ||
[ | ||
'Hyper-V Hypervisor Virtual Processor', | ||
None, | ||
'% Hypervisor Run Time', | ||
'hyperv.hypervisor_virtual_processor.hypervisor_run_time', | ||
'gauge' | ||
], | ||
[ | ||
'Hyper-V Hypervisor Virtual Processor', | ||
None, | ||
'% Total Run Time', | ||
'hyperv.hypervisor_virtual_processor.total_run_time', | ||
'gauge' | ||
], | ||
|
||
# Storage | ||
[ | ||
'Hyper-V VM Vid Partition', | ||
None, | ||
'Physical Pages Allocated', | ||
'hyperv.vm_vid_partition.physical_pages_allocated', | ||
'gauge' | ||
], | ||
[ | ||
'Hyper-V VM Vid Partition', | ||
None, | ||
'Remote Physical Pages', | ||
'hyperv.vm_vid_partition.remote_physical_pages', | ||
'gauge' | ||
], | ||
] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,24 @@ | ||
{ | ||
"display_name": "HyperV", | ||
"maintainer": "help@datadoghq.com", | ||
"manifest_version": "1.0.0", | ||
"name": "hyperv", | ||
"metric_prefix": "hyperv.", | ||
"metric_to_check": "hyperv.hypervisor_logical_processor.total_run_time", | ||
"creates_events": false, | ||
"short_description": "Monitor Microsoft's Hyper-V virtualization technology.", | ||
"guid": "412a75c1-b752-4b20-b046-4195dfaaf6ec", | ||
"support": "core", | ||
"supported_os": [ | ||
"windows" | ||
], | ||
"public_title": "Datadog-HyperV Integration", | ||
"categories": [ | ||
"azure", | ||
"cloud", | ||
"monitoring", | ||
"os & system" | ||
], | ||
"type": "check", | ||
"is_public": false | ||
} |
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,17 @@ | ||
metric_name,metric_type,interval,unit_name,per_unit_name,description,orientation,integration,short_name | ||
hyperv.dynamic_memory_balancer.available_memory,gauge,,byte,,The amount of memory left on the node.,1,hyperv, | ||
hyperv.dynamic_memory_balancer.average_pressure,gauge,,percent,,This counter represents the average pressure in the VM.,-1,hyperv, | ||
hyperv.hypervisor_logical_processor.guest_run_time,gauge,,percent,,The percentage of time spent by the processor in guest code.,0,hyperv, | ||
hyperv.hypervisor_logical_processor.hypervisor_run_time,gauge,,percent,,The percentage of time spent by the processor in hypervisor code.,0,hyperv, | ||
hyperv.hypervisor_logical_processor.idle_time,gauge,,percent,,The percentage of time spent by the processor in an idle state.,0,hyperv, | ||
hyperv.hypervisor_logical_processor.total_run_time,gauge,,percent,,The percentage of time spent by the processor in guest and hypervisor code.,0,hyperv, | ||
hyperv.hypervisor_logical_processor.context_switches_per_sec,gauge,,operation,,The combined rate at which all processors on the computer are switched from one thread to another.,0,hyperv, | ||
hyperv.hypervisor_root_virtual_processor.guest_run_time,gauge,,percent,,The percentage of time spent by the virtual processor in guest code.,0,hyperv, | ||
hyperv.hypervisor_root_virtual_processor.hypervisor_run_time,gauge,,percent,,The percentage of time spent by the virtual processor in hypervisor code.,0,hyperv, | ||
hyperv.hypervisor_root_virtual_processor.total_run_time,gauge,,percent,,The percentage of time spent by the virtual processor in guest and hypervisor code.,0,hyperv, | ||
hyperv.hypervisor_virtual_processor.guest_run_time,gauge,,percent,,The percentage of time spent by the virtual processor in guest code.,0,hyperv, | ||
hyperv.hypervisor_virtual_processor.hypervisor_run_time,gauge,,percent,,The percentage of time spent by the virtual processor in hypervisor code.,0,hyperv, | ||
hyperv.hypervisor_virtual_processor.total_run_time,gauge,,percent,,The percentage of time spent by the virtual processor in guest and hypervisor code.,0,hyperv, | ||
hyperv.virtual_network_adapter.bytes_per_sec,gauge,,byte,,The rate at which bytes are sent and received over each network adapter.,0,hyperv, | ||
hyperv.vm_vid_partition.physical_pages_allocated,gauge,,block,,The number of physical pages allocated.,0,hyperv, | ||
hyperv.vm_vid_partition.remote_physical_pages,gauge,,block,,The number of physical pages not allocated from the preferred NUMA node.,0,hyperv, |
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 @@ | ||
-e ../datadog_checks_dev |
Empty file.
Empty file.
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,62 @@ | ||
# (C) Datadog, Inc. 2018 | ||
# All rights reserved | ||
# Licensed under a 3-clause BSD style license (see LICENSE) | ||
from codecs import open # To use a consistent encoding | ||
from os import path | ||
|
||
from setuptools import setup | ||
|
||
HERE = path.dirname(path.abspath(__file__)) | ||
|
||
# Get version info | ||
ABOUT = {} | ||
with open(path.join(HERE, 'datadog_checks', 'hyperv', '__about__.py')) as f: | ||
exec(f.read(), ABOUT) | ||
|
||
# Get the long description from the README file | ||
with open(path.join(HERE, 'README.md'), encoding='utf-8') as f: | ||
long_description = f.read() | ||
|
||
|
||
CHECKS_BASE_REQ = 'datadog-checks-base' | ||
|
||
|
||
setup( | ||
name='datadog-hyperv', | ||
version=ABOUT['__version__'], | ||
description='The Hyper-V check', | ||
long_description=long_description, | ||
long_description_content_type='text/markdown', | ||
keywords='datadog agent hyperv check', | ||
|
||
# The project's main homepage. | ||
url='https://github.com/DataDog/integrations-core', | ||
|
||
# Author details | ||
author='Datadog', | ||
author_email='packages@datadoghq.com', | ||
|
||
# License | ||
license='BSD-3-Clause', | ||
|
||
# See https://pypi.org/classifiers | ||
classifiers=[ | ||
'Development Status :: 5 - Production/Stable', | ||
'Intended Audience :: Developers', | ||
'Intended Audience :: System Administrators', | ||
'Topic :: System :: Monitoring', | ||
'License :: OSI Approved :: BSD License', | ||
'Programming Language :: Python :: 2.7', | ||
'Programming Language :: Python :: 3.6', | ||
'Programming Language :: Python :: 3.7', | ||
], | ||
|
||
# The package we're going to ship | ||
packages=['datadog_checks.hyperv'], | ||
|
||
# Run-time dependencies | ||
install_requires=[CHECKS_BASE_REQ], | ||
|
||
# Extra files to ship with the wheel package | ||
include_package_data=True, | ||
) |
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,3 @@ | ||
# (C) Datadog, Inc. 2018 | ||
# All rights reserved | ||
# Licensed under a 3-clause BSD style license (see LICENSE) |
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,14 @@ | ||
# (C) Datadog, Inc. 2018 | ||
# All rights reserved | ||
# Licensed under a 3-clause BSD style license (see LICENSE) | ||
import pytest | ||
|
||
|
||
@pytest.fixture(scope='session') | ||
def dd_environment(): | ||
yield | ||
|
||
|
||
@pytest.fixture | ||
def instance(): | ||
return {} |
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 @@ | ||
# (C) Datadog, Inc. 2018 | ||
# All rights reserved | ||
# Licensed under a 3-clause BSD style license (see LICENSE) | ||
from copy import deepcopy | ||
|
||
from datadog_checks.hyperv import HypervCheck | ||
|
||
|
||
def test_refresh_counters(benchmark, instance): | ||
instance = deepcopy(instance) | ||
instance['refresh_counters'] = True | ||
check = HypervCheck('hyperv', {}, {}, [instance]) | ||
|
||
# Run once to get any PDH setup out of the way. | ||
check.check(instance) | ||
|
||
benchmark(check.check, instance) | ||
|
||
|
||
def test_no_refresh_counters(benchmark, instance): | ||
instance = deepcopy(instance) | ||
instance['refresh_counters'] = False | ||
check = HypervCheck('hyperv', {}, {}, [instance]) | ||
|
||
# Run once to get any PDH setup out of the way. | ||
check.check(instance) | ||
|
||
benchmark(check.check, instance) |
Oops, something went wrong.