Cette page n'est pas encore disponible en français, sa traduction est en cours. Si vous avez des questions ou des retours sur notre projet de traduction actuel, n'hésitez pas à nous contacter.
Submission
To submit an event from a custom Agent Check use the event(<EVENT_DICT>) function:
In the event_example.d/ folder, create a configuration file named event_example.yaml with the following content:
instances:[{}]
Up one level from the conf.d/ folder, go to the checks.d/ folder.
In this folder, create a custom check file named event_example.py with the following content:
event_example.py
fromdatadog_checks.baseimportAgentCheck__version__="1.0.0"classMyClass(AgentCheck):defcheck(self,instance):self.event({"timestamp":time.time(),"event_type":"Error","msg_title":"Example Event","msg_text":"This is an example event coming from Datadog.","alert_type":"error",})