KangaCoders / newrelic_openvpn_agent

New Relic plugin to monitor OpenVPN
MIT License
12 stars 1 forks source link

divide by zero #7

Open wjcarpenter opened 6 years ago

wjcarpenter commented 6 years ago

I've just tried to set this up with OpenVPN 2.4.4. It just gives me a repeat of these lines every minute:

[2017-12-19 00:30:32 UTC] Agent OpenVPN Agent is at version 0.0.1
[2017-12-19 00:30:32 UTC] Error occurred in poll cycle: divided by 0
[2017-12-19 00:30:32 UTC] Gathered 0 statistics

I have tried OpenVPN status-version 1, 2, and 3 with the same result. Are there any other OpenVPN configs that are required for this plugin to work?

wjcarpenter commented 6 years ago

Based on the regex, this plugin want a status-version 1 file as input.

It seems the divide-by-zero happens if there are not active client sessions in the status file. I'd propose a fix, which ought to be simple, but I'm not a ruby guy.