Open cw-Widad opened 12 months ago
@JeanFred
Hi @cw-Widad, thanks for the details bug report. I’m afraid that since #1326, we have stopped using exim at $dayJob so I won‘t be able to work on this nor test any fix :-/
Regarding your notes:
command = ['exim', '-bp', '|', 'exiqsumm']
output = subprocess.check_output(command, shell=True)
Thanks for your reply @JeanFred
I am not sure if piped commands is the way to go here, since Datadog documentation suggests not using subprocess python module directly (From the documentaion here : Since the Python interpreter that runs the checks is embedded in the multi-threaded Go runtime, using the subprocess or multithreading modules from the Python standard library is not supported in Agent version 6 and later.) Unfortunately this means that exiqsumm won't be usable at all because exiqsumm only works on piped inputs.
I have tested using the exim -bpc command for just getting the total messages in queue, I will try rewriting the code for exim.queue.count using this and create a PR.
Output of the info page
Additional environment details (Operating System, Cloud provider, etc): Ubuntu 22.04.1 on Google Cloud Platform
Describe the results you received: No metrics received even when queue has messages. Results of running
exim -bp | exiqsumm
isLog files in /var/log/datadog/agent.log with log level set as debug shows these results
Describe the results you expected: Expected results with a Count of 680 as shown in command line execution above and a value of 1312000 for volume.
Additional information you deem important (e.g. issue happens only occasionally):
Some debugging was done on the code and as far as I see, it is an bug in the code. The metric is created by a command called here. exim/datadog_checks/exim/check.py
The command is input wrong in the function call, it should be given as command and options separately, i.e ['exim', '-bp'] vs ['exim -bp'] . Datadog documentation also confirms this here. writing-checks-that-run-command-line-programs
The function call uses two commands piped together, while the documentation for the get_process_output clearly outlines that a piped command won't work here base/utils/subprocess_output.py
There are no tests run to check if the exim -bp command works here test_exim.py