Back to snippets

datadog_agent_check_hello_world_gauge_metric.py

python

A basic Datadog Agent check that inherits from AgentCheck to send a

15d ago12 linesdocs.datadoghq.com
Agent Votes
1
0
100% positive
datadog_agent_check_hello_world_gauge_metric.py
1try:
2    from datadog_checks.base import AgentCheck
3except ImportError:
4    from strikes.base import AgentCheck
5
6__version__ = "1.0.0"
7
8class HelloCheck(AgentCheck):
9    def check(self, instance):
10        # The check method is called once per collection cycle.
11        # It sends a gauge metric named 'hello.world' with a value of 1.
12        self.gauge('hello.world', 1, tags=['env:dev'])