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