1
2
3
4
5
6
7
8
9
10
11
12
13
14 import logging
15 log = logging.getLogger('zen.ZenRRD.CommandParser')
16
17 from pprint import pformat
20
22 self.events = []
23 self.values = []
24
26 args = (pformat(self.events), pformat(self.values))
27 return "ParsedResults\n events: %s\n values: %s}" % args
28
30
33
35 """
36 Preprocess the results of running a command.
37
38 @type cmd: Products.ZenRRD.zencommand.Cmd
39 @param cmd: the results of running a command, with the
40 configuration from ZenHub
41 @return: None.
42 """
43
44
45 if cmd.result.output.lstrip().startswith(cmd.command):
46 cmd.result.output = cmd.result.output.lstrip()[len(cmd.command):]
47
49 """
50 Process the results of a running a command.
51
52 @type cmd: Products.ZenRRD.zencommand.Cmd
53
54 @param cmd: the results of running a command, with the
55 configuration from ZenHub
56 @param results: the values and events from the command output
57 @return: None.
58 """
59 raise NotImplementedError
60
61 @property
63 """
64 Property which can control whether events will be created
65 based on the exit code of the command if no events are
66 generated in the processResults function.
67 """
68 return True
69