From efb6ee9cbdff9a6666b09e2b233ea4646f53570e Mon Sep 17 00:00:00 2001 From: Ofek Lev Date: Thu, 3 Jan 2019 18:15:26 -0500 Subject: [PATCH] Add Hyper-V integration (#2607) * Add Hyper-V integration * more benchmarks --- hyperv/CHANGELOG.md | 2 + hyperv/MANIFEST.in | 11 ++ hyperv/README.md | 47 ++++++ hyperv/datadog_checks/__init__.py | 4 + hyperv/datadog_checks/hyperv/__about__.py | 4 + hyperv/datadog_checks/hyperv/__init__.py | 10 ++ .../hyperv/data/conf.yaml.example | 4 + hyperv/datadog_checks/hyperv/hyperv.py | 12 ++ hyperv/datadog_checks/hyperv/metrics.py | 135 ++++++++++++++++++ hyperv/logos/avatars-bot.png | Bin 0 -> 1104 bytes hyperv/logos/saas_logos-bot.png | Bin 0 -> 1594 bytes hyperv/logos/saas_logos-small.png | Bin 0 -> 995 bytes hyperv/manifest.json | 24 ++++ hyperv/metadata.csv | 17 +++ hyperv/requirements-dev.txt | 1 + hyperv/requirements.in | 0 hyperv/requirements.txt | 0 hyperv/setup.py | 62 ++++++++ hyperv/tests/__init__.py | 3 + hyperv/tests/conftest.py | 14 ++ hyperv/tests/test_bench.py | 28 ++++ hyperv/tests/test_hyperv.py | 13 ++ hyperv/tox.ini | 30 ++++ 23 files changed, 421 insertions(+) create mode 100644 hyperv/CHANGELOG.md create mode 100644 hyperv/MANIFEST.in create mode 100644 hyperv/README.md create mode 100644 hyperv/datadog_checks/__init__.py create mode 100644 hyperv/datadog_checks/hyperv/__about__.py create mode 100644 hyperv/datadog_checks/hyperv/__init__.py create mode 100644 hyperv/datadog_checks/hyperv/data/conf.yaml.example create mode 100644 hyperv/datadog_checks/hyperv/hyperv.py create mode 100644 hyperv/datadog_checks/hyperv/metrics.py create mode 100644 hyperv/logos/avatars-bot.png create mode 100644 hyperv/logos/saas_logos-bot.png create mode 100644 hyperv/logos/saas_logos-small.png create mode 100644 hyperv/manifest.json create mode 100644 hyperv/metadata.csv create mode 100644 hyperv/requirements-dev.txt create mode 100644 hyperv/requirements.in create mode 100644 hyperv/requirements.txt create mode 100644 hyperv/setup.py create mode 100644 hyperv/tests/__init__.py create mode 100644 hyperv/tests/conftest.py create mode 100644 hyperv/tests/test_bench.py create mode 100644 hyperv/tests/test_hyperv.py create mode 100644 hyperv/tox.ini diff --git a/hyperv/CHANGELOG.md b/hyperv/CHANGELOG.md new file mode 100644 index 0000000000000..8139cd5ef9369 --- /dev/null +++ b/hyperv/CHANGELOG.md @@ -0,0 +1,2 @@ +# CHANGELOG - Hyper-V + diff --git a/hyperv/MANIFEST.in b/hyperv/MANIFEST.in new file mode 100644 index 0000000000000..46f690a5c7885 --- /dev/null +++ b/hyperv/MANIFEST.in @@ -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__ diff --git a/hyperv/README.md b/hyperv/README.md new file mode 100644 index 0000000000000..4ff37bfba7785 --- /dev/null +++ b/hyperv/README.md @@ -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/ diff --git a/hyperv/datadog_checks/__init__.py b/hyperv/datadog_checks/__init__.py new file mode 100644 index 0000000000000..c5254131af1f1 --- /dev/null +++ b/hyperv/datadog_checks/__init__.py @@ -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__) diff --git a/hyperv/datadog_checks/hyperv/__about__.py b/hyperv/datadog_checks/hyperv/__about__.py new file mode 100644 index 0000000000000..ea0058ae72eb7 --- /dev/null +++ b/hyperv/datadog_checks/hyperv/__about__.py @@ -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' diff --git a/hyperv/datadog_checks/hyperv/__init__.py b/hyperv/datadog_checks/hyperv/__init__.py new file mode 100644 index 0000000000000..367faa45695ef --- /dev/null +++ b/hyperv/datadog_checks/hyperv/__init__.py @@ -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' +] diff --git a/hyperv/datadog_checks/hyperv/data/conf.yaml.example b/hyperv/datadog_checks/hyperv/data/conf.yaml.example new file mode 100644 index 0000000000000..f1b3ea7ec2378 --- /dev/null +++ b/hyperv/datadog_checks/hyperv/data/conf.yaml.example @@ -0,0 +1,4 @@ +init_config: + +instances: + - {} diff --git a/hyperv/datadog_checks/hyperv/hyperv.py b/hyperv/datadog_checks/hyperv/hyperv.py new file mode 100644 index 0000000000000..9a20c21601dcb --- /dev/null +++ b/hyperv/datadog_checks/hyperv/hyperv.py @@ -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 + ) diff --git a/hyperv/datadog_checks/hyperv/metrics.py b/hyperv/datadog_checks/hyperv/metrics.py new file mode 100644 index 0000000000000..f24b2a8f5811c --- /dev/null +++ b/hyperv/datadog_checks/hyperv/metrics.py @@ -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' + ], +] diff --git a/hyperv/logos/avatars-bot.png b/hyperv/logos/avatars-bot.png new file mode 100644 index 0000000000000000000000000000000000000000..fb16b07e856f29c3e14f363831b001b0beed769f GIT binary patch literal 1104 zcma)4YfO_@7(Ok9wJ45Zr4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mCPf*1<+|xVRw!u75oiY2_6ps literal 0 HcmV?d00001 diff --git a/hyperv/logos/saas_logos-bot.png b/hyperv/logos/saas_logos-bot.png new file mode 100644 index 0000000000000000000000000000000000000000..652a9425550b4904b1a585f60c42b27dea0cc49a GIT binary patch literal 1594 zcmeAS@N?(olHy`uVBq!ia0vp^CxEztgAGXf1*^?xU|?hPba4!+xb=3Hr?-lygu~pQ z>Yw|cy=szv%cS&9&P768z;=t$B6dMh@jD+DDddT}epI-dbh)=epwKxarr@}4yMCL# zx|X)_*4;}3UfXgkF}JEV!3p;6_7K7)e*0}CT2fhhu2g;g~RBZlzDr;pz6 zPcoZQpC*)K#^5Nx0zp6;#KB6z72#F_)K}*|VdhLpbwk68E7z|tpEqw_&GS3=?pe*Z zt1Su&4xW4Y^5yc~JJi(F&g@M~O|>*PH*fqbCMI@f&y*=5ES=?!$BrLAo1~$kQ6MKL zSM&Ttl9#`K`J~B{?{8IDy?XVtxYRXk*8Dg(vE9Yjw|C~`Y17&iI6m!H==gylbv9dirmGBz?2GW2g-Vtf4f z@xc2l7cDvz85LFZ{A7BYq7duZt(RAC_|M)H(CkuBSt%LVd?WM3pFcH6?&RO!H}kR4 z_ZKft?A^y_85a~J^f5}QRqw+2`S!b?8yOqV-L%Q*`_`IgKYv!XD8x-{%Hoc0I&{eC zzRBr*>rbBa+!ev`$VK9%cV#d|hwx+JrG{r!9Q-q}r6 zt-W}31@~3GMa!2hyYss4|G&F6+hpXWq`HJ$E-ifdGIMfQ>(bnNdDC>~%#GXoG^+bq zZO>0p$CmZ+``wmCmQ^jC=(=9NJFqKde_2*p**44NFMBrSU-zeA=|%O; zaq)}X18fzp+ge&02DE}39uZGHB|+qb2cjdIm)lup#C$oIDL$eFru)v8l-CVObC zfBWUtPAj!MmY<8?>!ck{{dN9E?|cE5qQ46kg(x?dFU+)3^^f_zb?)ugUw7}`?Yv&Q zw4*%ncki4zGQrxcrPr3kU20wD9AuDxDkY!o)OUfChj&GD2t9B5<25^6sasF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