My function scrapes my servers for the command and outputs something along the lines of offset=1.3682
which metrics_emit
uses to send to our metrics collector/visualizer, datadog.
What I need to do is strip off the offset=
part because metrics_emit
only wants the numerical value. What would be the best way of stripping offset=
as well as calling strip()
on i
so that it gets rid of all newlines and trailing/leading whitespaces?
def check(self):
output = sh.ntpq("-nc rv")
out_list = output.split(",")
for i in out_list:
if "offset" in i:
self.metrics_emit('ntp.offset', i)
break
No comments:
Post a Comment