@@ 95-119 (lines=25) @@ | ||
92 | """Return the key of the list.""" |
|
93 | return 'indice' |
|
94 | ||
95 | def get_ports_alert(self, port, header="", log=False): |
|
96 | """Return the alert status relative to the port scan return value.""" |
|
97 | ret = 'OK' |
|
98 | if port['status'] is None: |
|
99 | ret = 'CAREFUL' |
|
100 | elif port['status'] == 0: |
|
101 | ret = 'CRITICAL' |
|
102 | elif ( |
|
103 | isinstance(port['status'], (float, int)) |
|
104 | and port['rtt_warning'] is not None |
|
105 | and port['status'] > port['rtt_warning'] |
|
106 | ): |
|
107 | ret = 'WARNING' |
|
108 | ||
109 | # Get stat name |
|
110 | stat_name = self.get_stat_name(header=header) |
|
111 | ||
112 | # Manage threshold |
|
113 | self.manage_threshold(stat_name, ret) |
|
114 | ||
115 | # Manage action |
|
116 | self.manage_action(stat_name, ret.lower(), header, port[self.get_key()]) |
|
117 | ||
118 | return ret |
|
119 | ||
120 | def get_web_alert(self, web, header="", log=False): |
|
121 | """Return the alert status relative to the web/url scan return value.""" |
|
122 | ret = 'OK' |
|
@@ 120-142 (lines=23) @@ | ||
117 | ||
118 | return ret |
|
119 | ||
120 | def get_web_alert(self, web, header="", log=False): |
|
121 | """Return the alert status relative to the web/url scan return value.""" |
|
122 | ret = 'OK' |
|
123 | if web['status'] is None: |
|
124 | ret = 'CAREFUL' |
|
125 | elif web['status'] not in [200, 301, 302]: |
|
126 | ret = 'CRITICAL' |
|
127 | elif web['rtt_warning'] is not None and web['elapsed'] > web['rtt_warning']: |
|
128 | ret = 'WARNING' |
|
129 | ||
130 | # Get stat name |
|
131 | stat_name = self.get_stat_name(header=header) |
|
132 | ||
133 | # Manage threshold |
|
134 | self.manage_threshold(stat_name, ret) |
|
135 | ||
136 | # Manage action |
|
137 | self.manage_action(stat_name, ret.lower(), header, web[self.get_key()]) |
|
138 | ||
139 | return ret |
|
140 | ||
141 | def msg_curse(self, args=None, max_width=None): |
|
142 | """Return the dict to display in the curse interface.""" |
|
143 | # Init the return message |
|
144 | # Only process if stats exist and display plugin enable... |
|
145 | ret = [] |