2 #Copyright (C) 2009 Gabes Jean, naparuba@gmail.com
4 #This file is part of Shinken.
6 #Shinken is free software: you can redistribute it and/or modify
7 #it under the terms of the GNU Affero General Public License as published by
8 #the Free Software Foundation, either version 3 of the License, or
9 #(at your option) any later version.
11 #Shinken is distributed in the hope that it will be useful,
12 #but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 #GNU Affero General Public License for more details.
16 #You should have received a copy of the GNU Affero General Public License
17 #along with Shinken. If not, see <http://www.gnu.org/licenses/>.
20 #File for a Livestatus class which can be used by the status-dat-broker
27 except AttributeError: # Ptyhon 2.4 and 2.5 do nto have it
28 #try to use a standard queue instead
29 Queue
.LifoQueue
= Queue
.Queue
35 import simplejson
as json
38 from shinken
.service
import Service
39 from shinken
.external_command
import ExternalCommand
41 from shinken
.util
import from_bool_to_int
,from_list_to_split
,from_float_to_int
,to_int
,to_split
43 LOGCLASS_INFO
= 0 # all messages not in any other class
44 LOGCLASS_ALERT
= 1 # alerts: the change service/host state
45 LOGCLASS_PROGRAM
= 2 # important programm events (restart, ...)
46 LOGCLASS_NOTIFICATION
= 3 # host/service notifications
47 LOGCLASS_PASSIVECHECK
= 4 # passive checks
48 LOGCLASS_COMMAND
= 5 # external commands
49 LOGCLASS_STATE
= 6 # initial or current states
50 LOGCLASS_INVALID
= -1 # never stored
57 #This is a dirty hack. Service.get_name only returns service_description.
58 #For the servicegroup config we need more. host_name + separator + service_descriptio
59 def get_full_name(self
):
60 if get_full_name
.outputformat
== 'csv':
61 return self
.host_name
+ LiveStatus
.separators
[3] + self
.service_description
62 elif get_full_name
.outputformat
== 'json':
63 return [self
.host_name
, self
.service_description
]
65 print "Unknow output format!"
67 Service
.get_full_name
= get_full_name
70 #Another for hosts. We must have the same function for hosts and service in
71 #problem's source. So must define such a function for hosts too
72 def get_common_full_name(self
):
73 cls_name
= self
.__class
__.my_type
74 if cls_name
== 'service':
75 return self
.host_name
+ LiveStatus
.separators
[3] + self
.service_description
80 #It's a dict with 2 entries : hosts a,d services. Will return a string with just
81 #full name of all elements
82 def from_svc_hst_distinct_lists(dct
):
84 for h
in dct
['hosts']:
86 for s
in dct
['services']:
90 #For 2 hosts state, return the worse state
91 def worst_host_state(state_1
, state_2
):
92 #lambda x: reduce(lambda g, c: c if g == 0 else (c if c == 1 else g), (y.state_id for y in x), 0),
99 ##The worst state of all services that belong to a host of this group (OK <= WARN <= UNKNOWN <= CRIT)
100 def worst_service_state(state_1
, state_2
):
101 #reduce(lambda g, c: c if g == 0 else (c if c == 2 else (c if (c == 3 and g != 2) else g)), (z.state_id for y in x for z in y.services if z.state_type_id == 1), 0),
106 if state_1
== 3 and state_2
!= 2:
112 def __init__(self
, source
, impacts
):
114 self
.impacts
= impacts
118 def __init__(self
, cursor
, row
):
119 for idx
, col
in enumerate(cursor
.description
):
120 setattr(self
, col
[0], row
[idx
])
122 def fill(self
, hosts
, services
, hostname_lookup_table
, servicename_lookup_table
, columns
):
123 if self
.logobject
== LOGOBJECT_HOST
:
124 if self
.host_name
in hostname_lookup_table
:
125 setattr(self
, 'log_host', hosts
[hostname_lookup_table
[self
.host_name
]])
126 elif self
.logobject
== LOGOBJECT_SERVICE
:
127 if self
.host_name
in hostname_lookup_table
:
128 setattr(self
, 'log_host', hosts
[hostname_lookup_table
[self
.host_name
]])
129 if self
.host_name
+ self
.service_description
in servicename_lookup_table
:
130 setattr(self
, 'log_service', services
[servicename_lookup_table
[self
.host_name
+ self
.service_description
]])
135 separators
= map(lambda x
: chr(int(x
)), [10, 59, 44, 124])
136 #prop : is the internal name if it is different than the name in the output file
142 'accept_passive_checks' : {
143 'depythonize' : from_bool_to_int
,
144 'description' : 'Wether passive host checks are accepted (0/1)',
145 'prop' : 'passive_checks_enabled',
149 'depythonize' : from_bool_to_int
,
150 'description' : 'Wether the current host problem has been acknowledged (0/1)',
151 'prop' : 'problem_has_been_acknowledged',
154 'acknowledgement_type' : {
155 'description' : 'Type of acknowledgement (0: none, 1: normal, 2: stick)',
159 'description' : 'An optional URL to custom actions or information about this host',
162 'action_url_expanded' : {
163 'description' : 'The same as action_url, but with the most important macros expanded',
166 'active_checks_enabled' : {
167 'depythonize' : from_bool_to_int
,
168 'description' : 'Wether active checks are enabled for the host (0/1)',
172 'description' : 'IP address',
176 'description' : 'An alias name for the host',
180 'depythonize' : 'call',
181 'description' : 'Nagios command for active host check of this host',
184 'check_freshness' : {
185 'depythonize' : from_bool_to_int
,
186 'description' : 'Wether freshness checks are activated (0/1)',
191 'description' : 'Number of basic interval lengths between two scheduled checks of the host',
195 'description' : 'The current check option, forced, normal, freshness... (0-2)',
199 'depythonize' : 'get_name',
200 'description' : 'Time period in which this host will be checked. If empty then the host will always be checked.',
205 'description' : 'Type of check (0: active, 1: passive)',
209 'depythonize' : from_bool_to_int
,
210 'description' : 'Wether checks of the host are enabled (0/1)',
211 'prop' : 'active_checks_enabled',
216 'depythonize' : from_list_to_split
,
217 'description' : 'A list of all direct childs of the host',
222 'depythonize' : 'id',
223 'description' : 'A list of the ids of all comments of this host',
227 'depythonize' : 'contact_name',
228 'description' : 'A list of all contacts of this host, either direct or via a contact group',
231 'current_attempt' : {
234 'description' : 'Number of the current check attempts',
238 'current_notification_number' : {
240 'description' : 'Number of the current notification',
243 'custom_variable_names' : {
244 'description' : 'A list of the names of all custom variables',
247 'custom_variable_values' : {
248 'description' : 'A list of the values of the custom variables',
252 'description' : 'Optional display name of the host - not used by Nagios\' web interface',
256 'description' : 'A list of the ids of all scheduled downtimes of this host',
259 'event_handler_enabled' : {
260 'depythonize' : from_bool_to_int
,
261 'description' : 'Wether event handling is enabled (0/1)',
266 'description' : 'Time the host check needed for execution',
269 'first_notification_delay' : {
271 'description' : 'Delay before the first notification',
274 'flap_detection_enabled' : {
275 'depythonize' : from_bool_to_int
,
276 'description' : 'Wether flap detection is enabled (0/1)',
281 'depythonize' : to_split
,
282 'description' : 'A list of all host groups this host is in',
283 'prop' : 'hostgroups',
287 'description' : 'The effective hard state of the host (eliminates a problem in hard_state)',
290 'has_been_checked' : {
291 'depythonize' : from_bool_to_int
,
292 'description' : 'Wether the host has already been checked (0/1)',
295 'high_flap_threshold' : {
297 'description' : 'High threshold of flap detection',
301 'description' : 'The name of an image file to be used in the web pages',
305 'description' : 'Alternative text for the icon_image',
308 'icon_image_expanded' : {
309 'description' : 'The same as icon_image, but with the most important macros expanded',
312 'in_check_period' : {
313 'description' : 'Wether this host is currently in its check period (0/1)',
316 'in_notification_period' : {
317 'description' : 'Wether this host is currently in its notification period (0/1)',
321 'description' : 'Initial host state',
325 'default' : 0, # value in scheduler is not real-time
326 'description' : 'is there a host check currently running... (0/1)',
327 #'prop' : 'in_checking',
331 'depythonize' : from_bool_to_int
,
332 'description' : 'Wether the host state is flapping (0/1)',
337 'depythonize' : from_float_to_int
,
338 'description' : 'Time of the last check (Unix timestamp)',
342 'last_hard_state' : {
343 'description' : 'Last hard state',
346 'last_hard_state_change' : {
347 'description' : 'Time of the last hard state change (Unix timestamp)',
350 'last_notification' : {
352 'depythonize' : to_int
,
353 'description' : 'Time of the last notification (Unix timestamp)',
357 'description' : 'State before last state change',
360 'last_state_change' : {
362 'depythonize' : from_float_to_int
,
363 'description' : 'Time of the last state change - soft or hard (Unix timestamp)',
368 'description' : 'Time difference between scheduled check time and actual check time',
371 'long_plugin_output' : {
372 'description' : 'Complete output from check plugin',
373 'prop' : 'long_output',
376 'low_flap_threshold' : {
377 'description' : 'Low threshold of flap detection',
380 'max_check_attempts' : {
381 'description' : 'Max check attempts for active host checks',
385 'description' : 'Host name',
386 'prop' : 'host_name',
391 'depythonize' : from_float_to_int
,
392 'description' : 'Scheduled time for the next check (Unix timestamp)',
396 'next_notification' : {
398 'description' : 'Time of the next notification (Unix timestamp)',
402 'description' : 'Optional notes for this host',
406 'description' : 'The same as notes, but with the most important macros expanded',
410 'description' : 'An optional URL with further information about the host',
413 'notes_url_expanded' : {
414 'description' : 'Same es notes_url, but with the most important macros expanded',
417 'notification_interval' : {
419 'description' : 'Interval of periodic notification or 0 if its off',
422 'notification_period' : {
423 'depythonize' : 'get_name',
424 'description' : 'Time period in which problems of this host will be notified. If empty then notification will be always',
427 'notifications_enabled' : {
428 'depythonize' : from_bool_to_int
,
429 'description' : 'Wether notifications of the host are enabled (0/1)',
433 'depythonize' : lambda x
: len(x
),
434 'description' : 'The total number of services of the host',
438 'num_services_crit' : {
439 'depythonize' : lambda x
: len([y
for y
in x
if y
.state_id
== 2]),
440 'description' : 'The number of the host\'s services with the soft state CRIT',
444 'num_services_hard_crit' : {
445 'depythonize' : lambda x
: len([y
for y
in x
if y
.state_id
== 2 and y
.state_type_id
== 1]),
446 'description' : 'The number of the host\'s services with the hard state CRIT',
450 'num_services_hard_ok' : {
451 'depythonize' : lambda x
: len([y
for y
in x
if y
.state_id
== 0 and y
.state_type_id
== 1]),
452 'description' : 'The number of the host\'s services with the hard state OK',
456 'num_services_hard_unknown' : {
457 'depythonize' : lambda x
: len([y
for y
in x
if y
.state_id
== 3 and y
.state_type_id
== 1]),
458 'description' : 'The number of the host\'s services with the hard state UNKNOWN',
462 'num_services_hard_warn' : {
463 'depythonize' : lambda x
: len([y
for y
in x
if y
.state_id
== 2 and y
.state_type_id
== 1]),
464 'description' : 'The number of the host\'s services with the hard state WARN',
468 'num_services_ok' : {
469 'depythonize' : lambda x
: len([y
for y
in x
if y
.state_id
== 0]),
470 'description' : 'The number of the host\'s services with the soft state OK',
474 'num_services_pending' : {
475 'depythonize' : lambda x
: len([y
for y
in x
if y
.has_been_checked
== 0]),
476 'description' : 'The number of the host\'s services which have not been checked yet (pending)',
480 'num_services_unknown' : {
481 'depythonize' : lambda x
: len([y
for y
in x
if y
.state_id
== 3]),
482 'description' : 'The number of the host\'s services with the soft state UNKNOWN',
486 'num_services_warn' : {
487 'depythonize' : lambda x
: len([y
for y
in x
if y
.state_id
== 1]),
488 'description' : 'The number of the host\'s services with the soft state WARN',
492 'obsess_over_host' : {
493 'depythonize' : from_bool_to_int
,
494 'description' : 'The current obsess_over_host setting... (0/1)',
498 'depythonize' : lambda x
: ','.join(x
),
499 'description' : 'A list of all direct parents of the host',
502 'pending_flex_downtime' : {
503 'description' : 'Wether a flex downtime is pending (0/1)',
506 'percent_state_change' : {
507 'description' : 'Percent state change',
511 'description' : 'Optional performance data of the last host check',
515 'description' : 'Output of the last host check',
519 'process_performance_data' : {
520 'depythonize' : from_bool_to_int
,
521 'description' : 'Wether processing of performance data is enabled (0/1)',
522 'prop' : 'process_perf_data',
526 'description' : 'Number of basic interval lengths between checks when retrying after a soft error',
529 'scheduled_downtime_depth' : {
531 'description' : 'The number of downtimes this host is currently in',
536 'description' : 'The current state of the host (0: up, 1: down, 2: unreachable)',
542 'description' : 'Type of the current state (0: soft, 1: hard)',
543 'prop' : 'state_type_id',
546 'statusmap_image' : {
547 'description' : 'The name of in image file for the status map',
551 'description' : 'The total number of services of the host',
554 'worst_service_hard_state' : {
555 'description' : 'The worst hard state of all of the host\'s services (OK <= WARN <= UNKNOWN <= CRIT)',
558 'worst_service_state' : {
559 'description' : 'The worst soft state of all of the host\'s services (OK <= WARN <= UNKNOWN <= CRIT)',
563 'description' : '3D-Coordinates: X',
567 'description' : '3D-Coordinates: Y',
571 'description' : '3D-Coordinates: Z',
576 'description' : 'The importance we gave to this host between hte minimum 0 and the maximum 5',
579 'source_problems' : {
580 'description' : 'The name of the source problems (host or service)',
581 'prop' : 'source_problems',
583 'depythonize' : from_svc_hst_distinct_lists
,
586 'description' : 'List of what the source impact (list of hosts and services)',
589 'depythonize' : from_svc_hst_distinct_lists
,
595 'accept_passive_checks' : {
596 'depythonize' : from_bool_to_int
,
597 'description' : 'Wether the service accepts passive checks (0/1)',
598 'prop' : 'passive_checks_enabled',
602 'depythonize' : from_bool_to_int
,
603 'description' : 'Wether the current service problem has been acknowledged (0/1)',
604 'prop' : 'problem_has_been_acknowledged',
607 'acknowledgement_type' : {
608 'description' : 'The type of the acknownledgement (0: none, 1: normal, 2: sticky)',
612 'description' : 'An optional URL for actions or custom information about the service',
615 'action_url_expanded' : {
616 'description' : 'The action_url with (the most important) macros expanded',
619 'active_checks_enabled' : {
620 'depythonize' : from_bool_to_int
,
621 'description' : 'Wether active checks are enabled for the service (0/1)',
625 'depythonize' : 'call',
626 'description' : 'Nagios command used for active checks',
630 'description' : 'Number of basic interval lengths between two scheduled checks of the service',
634 'description' : 'The current check option, forced, normal, freshness... (0/1)',
638 'depythonize' : 'get_name',
639 'description' : 'The name of the check period of the service. It this is empty, the service is always checked.',
644 'depythonize' : to_int
,
645 'description' : 'The type of the last check (0: active, 1: passive)',
649 'depythonize' : from_bool_to_int
,
650 'description' : 'Wether active checks are enabled for the service (0/1)',
651 'prop' : 'active_checks_enabled',
656 'depythonize' : 'id',
657 'description' : 'A list of all comment ids of the service',
661 'depythonize' : 'contact_name',
662 'description' : 'A list of all contacts of the service, either direct or via a contact group',
665 'current_attempt' : {
667 'description' : 'The number of the current check attempt',
671 'current_notification_number' : {
672 'description' : 'The number of the current notification',
675 'custom_variable_names' : {
676 'description' : 'A list of the names of all custom variables of the service',
679 'custom_variable_values' : {
680 'description' : 'A list of the values of all custom variable of the service',
684 'description' : 'Description of the service (also used as key)',
685 'prop' : 'service_description',
689 'description' : 'An optional display name (not used by Nagios standard web pages)',
693 'description' : 'A list of all downtime ids of the service',
697 'depythonize' : 'call',
698 'description' : 'Nagios command used as event handler',
701 'event_handler_enabled' : {
702 'depythonize' : from_bool_to_int
,
703 'description' : 'Wether and event handler is activated for the service (0/1)',
708 'description' : 'Time the host check needed for execution',
711 'first_notification_delay' : {
713 'description' : 'Delay before the first notification',
716 'flap_detection_enabled' : {
717 'depythonize' : from_bool_to_int
,
718 'description' : 'Wether flap detection is enabled for the service (0/1)',
723 'depythonize' : to_split
,
724 'description' : 'A list of all service groups the service is in',
725 'prop' : 'servicegroups',
728 'has_been_checked' : {
729 'depythonize' : from_bool_to_int
,
730 'description' : 'Wether the service already has been checked (0/1)',
733 'high_flap_threshold' : {
734 'description' : 'High threshold of flap detection',
737 'host_accept_passive_checks' : {
738 'description' : 'Wether passive host checks are accepted (0/1)',
741 'host_acknowledged' : {
742 'depythonize' : lambda x
: from_bool_to_int(x
.problem_has_been_acknowledged
),
743 'description' : 'Wether the current host problem has been acknowledged (0/1)',
747 'host_acknowledgement_type' : {
748 'description' : 'Type of acknowledgement (0: none, 1: normal, 2: stick)',
751 'host_action_url' : {
752 'description' : 'An optional URL to custom actions or information about this host',
755 'host_action_url_expanded' : {
756 'description' : 'The same as action_url, but with the most important macros expanded',
759 'host_active_checks_enabled' : {
760 'description' : 'Wether active checks are enabled for the host (0/1)',
764 'description' : 'IP address',
768 'description' : 'An alias name for the host',
771 'host_check_command' : {
772 'description' : 'Nagios command for active host check of this host',
775 'host_check_freshness' : {
776 'description' : 'Wether freshness checks are activated (0/1)',
779 'host_check_interval' : {
780 'description' : 'Number of basic interval lengths between two scheduled checks of the host',
783 'host_check_options' : {
784 'description' : 'The current check option, forced, normal, freshness... (0-2)',
787 'host_check_period' : {
788 'description' : 'Time period in which this host will be checked. If empty then the host will always be checked.',
791 'host_check_type' : {
792 'description' : 'Type of check (0: active, 1: passive)',
795 'host_checks_enabled' : {
796 'depythonize' : lambda x
: from_bool_to_int(x
.active_checks_enabled
),
797 'description' : 'Wether checks of the host are enabled (0/1)',
802 'description' : 'A list of all direct childs of the host',
807 'depythonize' : lambda h
: ([c
.id for c
in h
.comments
]),
808 'description' : 'A list of the ids of all comments of this host',
813 'description' : 'A list of all contacts of this host, either direct or via a contact group',
816 'host_current_attempt' : {
817 'description' : 'Number of the current check attempts',
820 'host_current_notification_number' : {
821 'description' : 'Number of the current notification',
824 'host_custom_variable_names' : {
825 'description' : 'A list of the names of all custom variables',
828 'host_custom_variable_values' : {
829 'description' : 'A list of the values of the custom variables',
832 'host_display_name' : {
833 'description' : 'Optional display name of the host - not used by Nagios\' web interface',
837 'description' : 'A list of the ids of all scheduled downtimes of this host',
840 'host_event_handler_enabled' : {
841 'description' : 'Wether event handling is enabled (0/1)',
844 'host_execution_time' : {
845 'description' : 'Time the host check needed for execution',
848 'host_first_notification_delay' : {
849 'description' : 'Delay before the first notification',
852 'host_flap_detection_enabled' : {
853 'description' : 'Wether flap detection is enabled (0/1)',
858 'depythonize' : lambda x
: to_split(x
.hostgroups
),
859 'description' : 'A list of all host groups this host is in',
863 'host_hard_state' : {
864 'description' : 'The effective hard state of the host (eliminates a problem in hard_state)',
867 'host_has_been_checked' : {
868 'depythonize' : lambda x
: from_bool_to_int(x
.has_been_checked
),
869 'description' : 'Wether the host has already been checked (0/1)',
873 'host_high_flap_threshold' : {
874 'description' : 'High threshold of flap detection',
877 'host_icon_image' : {
878 'description' : 'The name of an image file to be used in the web pages',
881 'host_icon_image_alt' : {
882 'description' : 'Alternative text for the icon_image',
885 'host_icon_image_expanded' : {
886 'description' : 'The same as icon_image, but with the most important macros expanded',
889 'host_in_check_period' : {
890 'description' : 'Wether this host is currently in its check period (0/1)',
893 'host_in_notification_period' : {
894 'description' : 'Wether this host is currently in its notification period (0/1)',
897 'host_initial_state' : {
898 'description' : 'Initial host state',
901 'host_is_executing' : {
902 'default' : 0, # value in scheduler is not real-time
903 'description' : 'is there a host check currently running... (0/1)',
906 'host_is_flapping' : {
908 'depythonize' : from_bool_to_int
,
909 'description' : 'Wether the host state is flapping (0/1)',
912 'host_last_check' : {
913 'description' : 'Time of the last check (Unix timestamp)',
916 'host_last_hard_state' : {
917 'description' : 'Last hard state',
920 'host_last_hard_state_change' : {
921 'description' : 'Time of the last hard state change (Unix timestamp)',
924 'host_last_notification' : {
925 'description' : 'Time of the last notification (Unix timestamp)',
928 'host_last_state' : {
929 'description' : 'State before last state change',
932 'host_last_state_change' : {
933 'description' : 'Time of the last state change - soft or hard (Unix timestamp)',
937 'description' : 'Time difference between scheduled check time and actual check time',
940 'host_long_plugin_output' : {
941 'description' : 'Complete output from check plugin',
944 'host_low_flap_threshold' : {
945 'description' : 'Low threshold of flap detection',
948 'host_max_check_attempts' : {
949 'description' : 'Max check attempts for active host checks',
953 'description' : 'Host name',
956 'host_next_check' : {
957 'description' : 'Scheduled time for the next check (Unix timestamp)',
960 'host_next_notification' : {
961 'description' : 'Time of the next notification (Unix timestamp)',
965 'description' : 'Optional notes for this host',
968 'host_notes_expanded' : {
969 'description' : 'The same as notes, but with the most important macros expanded',
973 'description' : 'An optional URL with further information about the host',
976 'host_notes_url_expanded' : {
977 'description' : 'Same es notes_url, but with the most important macros expanded',
980 'host_notification_interval' : {
981 'description' : 'Interval of periodic notification or 0 if its off',
984 'host_notification_period' : {
985 'description' : 'Time period in which problems of this host will be notified. If empty then notification will be always',
988 'host_notifications_enabled' : {
989 'depythonize' : lambda x
: from_bool_to_int(x
.notifications_enabled
),
990 'description' : 'Wether notifications of the host are enabled (0/1)',
994 'host_num_services' : {
995 'depythonize' : lambda x
: len(x
.services
),
996 'description' : 'The total number of services of the host',
1000 'host_num_services_crit' : {
1001 'depythonize' : lambda x
: len([y
for y
in x
.services
if y
.state_id
== 2]),
1002 'description' : 'The number of the host\'s services with the soft state CRIT',
1006 'host_num_services_hard_crit' : {
1007 'depythonize' : lambda x
: len([y
for y
in x
.services
if y
.state_id
== 2 and y
.state_type_id
== 1]),
1008 'description' : 'The number of the host\'s services with the hard state CRIT',
1012 'host_num_services_hard_ok' : {
1013 'depythonize' : lambda x
: len([y
for y
in x
.services
if y
.state_id
== 0 and y
.state_type_id
== 1]),
1014 'description' : 'The number of the host\'s services with the hard state OK',
1018 'host_num_services_hard_unknown' : {
1019 'depythonize' : lambda x
: len([y
for y
in x
.services
if y
.state_id
== 3 and y
.state_type_id
== 1]),
1020 'description' : 'The number of the host\'s services with the hard state UNKNOWN',
1024 'host_num_services_hard_warn' : {
1025 'depythonize' : lambda x
: len([y
for y
in x
.services
if y
.state_id
== 2 and y
.state_type_id
== 1]),
1026 'description' : 'The number of the host\'s services with the hard state WARN',
1030 'host_num_services_ok' : {
1031 'depythonize' : lambda x
: len([y
for y
in x
.services
if y
.state_id
== 0]),
1032 'description' : 'The number of the host\'s services with the soft state OK',
1036 'host_num_services_pending' : {
1037 'depythonize' : lambda x
: len([y
for y
in x
.services
if y
.has_been_checked
== 0]),
1038 'description' : 'The number of the host\'s services which have not been checked yet (pending)',
1042 'host_num_services_unknown' : {
1043 'depythonize' : lambda x
: len([y
for y
in x
.services
if y
.state_id
== 3]),
1044 'description' : 'The number of the host\'s services with the soft state UNKNOWN',
1048 'host_num_services_warn' : {
1049 'depythonize' : lambda x
: len([y
for y
in x
.services
if y
.state_id
== 1]),
1050 'description' : 'The number of the host\'s services with the soft state WARN',
1054 'host_obsess_over_host' : {
1055 'description' : 'The current obsess_over_host setting... (0/1)',
1059 'description' : 'A list of all direct parents of the host',
1062 'host_pending_flex_downtime' : {
1063 'description' : 'Wether a flex downtime is pending (0/1)',
1066 'host_percent_state_change' : {
1067 'description' : 'Percent state change',
1070 'host_perf_data' : {
1071 'description' : 'Optional performance data of the last host check',
1074 'host_plugin_output' : {
1075 'description' : 'Output of the last host check',
1078 'host_process_performance_data' : {
1079 'description' : 'Wether processing of performance data is enabled (0/1)',
1082 'host_retry_interval' : {
1083 'description' : 'Number of basic interval lengths between checks when retrying after a soft error',
1086 'host_scheduled_downtime_depth' : {
1088 'depythonize' : lambda x
: x
.scheduled_downtime_depth
,
1089 'description' : 'The number of downtimes this host is currently in',
1095 'depythonize' : lambda x
: x
.state_id
,
1096 'description' : 'The current state of the host (0: up, 1: down, 2: unreachable)',
1100 'host_state_type' : {
1101 'description' : 'Type of the current state (0: soft, 1: hard)',
1104 'host_statusmap_image' : {
1105 'description' : 'The name of in image file for the status map',
1108 'host_total_services' : {
1109 'description' : 'The total number of services of the host',
1112 'host_worst_service_hard_state' : {
1113 'description' : 'The worst hard state of all of the host\'s services (OK <= WARN <= UNKNOWN <= CRIT)',
1116 'host_worst_service_state' : {
1117 'description' : 'The worst soft state of all of the host\'s services (OK <= WARN <= UNKNOWN <= CRIT)',
1121 'description' : '3D-Coordinates: X',
1125 'description' : '3D-Coordinates: Y',
1129 'description' : '3D-Coordinates: Z',
1133 'description' : 'The name of an image to be used as icon in the web interface',
1136 'icon_image_alt' : {
1137 'description' : 'An alternative text for the icon_image for browsers not displaying icons',
1140 'icon_image_expanded' : {
1141 'description' : 'The icon_image with (the most important) macros expanded',
1144 'in_check_period' : {
1145 'description' : 'Wether the service is currently in its check period (0/1)',
1148 'in_notification_period' : {
1149 'description' : 'Wether the service is currently in its notification period (0/1)',
1153 'description' : 'The initial state of the service',
1157 'default' : 0, # value in scheduler is not real-time
1158 'description' : 'is there a service check currently running... (0/1)',
1162 'depythonize' : from_bool_to_int
,
1163 'description' : 'Wether the service is flapping (0/1)',
1167 'depythonize' : from_float_to_int
,
1168 'description' : 'The time of the last check (Unix timestamp)',
1169 'prop' : 'last_chk',
1172 'last_hard_state' : {
1173 'description' : 'The last hard state of the service',
1176 'last_hard_state_change' : {
1177 'description' : 'The time of the last hard state change (Unix timestamp)',
1180 'last_notification' : {
1181 'depythonize' : to_int
,
1182 'description' : 'The time of the last notification (Unix timestamp)',
1186 'description' : 'The last state of the service',
1189 'last_state_change' : {
1190 'depythonize' : from_float_to_int
,
1191 'description' : 'The time of the last state change (Unix timestamp)',
1195 'depythonize' : to_int
,
1196 'description' : 'Time difference between scheduled check time and actual check time',
1199 'long_plugin_output' : {
1200 'description' : 'Unabbreviated output of the last check plugin',
1201 'prop' : 'long_output',
1204 'low_flap_threshold' : {
1205 'description' : 'Low threshold of flap detection',
1208 'max_check_attempts' : {
1209 'description' : 'The maximum number of check attempts',
1213 'depythonize' : from_float_to_int
,
1214 'description' : 'The scheduled time of the next check (Unix timestamp)',
1215 'prop' : 'next_chk',
1218 'next_notification' : {
1219 'description' : 'The time of the next notification (Unix timestamp)',
1223 'description' : 'Optional notes about the service',
1226 'notes_expanded' : {
1227 'description' : 'The notes with (the most important) macros expanded',
1231 'description' : 'An optional URL for additional notes about the service',
1234 'notes_url_expanded' : {
1235 'description' : 'The notes_url with (the most important) macros expanded',
1238 'notification_interval' : {
1239 'description' : 'Interval of periodic notification or 0 if its off',
1242 'notification_period' : {
1243 'depythonize' : 'get_name',
1244 'description' : 'The name of the notification period of the service. It this is empty, service problems are always notified.',
1247 'notifications_enabled' : {
1248 'depythonize' : from_bool_to_int
,
1249 'description' : 'Wether notifications are enabled for the service (0/1)',
1252 'obsess_over_service' : {
1253 'depythonize' : from_bool_to_int
,
1254 'description' : 'Wether \'obsess_over_service\' is enabled for the service (0/1)',
1257 'percent_state_change' : {
1258 'description' : 'Percent state change',
1262 'description' : 'Performance data of the last check plugin',
1266 'description' : 'Output of the last check plugin',
1270 'process_performance_data' : {
1271 'depythonize' : from_bool_to_int
,
1272 'description' : 'Wether processing of performance data is enabled for the service (0/1)',
1273 'prop' : 'process_perf_data',
1276 'retry_interval' : {
1277 'description' : 'Number of basic interval lengths between checks when retrying after a soft error',
1280 'scheduled_downtime_depth' : {
1282 'description' : 'The number of scheduled downtimes the service is currently in',
1287 'description' : 'The current state of the service (0: OK, 1: WARN, 2: CRITICAL, 3: UNKNOWN)',
1288 'prop' : 'state_id',
1293 'description' : 'The type of the current state (0: soft, 1: hard)',
1294 'prop' : 'state_type_id',
1299 'description' : 'The importance we gave to this service between hte minimum 0 and the maximum 5',
1302 'source_problems' : {
1303 'description' : 'The name of the source problems (host or service)',
1304 'prop' : 'source_problems',
1306 'depythonize' : from_svc_hst_distinct_lists
,
1309 'description' : 'List of what the source impact (list of hosts and services)',
1312 'depythonize' : from_svc_hst_distinct_lists
,
1319 'description' : 'An optional URL to custom actions or information about the hostgroup',
1323 'description' : 'An alias of the hostgroup',
1327 'depythonize' : 'get_name',
1328 'description' : 'A list of all host names that are members of the hostgroup',
1332 'description' : 'Name of the hostgroup',
1333 'prop' : 'hostgroup_name',
1337 'description' : 'Optional notes to the hostgroup',
1341 'description' : 'An optional URL with further information about the hostgroup',
1345 'depythonize' : lambda x
: len(x
),
1346 'description' : 'The total number of hosts in the group',
1347 'prop' : 'get_hosts',
1350 'num_hosts_down' : {
1351 'depythonize' : lambda x
: len([y
for y
in x
if y
.state_id
== 1]),
1352 'description' : 'The number of hosts in the group that are down',
1353 'prop' : 'get_hosts',
1356 'num_hosts_pending' : {
1357 'depythonize' : lambda x
: len([y
for y
in x
if y
.has_been_checked
== 0]),
1358 'description' : 'The number of hosts in the group that are pending',
1359 'prop' : 'get_hosts',
1362 'num_hosts_unreach' : {
1363 'depythonize' : lambda x
: len([y
for y
in x
if y
.state_id
== 2]),
1364 'description' : 'The number of hosts in the group that are unreachable',
1365 'prop' : 'get_hosts',
1369 'depythonize' : lambda x
: len([y
for y
in x
if y
.state_id
== 0]),
1370 'description' : 'The number of hosts in the group that are up',
1371 'prop' : 'get_hosts',
1375 'depythonize' : lambda x
: sum((len(y
.service_ids
) for y
in x
)),
1376 'description' : 'The total number of services of hosts in this group',
1377 'prop' : 'get_hosts',
1380 'num_services_crit' : {
1381 'depythonize' : lambda x
: len([z
for y
in x
for z
in y
.services
if z
.state_id
== 2]),
1382 'description' : 'The total number of services with the state CRIT of hosts in this group',
1383 'prop' : 'get_hosts',
1386 'num_services_hard_crit' : {
1387 'depythonize' : lambda x
: len([z
for y
in x
for z
in y
.services
if z
.state_id
== 2 and z
.state_type_id
== 1]),
1388 'description' : 'The total number of services with the state CRIT of hosts in this group',
1389 'prop' : 'get_hosts',
1392 'num_services_hard_ok' : {
1393 'depythonize' : lambda x
: len([z
for y
in x
for z
in y
.services
if z
.state_id
== 0 and z
.state_type_id
== 1]),
1394 'description' : 'The total number of services with the state OK of hosts in this group',
1395 'prop' : 'get_hosts',
1398 'num_services_hard_unknown' : {
1399 'depythonize' : lambda x
: len([z
for y
in x
for z
in y
.services
if z
.state_id
== 3 and z
.state_type_id
== 1]),
1400 'description' : 'The total number of services with the state UNKNOWN of hosts in this group',
1401 'prop' : 'get_hosts',
1404 'num_services_hard_warn' : {
1405 'depythonize' : lambda x
: len([z
for y
in x
for z
in y
.services
if z
.state_id
== 2 and z
.state_type_id
== 1]),
1406 'description' : 'The total number of services with the state WARN of hosts in this group',
1407 'prop' : 'get_hosts',
1410 'num_services_ok' : {
1411 'depythonize' : lambda x
: len([z
for y
in x
for z
in y
.services
if z
.state_id
== 0]),
1412 'description' : 'The total number of services with the state OK of hosts in this group',
1413 'prop' : 'get_hosts',
1416 'num_services_pending' : {
1417 'depythonize' : lambda x
: len([z
for y
in x
for z
in y
.services
if z
.has_been_checked
== 0]),
1418 'description' : 'The total number of services with the state Pending of hosts in this group',
1419 'prop' : 'get_hosts',
1422 'num_services_unknown' : {
1423 'depythonize' : lambda x
: len([z
for y
in x
for z
in y
.services
if z
.state_id
== 3]),
1424 'description' : 'The total number of services with the state UNKNOWN of hosts in this group',
1425 'prop' : 'get_hosts',
1428 'num_services_warn' : {
1429 'depythonize' : lambda x
: len([z
for y
in x
for z
in y
.services
if z
.state_id
== 1]),
1430 'description' : 'The total number of services with the state WARN of hosts in this group',
1431 'prop' : 'get_hosts',
1434 'worst_host_state' : {
1435 'depythonize' : lambda x
: reduce(worst_host_state
, (y
.state_id
for y
in x
), 0),
1436 'description' : 'The worst state of all of the groups\' hosts (UP <= UNREACHABLE <= DOWN)',
1437 'prop' : 'get_hosts',
1440 'worst_service_hard_state' : {
1441 'depythonize' : lambda x
: reduce(worst_service_state
, (z
.state_id
for y
in x
for z
in y
.services
if z
.state_type_id
== 1), 0),
1442 'description' : 'The worst state of all services that belong to a host of this group (OK <= WARN <= UNKNOWN <= CRIT)',
1443 'prop' : 'get_hosts',
1446 'worst_service_state' : {
1447 'depythonize' : lambda x
: reduce(worst_service_state
, (z
.state_id
for y
in x
for z
in y
.services
), 0),
1448 'description' : 'The worst state of all services that belong to a host of this group (OK <= WARN <= UNKNOWN <= CRIT)',
1449 'prop' : 'get_hosts',
1456 'description' : 'An optional URL to custom notes or actions on the service group',
1460 'description' : 'An alias of the service group',
1464 'depythonize' : 'get_full_name',
1465 'description' : 'A list of all members of the service group as host/service pairs ',
1469 'description' : 'The name of the service group',
1470 'prop' : 'servicegroup_name',
1474 'description' : 'Optional additional notes about the service group',
1478 'description' : 'An optional URL to further notes on the service group',
1483 'depythonize' : lambda x
: len(x
),
1484 'description' : 'The total number of services in the group',
1485 'prop' : 'get_services',
1488 'num_services_crit' : {
1490 'depythonize' : lambda x
: len([y
for y
in x
if y
.state_id
== 2]),
1491 'description' : 'The number of services in the group that are CRIT',
1492 'prop' : 'get_services',
1495 'num_services_hard_crit' : {
1497 'depythonize' : lambda x
: len([y
for y
in x
if y
.state_id
== 2 and y
.state_type_id
== 1]),
1498 'description' : 'The number of services in the group that are CRIT',
1499 'prop' : 'get_services',
1502 'num_services_hard_ok' : {
1504 'depythonize' : lambda x
: len([y
for y
in x
if y
.state_id
== 0 and y
.state_type_id
== 1]),
1505 'description' : 'The number of services in the group that are OK',
1506 'prop' : 'get_services',
1509 'num_services_hard_unknown' : {
1511 'depythonize' : lambda x
: len([y
for y
in x
if y
.state_id
== 3 and y
.state_type_id
== 1]),
1512 'description' : 'The number of services in the group that are UNKNOWN',
1513 'prop' : 'get_services',
1516 'num_services_hard_warn' : {
1518 'depythonize' : lambda x
: len([y
for y
in x
if y
.state_id
== 2 and y
.state_type_id
== 1]),
1519 'description' : 'The number of services in the group that are WARN',
1520 'prop' : 'get_services',
1523 'num_services_ok' : {
1525 'depythonize' : lambda x
: len([y
for y
in x
if y
.state_id
== 0]),
1526 'description' : 'The number of services in the group that are OK',
1527 'prop' : 'get_services',
1530 'num_services_pending' : {
1532 'depythonize' : lambda x
: len([y
for y
in x
if y
.has_been_checked
== 0]),
1533 'description' : 'The number of services in the group that are PENDING',
1534 'prop' : 'get_services',
1537 'num_services_unknown' : {
1539 'depythonize' : lambda x
: len([y
for y
in x
if y
.state_id
== 3]),
1540 'description' : 'The number of services in the group that are UNKNOWN',
1541 'prop' : 'get_services',
1544 'num_services_warn' : {
1546 'depythonize' : lambda x
: len([y
for y
in x
if y
.state_id
== 1]),
1547 'description' : 'The number of services in the group that are WARN',
1548 'prop' : 'get_services',
1551 'worst_service_state' : {
1552 'depythonize' : lambda x
: reduce(worst_service_state
, (y
.state_id
for y
in x
), 0),
1553 'description' : 'The worst soft state of all of the groups services (OK <= WARN <= UNKNOWN <= CRIT)',
1554 'prop' : 'get_services',
1561 'description' : 'The additional field address1',
1565 'description' : 'The additional field address2',
1569 'description' : 'The additional field address3',
1573 'description' : 'The additional field address4',
1577 'description' : 'The additional field address5',
1581 'description' : 'The additional field address6',
1585 'description' : 'The full name of the contact',
1588 'can_submit_commands' : {
1589 'depythonize' : from_bool_to_int
,
1590 'description' : 'Wether the contact is allowed to submit commands (0/1)',
1593 'custom_variable_names' : {
1594 'description' : 'A list of all custom variables of the contact',
1597 'custom_variable_values' : {
1598 'description' : 'A list of the values of all custom variables of the contact',
1602 'description' : 'The email address of the contact',
1605 'host_notification_period' : {
1606 'depythonize' : 'get_name',
1607 'description' : 'The time period in which the contact will be notified about host problems',
1610 'host_notifications_enabled' : {
1611 'depythonize' : from_bool_to_int
,
1612 'description' : 'Wether the contact will be notified about host problems in general (0/1)',
1615 'in_host_notification_period' : {
1616 'depythonize' : from_bool_to_int
,
1617 'description' : 'Wether the contact is currently in his/her host notification period (0/1)',
1620 'in_service_notification_period' : {
1621 'depythonize' : from_bool_to_int
,
1622 'description' : 'Wether the contact is currently in his/her service notification period (0/1)',
1626 'description' : 'The login name of the contact person',
1627 'prop' : 'contact_name',
1631 'description' : 'The pager address of the contact',
1634 'service_notification_period' : {
1635 'depythonize' : 'get_name',
1636 'description' : 'The time period in which the contact will be notified about service problems',
1639 'service_notifications_enabled' : {
1640 'depythonize' : from_bool_to_int
,
1641 'description' : 'Wether the contact will be notified about service problems in general (0/1)',
1650 'description' : 'The alias of the contactgroup',
1654 'depythonize' : 'get_name',
1655 'description' : 'A list of all members of this contactgroup',
1659 'description' : 'The name of the contactgroup',
1660 'prop' : 'contactgroup_name',
1669 'description' : 'The alias of the timeperiod',
1673 'description' : 'The name of the timeperiod',
1674 'prop' : 'timeperiod_name',
1679 #All commands (checks + notifications)
1682 'description' : 'The shell command line',
1683 'prop' : 'command_line',
1687 'description' : 'The name of the command',
1688 'prop' : 'command_name',
1698 'description' : 'The name of the scheduler',
1699 'prop' : 'scheduler_name',
1703 'description' : 'The ip or dns adress ofthe scheduler',
1708 'description' : 'The TCP port of the scheduler',
1713 'description' : 'If the scheduler is a spare or not',
1714 'depythonize' : from_bool_to_int
,
1719 'description' : 'Weight (in terms of hosts) of the scheduler',
1724 'description' : 'If the scheduler is alive or not',
1726 'depythonize' : from_bool_to_int
,
1736 'description' : 'The name of the poller',
1737 'prop' : 'poller_name',
1741 'description' : 'The ip or dns adress of the poller',
1746 'description' : 'The TCP port of the poller',
1751 'description' : 'If the poller is a spare or not',
1752 'depythonize' : from_bool_to_int
,
1757 'description' : 'If the poller is alive or not',
1759 'depythonize' : from_bool_to_int
,
1766 'ReactionnerLink' : {
1768 'description' : 'The name of the reactionner',
1769 'prop' : 'reactionner_name',
1773 'description' : 'The ip or dns adress of the reactionner',
1778 'description' : 'The TCP port of the reactionner',
1783 'description' : 'If the reactionner is a spare or not',
1784 'depythonize' : from_bool_to_int
,
1789 'description' : 'If the reactionner is alive or not',
1791 'depythonize' : from_bool_to_int
,
1800 'description' : 'The name of the broker',
1801 'prop' : 'broker_name',
1805 'description' : 'The ip or dns adress of the broker',
1810 'description' : 'The TCP port of the broker',
1815 'description' : 'If the broker is a spare or not',
1816 'depythonize' : from_bool_to_int
,
1821 'description' : 'If the broker is alive or not',
1823 'depythonize' : from_bool_to_int
,
1832 'description' : 'The source name of the problem (host or service)',
1835 'depythonize' : get_common_full_name
1838 'description' : 'List of what the source impact (list of hosts and services)',
1841 'depythonize' : from_svc_hst_distinct_lists
,
1849 'default' : 'nobody',
1850 'description' : 'The contact that scheduled the downtime',
1856 'description' : 'A comment text',
1862 'description' : 'The duration of the downtime in seconds',
1868 'description' : 'The end time of the downtime as UNIX timestamp',
1874 'description' : 'The time the entry was made as UNIX timestamp',
1880 'depythonize' : from_bool_to_int
,
1881 'description' : 'A 1 if the downtime is fixed, a 0 if it is flexible',
1885 'host_accept_passive_checks' : {
1887 'description' : 'Wether passive host checks are accepted (0/1)',
1891 'host_acknowledged' : {
1893 'description' : 'Wether the current host problem has been acknowledged (0/1)',
1897 'host_acknowledgement_type' : {
1899 'description' : 'Type of acknowledgement (0: none, 1: normal, 2: stick)',
1903 'host_action_url' : {
1905 'description' : 'An optional URL to custom actions or information about this host',
1909 'host_action_url_expanded' : {
1911 'description' : 'The same as action_url, but with the most important macros expanded',
1915 'host_active_checks_enabled' : {
1917 'description' : 'Wether active checks are enabled for the host (0/1)',
1923 'description' : 'IP address',
1929 'description' : 'An alias name for the host',
1933 'host_check_command' : {
1935 'description' : 'Nagios command for active host check of this host',
1939 'host_check_freshness' : {
1941 'description' : 'Wether freshness checks are activated (0/1)',
1945 'host_check_interval' : {
1947 'description' : 'Number of basic interval lengths between two scheduled checks of the host',
1951 'host_check_options' : {
1953 'description' : 'The current check option, forced, normal, freshness... (0-2)',
1957 'host_check_period' : {
1959 'description' : 'Time period in which this host will be checked. If empty then the host will always be checked.',
1963 'host_check_type' : {
1965 'description' : 'Type of check (0: active, 1: passive)',
1969 'host_checks_enabled' : {
1971 'description' : 'Wether checks of the host are enabled (0/1)',
1977 'description' : 'A list of all direct childs of the host',
1983 'description' : 'A list of the ids of all comments of this host',
1989 'description' : 'A list of all contacts of this host, either direct or via a contact group',
1993 'host_current_attempt' : {
1995 'description' : 'Number of the current check attempts',
1999 'host_current_notification_number' : {
2001 'description' : 'Number of the current notification',
2005 'host_custom_variable_names' : {
2007 'description' : 'A list of the names of all custom variables',
2011 'host_custom_variable_values' : {
2013 'description' : 'A list of the values of the custom variables',
2017 'host_display_name' : {
2019 'description' : 'Optional display name of the host - not used by Nagios\' web interface',
2023 'host_downtimes' : {
2025 'description' : 'A list of the ids of all scheduled downtimes of this host',
2029 'host_event_handler_enabled' : {
2031 'description' : 'Wether event handling is enabled (0/1)',
2035 'host_execution_time' : {
2037 'description' : 'Time the host check needed for execution',
2041 'host_first_notification_delay' : {
2043 'description' : 'Delay before the first notification',
2047 'host_flap_detection_enabled' : {
2049 'description' : 'Wether flap detection is enabled (0/1)',
2055 'description' : 'A list of all host groups this host is in',
2059 'host_hard_state' : {
2061 'description' : 'The effective hard state of the host (eliminates a problem in hard_state)',
2065 'host_has_been_checked' : {
2067 'description' : 'Wether the host has already been checked (0/1)',
2071 'host_high_flap_threshold' : {
2073 'description' : 'High threshold of flap detection',
2077 'host_icon_image' : {
2079 'description' : 'The name of an image file to be used in the web pages',
2083 'host_icon_image_alt' : {
2085 'description' : 'Alternative text for the icon_image',
2089 'host_icon_image_expanded' : {
2091 'description' : 'The same as icon_image, but with the most important macros expanded',
2095 'host_in_check_period' : {
2097 'description' : 'Wether this host is currently in its check period (0/1)',
2101 'host_in_notification_period' : {
2103 'description' : 'Wether this host is currently in its notification period (0/1)',
2107 'host_initial_state' : {
2109 'description' : 'Initial host state',
2113 'host_is_executing' : {
2114 'default' : 0, # value in scheduler is not real-time
2115 'description' : 'is there a host check currently running... (0/1)',
2119 'host_is_flapping' : {
2121 'description' : 'Wether the host state is flapping (0/1)',
2125 'host_last_check' : {
2127 'description' : 'Time of the last check (Unix timestamp)',
2131 'host_last_hard_state' : {
2133 'description' : 'Last hard state',
2137 'host_last_hard_state_change' : {
2139 'description' : 'Time of the last hard state change (Unix timestamp)',
2143 'host_last_notification' : {
2145 'description' : 'Time of the last notification (Unix timestamp)',
2149 'host_last_state' : {
2151 'description' : 'State before last state change',
2155 'host_last_state_change' : {
2157 'description' : 'Time of the last state change - soft or hard (Unix timestamp)',
2163 'description' : 'Time difference between scheduled check time and actual check time',
2167 'host_long_plugin_output' : {
2169 'description' : 'Complete output from check plugin',
2173 'host_low_flap_threshold' : {
2175 'description' : 'Low threshold of flap detection',
2179 'host_max_check_attempts' : {
2181 'description' : 'Max check attempts for active host checks',
2187 'depythonize' : lambda x
: x
.host_name
,
2188 'description' : 'Host name',
2192 'host_next_check' : {
2194 'description' : 'Scheduled time for the next check (Unix timestamp)',
2198 'host_next_notification' : {
2200 'description' : 'Time of the next notification (Unix timestamp)',
2206 'description' : 'Optional notes for this host',
2210 'host_notes_expanded' : {
2212 'description' : 'The same as notes, but with the most important macros expanded',
2216 'host_notes_url' : {
2218 'description' : 'An optional URL with further information about the host',
2222 'host_notes_url_expanded' : {
2224 'description' : 'Same es notes_url, but with the most important macros expanded',
2228 'host_notification_interval' : {
2230 'description' : 'Interval of periodic notification or 0 if its off',
2234 'host_notification_period' : {
2236 'description' : 'Time period in which problems of this host will be notified. If empty then notification will be always',
2240 'host_notifications_enabled' : {
2242 'description' : 'Wether notifications of the host are enabled (0/1)',
2246 'host_num_services' : {
2248 'description' : 'The total number of services of the host',
2252 'host_num_services_crit' : {
2254 'description' : 'The number of the host\'s services with the soft state CRIT',
2258 'host_num_services_hard_crit' : {
2260 'description' : 'The number of the host\'s services with the hard state CRIT',
2264 'host_num_services_hard_ok' : {
2266 'description' : 'The number of the host\'s services with the hard state OK',
2270 'host_num_services_hard_unknown' : {
2272 'description' : 'The number of the host\'s services with the hard state UNKNOWN',
2276 'host_num_services_hard_warn' : {
2278 'description' : 'The number of the host\'s services with the hard state WARN',
2282 'host_num_services_ok' : {
2284 'description' : 'The number of the host\'s services with the soft state OK',
2288 'host_num_services_pending' : {
2290 'description' : 'The number of the host\'s services which have not been checked yet (pending)',
2294 'host_num_services_unknown' : {
2296 'description' : 'The number of the host\'s services with the soft state UNKNOWN',
2300 'host_num_services_warn' : {
2302 'description' : 'The number of the host\'s services with the soft state WARN',
2306 'host_obsess_over_host' : {
2308 'description' : 'The current obsess_over_host setting... (0/1)',
2314 'description' : 'A list of all direct parents of the host',
2318 'host_pending_flex_downtime' : {
2320 'description' : 'Wether a flex downtime is pending (0/1)',
2324 'host_percent_state_change' : {
2326 'description' : 'Percent state change',
2330 'host_perf_data' : {
2332 'description' : 'Optional performance data of the last host check',
2336 'host_plugin_output' : {
2338 'description' : 'Output of the last host check',
2342 'host_process_performance_data' : {
2344 'description' : 'Wether processing of performance data is enabled (0/1)',
2348 'host_retry_interval' : {
2350 'description' : 'Number of basic interval lengths between checks when retrying after a soft error',
2354 'host_scheduled_downtime_depth' : {
2356 'description' : 'The number of downtimes this host is currently in',
2362 'description' : 'The current state of the host (0: up, 1: down, 2: unreachable)',
2366 'host_state_type' : {
2368 'description' : 'Type of the current state (0: soft, 1: hard)',
2372 'host_statusmap_image' : {
2374 'description' : 'The name of in image file for the status map',
2378 'host_total_services' : {
2380 'description' : 'The total number of services of the host',
2384 'host_worst_service_hard_state' : {
2386 'description' : 'The worst hard state of all of the host\'s services (OK <= WARN <= UNKNOWN <= CRIT)',
2390 'host_worst_service_state' : {
2392 'description' : 'The worst soft state of all of the host\'s services (OK <= WARN <= UNKNOWN <= CRIT)',
2398 'description' : '3D-Coordinates: X',
2404 'description' : '3D-Coordinates: Y',
2410 'description' : '3D-Coordinates: Z',
2416 'description' : 'The id of the downtime',
2420 'service_accept_passive_checks' : {
2422 'description' : 'Wether the service accepts passive checks (0/1)',
2426 'service_acknowledged' : {
2428 'description' : 'Wether the current service problem has been acknowledged (0/1)',
2432 'service_acknowledgement_type' : {
2434 'description' : 'The type of the acknownledgement (0: none, 1: normal, 2: sticky)',
2438 'service_action_url' : {
2440 'description' : 'An optional URL for actions or custom information about the service',
2444 'service_action_url_expanded' : {
2446 'description' : 'The action_url with (the most important) macros expanded',
2450 'service_active_checks_enabled' : {
2452 'description' : 'Wether active checks are enabled for the service (0/1)',
2456 'service_check_command' : {
2458 'description' : 'Nagios command used for active checks',
2462 'service_check_interval' : {
2464 'description' : 'Number of basic interval lengths between two scheduled checks of the service',
2468 'service_check_options' : {
2470 'description' : 'The current check option, forced, normal, freshness... (0/1)',
2474 'service_check_period' : {
2476 'description' : 'The name of the check period of the service. It this is empty, the service is always checked.',
2480 'service_check_type' : {
2482 'description' : 'The type of the last check (0: active, 1: passive)',
2486 'service_checks_enabled' : {
2488 'description' : 'Wether active checks are enabled for the service (0/1)',
2492 'service_comments' : {
2494 'description' : 'A list of all comment ids of the service',
2498 'service_contacts' : {
2500 'description' : 'A list of all contacts of the service, either direct or via a contact group',
2504 'service_current_attempt' : {
2506 'description' : 'The number of the current check attempt',
2510 'service_current_notification_number' : {
2512 'description' : 'The number of the current notification',
2516 'service_custom_variable_names' : {
2518 'description' : 'A list of the names of all custom variables of the service',
2522 'service_custom_variable_values' : {
2524 'description' : 'A list of the values of all custom variable of the service',
2528 'service_description' : {
2530 'depythonize' : lambda x
: getattr(x
, 'service_description', ''),
2531 'description' : 'Description of the service (also used as key)',
2535 'service_display_name' : {
2537 'description' : 'An optional display name (not used by Nagios standard web pages)',
2541 'service_downtimes' : {
2543 'description' : 'A list of all downtime ids of the service',
2547 'service_event_handler' : {
2549 'description' : 'Nagios command used as event handler',
2553 'service_event_handler_enabled' : {
2555 'description' : 'Wether and event handler is activated for the service (0/1)',
2559 'service_execution_time' : {
2561 'description' : 'Time the host check needed for execution',
2565 'service_first_notification_delay' : {
2567 'description' : 'Delay before the first notification',
2571 'service_flap_detection_enabled' : {
2573 'description' : 'Wether flap detection is enabled for the service (0/1)',
2577 'service_groups' : {
2579 'description' : 'A list of all service groups the service is in',
2583 'service_has_been_checked' : {
2585 'description' : 'Wether the service already has been checked (0/1)',
2589 'service_high_flap_threshold' : {
2591 'description' : 'High threshold of flap detection',
2595 'service_icon_image' : {
2597 'description' : 'The name of an image to be used as icon in the web interface',
2601 'service_icon_image_alt' : {
2603 'description' : 'An alternative text for the icon_image for browsers not displaying icons',
2607 'service_icon_image_expanded' : {
2609 'description' : 'The icon_image with (the most important) macros expanded',
2613 'service_in_check_period' : {
2615 'description' : 'Wether the service is currently in its check period (0/1)',
2619 'service_in_notification_period' : {
2621 'description' : 'Wether the service is currently in its notification period (0/1)',
2625 'service_initial_state' : {
2627 'description' : 'The initial state of the service',
2631 'service_is_executing' : {
2632 'default' : 0, # value in scheduler is not real-time
2633 'description' : 'is there a service check currently running... (0/1)',
2637 'service_is_flapping' : {
2639 'description' : 'Wether the service is flapping (0/1)',
2643 'service_last_check' : {
2645 'description' : 'The time of the last check (Unix timestamp)',
2649 'service_last_hard_state' : {
2651 'description' : 'The last hard state of the service',
2655 'service_last_hard_state_change' : {
2657 'description' : 'The time of the last hard state change (Unix timestamp)',
2661 'service_last_notification' : {
2663 'description' : 'The time of the last notification (Unix timestamp)',
2667 'service_last_state' : {
2669 'description' : 'The last state of the service',
2673 'service_last_state_change' : {
2675 'description' : 'The time of the last state change (Unix timestamp)',
2679 'service_latency' : {
2681 'description' : 'Time difference between scheduled check time and actual check time',
2685 'service_long_plugin_output' : {
2687 'description' : 'Unabbreviated output of the last check plugin',
2691 'service_low_flap_threshold' : {
2693 'description' : 'Low threshold of flap detection',
2697 'service_max_check_attempts' : {
2699 'description' : 'The maximum number of check attempts',
2703 'service_next_check' : {
2705 'description' : 'The scheduled time of the next check (Unix timestamp)',
2709 'service_next_notification' : {
2711 'description' : 'The time of the next notification (Unix timestamp)',
2717 'description' : 'Optional notes about the service',
2721 'service_notes_expanded' : {
2723 'description' : 'The notes with (the most important) macros expanded',
2727 'service_notes_url' : {
2729 'description' : 'An optional URL for additional notes about the service',
2733 'service_notes_url_expanded' : {
2735 'description' : 'The notes_url with (the most important) macros expanded',
2739 'service_notification_interval' : {
2741 'description' : 'Interval of periodic notification or 0 if its off',
2745 'service_notification_period' : {
2747 'description' : 'The name of the notification period of the service. It this is empty, service problems are always notified.',
2751 'service_notifications_enabled' : {
2753 'description' : 'Wether notifications are enabled for the service (0/1)',
2757 'service_obsess_over_service' : {
2759 'description' : 'Wether \'obsess_over_service\' is enabled for the service (0/1)',
2763 'service_percent_state_change' : {
2765 'description' : 'Percent state change',
2769 'service_perf_data' : {
2771 'description' : 'Performance data of the last check plugin',
2775 'service_plugin_output' : {
2777 'description' : 'Output of the last check plugin',
2781 'service_process_performance_data' : {
2783 'description' : 'Wether processing of performance data is enabled for the service (0/1)',
2787 'service_retry_interval' : {
2789 'description' : 'Number of basic interval lengths between checks when retrying after a soft error',
2793 'service_scheduled_downtime_depth' : {
2795 'description' : 'The number of scheduled downtimes the service is currently in',
2801 'description' : 'The current state of the service (0: OK, 1: WARN, 2: CRITICAL, 3: UNKNOWN)',
2805 'service_state_type' : {
2807 'description' : 'The type of the current state (0: soft, 1: hard)',
2813 'description' : 'The start time of the downtime as UNIX timestamp',
2819 'description' : 'The id of the downtime this downtime was triggered by or 0 if it was not triggered by another downtime',
2820 'prop' : 'trigger_id',
2825 'description' : 'The type of the downtime: 0 if it is active, 1 if it is pending',
2836 'description' : 'The contact that entered the comment',
2842 'description' : 'A comment text',
2848 'description' : 'The time the entry was made as UNIX timestamp',
2854 'description' : 'The type of the comment: 1 is user, 2 is downtime, 3 is flap and 4 is acknowledgement',
2855 'prop' : 'entry_type',
2860 'description' : 'The time of expiry of this comment as a UNIX timestamp',
2866 'depythonize' : from_bool_to_int
,
2867 'description' : 'Whether this comment expires',
2871 'host_accept_passive_checks' : {
2873 'description' : 'Wether passive host checks are accepted (0/1)',
2877 'host_acknowledged' : {
2879 'description' : 'Wether the current host problem has been acknowledged (0/1)',
2883 'host_acknowledgement_type' : {
2885 'description' : 'Type of acknowledgement (0: none, 1: normal, 2: stick)',
2889 'host_action_url' : {
2891 'description' : 'An optional URL to custom actions or information about this host',
2895 'host_action_url_expanded' : {
2897 'description' : 'The same as action_url, but with the most important macros expanded',
2901 'host_active_checks_enabled' : {
2903 'description' : 'Wether active checks are enabled for the host (0/1)',
2909 'description' : 'IP address',
2915 'description' : 'An alias name for the host',
2919 'host_check_command' : {
2921 'description' : 'Nagios command for active host check of this host',
2925 'host_check_freshness' : {
2927 'description' : 'Wether freshness checks are activated (0/1)',
2931 'host_check_interval' : {
2933 'description' : 'Number of basic interval lengths between two scheduled checks of the host',
2937 'host_check_options' : {
2939 'description' : 'The current check option, forced, normal, freshness... (0-2)',
2943 'host_check_period' : {
2945 'description' : 'Time period in which this host will be checked. If empty then the host will always be checked.',
2949 'host_check_type' : {
2951 'description' : 'Type of check (0: active, 1: passive)',
2955 'host_checks_enabled' : {
2957 'description' : 'Wether checks of the host are enabled (0/1)',
2963 'description' : 'A list of all direct childs of the host',
2969 'description' : 'A list of the ids of all comments of this host',
2975 'description' : 'A list of all contacts of this host, either direct or via a contact group',
2979 'host_current_attempt' : {
2981 'description' : 'Number of the current check attempts',
2985 'host_current_notification_number' : {
2987 'description' : 'Number of the current notification',
2991 'host_custom_variable_names' : {
2993 'description' : 'A list of the names of all custom variables',
2997 'host_custom_variable_values' : {
2999 'description' : 'A list of the values of the custom variables',
3003 'host_display_name' : {
3005 'description' : 'Optional display name of the host - not used by Nagios\' web interface',
3009 'host_downtimes' : {
3011 'description' : 'A list of the ids of all scheduled downtimes of this host',
3015 'host_event_handler_enabled' : {
3017 'description' : 'Wether event handling is enabled (0/1)',
3021 'host_execution_time' : {
3023 'description' : 'Time the host check needed for execution',
3027 'host_first_notification_delay' : {
3029 'description' : 'Delay before the first notification',
3033 'host_flap_detection_enabled' : {
3035 'description' : 'Wether flap detection is enabled (0/1)',
3041 'description' : 'A list of all host groups this host is in',
3045 'host_hard_state' : {
3047 'description' : 'The effective hard state of the host (eliminates a problem in hard_state)',
3051 'host_has_been_checked' : {
3053 'description' : 'Wether the host has already been checked (0/1)',
3057 'host_high_flap_threshold' : {
3059 'description' : 'High threshold of flap detection',
3063 'host_icon_image' : {
3065 'description' : 'The name of an image file to be used in the web pages',
3069 'host_icon_image_alt' : {
3071 'description' : 'Alternative text for the icon_image',
3075 'host_icon_image_expanded' : {
3077 'description' : 'The same as icon_image, but with the most important macros expanded',
3081 'host_in_check_period' : {
3083 'description' : 'Wether this host is currently in its check period (0/1)',
3087 'host_in_notification_period' : {
3089 'description' : 'Wether this host is currently in its notification period (0/1)',
3093 'host_initial_state' : {
3095 'description' : 'Initial host state',
3099 'host_is_executing' : {
3100 'default' : 0, # value in scheduler is not real-time
3101 'description' : 'is there a host check currently running... (0/1)',
3105 'host_is_flapping' : {
3107 'description' : 'Wether the host state is flapping (0/1)',
3111 'host_last_check' : {
3113 'description' : 'Time of the last check (Unix timestamp)',
3117 'host_last_hard_state' : {
3119 'description' : 'Last hard state',
3123 'host_last_hard_state_change' : {
3125 'description' : 'Time of the last hard state change (Unix timestamp)',
3129 'host_last_notification' : {
3131 'description' : 'Time of the last notification (Unix timestamp)',
3135 'host_last_state' : {
3137 'description' : 'State before last state change',
3141 'host_last_state_change' : {
3143 'description' : 'Time of the last state change - soft or hard (Unix timestamp)',
3149 'description' : 'Time difference between scheduled check time and actual check time',
3153 'host_long_plugin_output' : {
3155 'description' : 'Complete output from check plugin',
3159 'host_low_flap_threshold' : {
3161 'description' : 'Low threshold of flap detection',
3165 'host_max_check_attempts' : {
3167 'description' : 'Max check attempts for active host checks',
3173 'depythonize' : lambda x
: x
.host_name
,
3174 'description' : 'Host name',
3178 'host_next_check' : {
3180 'description' : 'Scheduled time for the next check (Unix timestamp)',
3184 'host_next_notification' : {
3186 'description' : 'Time of the next notification (Unix timestamp)',
3192 'description' : 'Optional notes for this host',
3196 'host_notes_expanded' : {
3198 'description' : 'The same as notes, but with the most important macros expanded',
3202 'host_notes_url' : {
3204 'description' : 'An optional URL with further information about the host',
3208 'host_notes_url_expanded' : {
3210 'description' : 'Same es notes_url, but with the most important macros expanded',
3214 'host_notification_interval' : {
3216 'description' : 'Interval of periodic notification or 0 if its off',
3220 'host_notification_period' : {
3222 'description' : 'Time period in which problems of this host will be notified. If empty then notification will be always',
3226 'host_notifications_enabled' : {
3228 'description' : 'Wether notifications of the host are enabled (0/1)',
3232 'host_num_services' : {
3234 'description' : 'The total number of services of the host',
3238 'host_num_services_crit' : {
3240 'description' : 'The number of the host\'s services with the soft state CRIT',
3244 'host_num_services_hard_crit' : {
3246 'description' : 'The number of the host\'s services with the hard state CRIT',
3250 'host_num_services_hard_ok' : {
3252 'description' : 'The number of the host\'s services with the hard state OK',
3256 'host_num_services_hard_unknown' : {
3258 'description' : 'The number of the host\'s services with the hard state UNKNOWN',
3262 'host_num_services_hard_warn' : {
3264 'description' : 'The number of the host\'s services with the hard state WARN',
3268 'host_num_services_ok' : {
3270 'description' : 'The number of the host\'s services with the soft state OK',
3274 'host_num_services_pending' : {
3276 'description' : 'The number of the host\'s services which have not been checked yet (pending)',
3280 'host_num_services_unknown' : {
3282 'description' : 'The number of the host\'s services with the soft state UNKNOWN',
3286 'host_num_services_warn' : {
3288 'description' : 'The number of the host\'s services with the soft state WARN',
3292 'host_obsess_over_host' : {
3294 'description' : 'The current obsess_over_host setting... (0/1)',
3300 'description' : 'A list of all direct parents of the host',
3304 'host_pending_flex_downtime' : {
3306 'description' : 'Wether a flex downtime is pending (0/1)',
3310 'host_percent_state_change' : {
3312 'description' : 'Percent state change',
3316 'host_perf_data' : {
3318 'description' : 'Optional performance data of the last host check',
3322 'host_plugin_output' : {
3324 'description' : 'Output of the last host check',
3328 'host_process_performance_data' : {
3330 'description' : 'Wether processing of performance data is enabled (0/1)',
3334 'host_retry_interval' : {
3336 'description' : 'Number of basic interval lengths between checks when retrying after a soft error',
3340 'host_scheduled_downtime_depth' : {
3342 'description' : 'The number of downtimes this host is currently in',
3348 'description' : 'The current state of the host (0: up, 1: down, 2: unreachable)',
3352 'host_state_type' : {
3354 'description' : 'Type of the current state (0: soft, 1: hard)',
3358 'host_statusmap_image' : {
3360 'description' : 'The name of in image file for the status map',
3364 'host_total_services' : {
3366 'description' : 'The total number of services of the host',
3370 'host_worst_service_hard_state' : {
3372 'description' : 'The worst hard state of all of the host\'s services (OK <= WARN <= UNKNOWN <= CRIT)',
3376 'host_worst_service_state' : {
3378 'description' : 'The worst soft state of all of the host\'s services (OK <= WARN <= UNKNOWN <= CRIT)',
3384 'description' : '3D-Coordinates: X',
3390 'description' : '3D-Coordinates: Y',
3396 'description' : '3D-Coordinates: Z',
3402 'description' : 'The id of the comment',
3408 'depythonize' : from_bool_to_int
,
3409 'description' : 'Whether this comment is persistent (0/1)',
3413 'service_accept_passive_checks' : {
3415 'description' : 'Wether the service accepts passive checks (0/1)',
3419 'service_acknowledged' : {
3421 'description' : 'Wether the current service problem has been acknowledged (0/1)',
3425 'service_acknowledgement_type' : {
3427 'description' : 'The type of the acknownledgement (0: none, 1: normal, 2: sticky)',
3431 'service_action_url' : {
3433 'description' : 'An optional URL for actions or custom information about the service',
3437 'service_action_url_expanded' : {
3439 'description' : 'The action_url with (the most important) macros expanded',
3443 'service_active_checks_enabled' : {
3445 'description' : 'Wether active checks are enabled for the service (0/1)',
3449 'service_check_command' : {
3451 'description' : 'Nagios command used for active checks',
3455 'service_check_interval' : {
3457 'description' : 'Number of basic interval lengths between two scheduled checks of the service',
3461 'service_check_options' : {
3463 'description' : 'The current check option, forced, normal, freshness... (0/1)',
3467 'service_check_period' : {
3469 'description' : 'The name of the check period of the service. It this is empty, the service is always checked.',
3473 'service_check_type' : {
3475 'description' : 'The type of the last check (0: active, 1: passive)',
3479 'service_checks_enabled' : {
3481 'description' : 'Wether active checks are enabled for the service (0/1)',
3485 'service_comments' : {
3487 'description' : 'A list of all comment ids of the service',
3491 'service_contacts' : {
3493 'description' : 'A list of all contacts of the service, either direct or via a contact group',
3497 'service_current_attempt' : {
3499 'description' : 'The number of the current check attempt',
3503 'service_current_notification_number' : {
3505 'description' : 'The number of the current notification',
3509 'service_custom_variable_names' : {
3511 'description' : 'A list of the names of all custom variables of the service',
3515 'service_custom_variable_values' : {
3517 'description' : 'A list of the values of all custom variable of the service',
3521 'service_description' : {
3523 'depythonize' : lambda x
: getattr(x
, 'service_description', ''),
3524 'description' : 'Description of the service (also used as key)',
3528 'service_display_name' : {
3530 'description' : 'An optional display name (not used by Nagios standard web pages)',
3534 'service_downtimes' : {
3536 'description' : 'A list of all downtime ids of the service',
3540 'service_event_handler' : {
3542 'description' : 'Nagios command used as event handler',
3546 'service_event_handler_enabled' : {
3548 'description' : 'Wether and event handler is activated for the service (0/1)',
3552 'service_execution_time' : {
3554 'description' : 'Time the host check needed for execution',
3558 'service_first_notification_delay' : {
3560 'description' : 'Delay before the first notification',
3564 'service_flap_detection_enabled' : {
3566 'description' : 'Wether flap detection is enabled for the service (0/1)',
3570 'service_groups' : {
3572 'description' : 'A list of all service groups the service is in',
3576 'service_has_been_checked' : {
3578 'description' : 'Wether the service already has been checked (0/1)',
3582 'service_high_flap_threshold' : {
3584 'description' : 'High threshold of flap detection',
3588 'service_icon_image' : {
3590 'description' : 'The name of an image to be used as icon in the web interface',
3594 'service_icon_image_alt' : {
3596 'description' : 'An alternative text for the icon_image for browsers not displaying icons',
3600 'service_icon_image_expanded' : {
3602 'description' : 'The icon_image with (the most important) macros expanded',
3606 'service_in_check_period' : {
3608 'description' : 'Wether the service is currently in its check period (0/1)',
3612 'service_in_notification_period' : {
3614 'description' : 'Wether the service is currently in its notification period (0/1)',
3618 'service_initial_state' : {
3620 'description' : 'The initial state of the service',
3624 'service_is_executing' : {
3625 'default' : 0, # value in scheduler is not real-time
3626 'description' : 'is there a service check currently running... (0/1)',
3630 'service_is_flapping' : {
3632 'description' : 'Wether the service is flapping (0/1)',
3636 'service_last_check' : {
3638 'description' : 'The time of the last check (Unix timestamp)',
3642 'service_last_hard_state' : {
3644 'description' : 'The last hard state of the service',
3648 'service_last_hard_state_change' : {
3650 'description' : 'The time of the last hard state change (Unix timestamp)',
3654 'service_last_notification' : {
3656 'description' : 'The time of the last notification (Unix timestamp)',
3660 'service_last_state' : {
3662 'description' : 'The last state of the service',
3666 'service_last_state_change' : {
3668 'description' : 'The time of the last state change (Unix timestamp)',
3672 'service_latency' : {
3674 'description' : 'Time difference between scheduled check time and actual check time',
3678 'service_long_plugin_output' : {
3680 'description' : 'Unabbreviated output of the last check plugin',
3684 'service_low_flap_threshold' : {
3686 'description' : 'Low threshold of flap detection',
3690 'service_max_check_attempts' : {
3692 'description' : 'The maximum number of check attempts',
3696 'service_next_check' : {
3698 'description' : 'The scheduled time of the next check (Unix timestamp)',
3702 'service_next_notification' : {
3704 'description' : 'The time of the next notification (Unix timestamp)',
3710 'description' : 'Optional notes about the service',
3714 'service_notes_expanded' : {
3716 'description' : 'The notes with (the most important) macros expanded',
3720 'service_notes_url' : {
3722 'description' : 'An optional URL for additional notes about the service',
3726 'service_notes_url_expanded' : {
3728 'description' : 'The notes_url with (the most important) macros expanded',
3732 'service_notification_interval' : {
3734 'description' : 'Interval of periodic notification or 0 if its off',
3738 'service_notification_period' : {
3740 'description' : 'The name of the notification period of the service. It this is empty, service problems are always notified.',
3744 'service_notifications_enabled' : {
3746 'description' : 'Wether notifications are enabled for the service (0/1)',
3750 'service_obsess_over_service' : {
3752 'description' : 'Wether \'obsess_over_service\' is enabled for the service (0/1)',
3756 'service_percent_state_change' : {
3758 'description' : 'Percent state change',
3762 'service_perf_data' : {
3764 'description' : 'Performance data of the last check plugin',
3768 'service_plugin_output' : {
3770 'description' : 'Output of the last check plugin',
3774 'service_process_performance_data' : {
3776 'description' : 'Wether processing of performance data is enabled for the service (0/1)',
3780 'service_retry_interval' : {
3782 'description' : 'Number of basic interval lengths between checks when retrying after a soft error',
3786 'service_scheduled_downtime_depth' : {
3788 'description' : 'The number of scheduled downtimes the service is currently in',
3794 'description' : 'The current state of the service (0: OK, 1: WARN, 2: CRITICAL, 3: UNKNOWN)',
3798 'service_state_type' : {
3800 'description' : 'The type of the current state (0: soft, 1: hard)',
3806 'description' : 'The source of the comment (0 is internal and 1 is external)',
3812 'description' : 'The type of the comment: 1 is service, 2 is host',
3813 'prop' : 'comment_type',
3818 # loop over hostgroups then over members
3820 'hostgroup_action_url' : {
3821 'description' : 'An optional URL to custom actions or information about the hostgroup',
3822 'prop' : 'hostgroup',
3825 'hostgroup_alias' : {
3826 'description' : 'An alias of the hostgroup',
3827 'prop' : 'hostgroup',
3830 'hostgroup_members' : {
3831 'description' : 'A list of all host names that are members of the hostgroup',
3832 'prop' : 'hostgroup',
3835 'hostgroup_members_with_state' : {
3836 'description' : 'A list of all host names that are members of the hostgroup together with state and has_been_checked',
3837 'prop' : 'hostgroup',
3840 'hostgroup_name' : {
3841 'depythonize' : lambda x
: getattr(x
, 'hostgroup_name', ''),
3842 'description' : 'Name of the hostgroup',
3843 'prop' : 'hostgroup',
3846 'hostgroup_notes' : {
3847 'description' : 'Optional notes to the hostgroup',
3848 'prop' : 'hostgroup',
3851 'hostgroup_notes_url' : {
3852 'description' : 'An optional URL with further information about the hostgroup',
3853 'prop' : 'hostgroup',
3856 'hostgroup_num_hosts' : {
3857 'description' : 'The total number of hosts in the group',
3858 'prop' : 'hostgroup',
3861 'hostgroup_num_hosts_down' : {
3862 'description' : 'The number of hosts in the group that are down',
3863 'prop' : 'hostgroup',
3866 'hostgroup_num_hosts_pending' : {
3867 'description' : 'The number of hosts in the group that are pending',
3868 'prop' : 'hostgroup',
3871 'hostgroup_num_hosts_unreach' : {
3872 'description' : 'The number of hosts in the group that are unreachable',
3873 'prop' : 'hostgroup',
3876 'hostgroup_num_hosts_up' : {
3877 'description' : 'The number of hosts in the group that are up',
3878 'prop' : 'hostgroup',
3881 'hostgroup_num_services' : {
3882 'description' : 'The total number of services of hosts in this group',
3883 'prop' : 'hostgroup',
3886 'hostgroup_num_services_crit' : {
3887 'description' : 'The total number of services with the state CRIT of hosts in this group',
3888 'prop' : 'hostgroup',
3891 'hostgroup_num_services_hard_crit' : {
3892 'description' : 'The total number of services with the state CRIT of hosts in this group',
3893 'prop' : 'hostgroup',
3896 'hostgroup_num_services_hard_ok' : {
3897 'description' : 'The total number of services with the state OK of hosts in this group',
3898 'prop' : 'hostgroup',
3901 'hostgroup_num_services_hard_unknown' : {
3902 'description' : 'The total number of services with the state UNKNOWN of hosts in this group',
3903 'prop' : 'hostgroup',
3906 'hostgroup_num_services_hard_warn' : {
3907 'description' : 'The total number of services with the state WARN of hosts in this group',
3908 'prop' : 'hostgroup',
3911 'hostgroup_num_services_ok' : {
3912 'description' : 'The total number of services with the state OK of hosts in this group',
3913 'prop' : 'hostgroup',
3916 'hostgroup_num_services_pending' : {
3917 'description' : 'The total number of services with the state Pending of hosts in this group',
3918 'prop' : 'hostgroup',
3921 'hostgroup_num_services_unknown' : {
3922 'description' : 'The total number of services with the state UNKNOWN of hosts in this group',
3923 'prop' : 'hostgroup',
3926 'hostgroup_num_services_warn' : {
3927 'description' : 'The total number of services with the state WARN of hosts in this group',
3928 'prop' : 'hostgroup',
3931 'hostgroup_worst_host_state' : {
3932 'description' : 'The worst state of all of the groups\' hosts (UP <= UNREACHABLE <= DOWN)',
3933 'prop' : 'hostgroup',
3936 'hostgroup_worst_service_hard_state' : {
3937 'description' : 'The worst state of all services that belong to a host of this group (OK <= WARN <= UNKNOWN <= CRIT)',
3938 'prop' : 'hostgroup',
3941 'hostgroup_worst_service_state' : {
3942 'description' : 'The worst state of all services that belong to a host of this group (OK <= WARN <= UNKNOWN <= CRIT)',
3943 'prop' : 'hostgroup',
3948 'Servicesbygroup' : {
3949 'servicegroup_action_url' : {
3950 'description' : 'An optional URL to custom notes or actions on the service group',
3953 'servicegroup_alias' : {
3954 'description' : 'An alias of the service group',
3957 'servicegroup_members' : {
3958 'description' : 'A list of all members of the service group as host/service pairs',
3961 'servicegroup_members_with_state' : {
3962 'description' : 'A list of all members of the service group with state and has_been_checked',
3965 'servicegroup_name' : {
3966 'description' : 'The name of the service group',
3969 'servicegroup_notes' : {
3970 'description' : 'Optional additional notes about the service group',
3973 'servicegroup_notes_url' : {
3974 'description' : 'An optional URL to further notes on the service group',
3977 'servicegroup_num_services' : {
3978 'description' : 'The total number of services in the group',
3981 'servicegroup_num_services_crit' : {
3982 'description' : 'The number of services in the group that are CRIT',
3985 'servicegroup_num_services_hard_crit' : {
3986 'description' : 'The number of services in the group that are CRIT',
3989 'servicegroup_num_services_hard_ok' : {
3990 'description' : 'The number of services in the group that are OK',
3993 'servicegroup_num_services_hard_unknown' : {
3994 'description' : 'The number of services in the group that are UNKNOWN',
3997 'servicegroup_num_services_hard_warn' : {
3998 'description' : 'The number of services in the group that are WARN',
4001 'servicegroup_num_services_ok' : {
4002 'description' : 'The number of services in the group that are OK',
4005 'servicegroup_num_services_pending' : {
4006 'description' : 'The number of services in the group that are PENDING',
4009 'servicegroup_num_services_unknown' : {
4010 'description' : 'The number of services in the group that are UNKNOWN',
4013 'servicegroup_num_services_warn' : {
4014 'description' : 'The number of services in the group that are WARN',
4017 'servicegroup_worst_service_state' : {
4018 'description' : 'The worst soft state of all of the groups services (OK <= WARN <= UNKNOWN <= CRIT)',
4023 'Servicesbyhostgroup' : {
4024 'hostgroup_action_url' : {
4025 'description' : 'An optional URL to custom actions or information about the hostgroup',
4028 'hostgroup_alias' : {
4029 'description' : 'An alias of the hostgroup',
4032 'hostgroup_members' : {
4033 'description' : 'A list of all host names that are members of the hostgroup',
4036 'hostgroup_members_with_state' : {
4037 'description' : 'A list of all host names that are members of the hostgroup together with state and has_been_checked',
4040 'hostgroup_name' : {
4041 'depythonize' : lambda x
: getattr(x
, 'hostgroup_name', ''),
4042 'description' : 'Name of the hostgroup',
4043 'prop' : 'hostgroup',
4046 'hostgroup_notes' : {
4047 'description' : 'Optional notes to the hostgroup',
4050 'hostgroup_notes_url' : {
4051 'description' : 'An optional URL with further information about the hostgroup',
4054 'hostgroup_num_hosts' : {
4055 'description' : 'The total number of hosts in the group',
4058 'hostgroup_num_hosts_down' : {
4059 'description' : 'The number of hosts in the group that are down',
4062 'hostgroup_num_hosts_pending' : {
4063 'description' : 'The number of hosts in the group that are pending',
4066 'hostgroup_num_hosts_unreach' : {
4067 'description' : 'The number of hosts in the group that are unreachable',
4070 'hostgroup_num_hosts_up' : {
4071 'description' : 'The number of hosts in the group that are up',
4074 'hostgroup_num_services' : {
4075 'description' : 'The total number of services of hosts in this group',
4078 'hostgroup_num_services_crit' : {
4079 'description' : 'The total number of services with the state CRIT of hosts in this group',
4082 'hostgroup_num_services_hard_crit' : {
4083 'description' : 'The total number of services with the state CRIT of hosts in this group',
4086 'hostgroup_num_services_hard_ok' : {
4087 'description' : 'The total number of services with the state OK of hosts in this group',
4090 'hostgroup_num_services_hard_unknown' : {
4091 'description' : 'The total number of services with the state UNKNOWN of hosts in this group',
4094 'hostgroup_num_services_hard_warn' : {
4095 'description' : 'The total number of services with the state WARN of hosts in this group',
4098 'hostgroup_num_services_ok' : {
4099 'description' : 'The total number of services with the state OK of hosts in this group',
4102 'hostgroup_num_services_pending' : {
4103 'description' : 'The total number of services with the state Pending of hosts in this group',
4106 'hostgroup_num_services_unknown' : {
4107 'description' : 'The total number of services with the state UNKNOWN of hosts in this group',
4110 'hostgroup_num_services_warn' : {
4111 'description' : 'The total number of services with the state WARN of hosts in this group',
4114 'hostgroup_worst_host_state' : {
4115 'description' : 'The worst state of all of the groups\' hosts (UP <= UNREACHABLE <= DOWN)',
4118 'hostgroup_worst_service_hard_state' : {
4119 'description' : 'The worst state of all services that belong to a host of this group (OK <= WARN <= UNKNOWN <= CRIT)',
4122 'hostgroup_worst_service_state' : {
4123 'description' : 'The worst state of all services that belong to a host of this group (OK <= WARN <= UNKNOWN <= CRIT)',
4128 #All the global config parameters
4131 'accept_passive_host_checks' : {
4133 'depythonize' : from_bool_to_int
,
4134 'description' : 'Whether passive host checks are accepted in general (0/1)',
4135 'prop' : 'passive_host_checks_enabled',
4138 'accept_passive_service_checks' : {
4140 'depythonize' : from_bool_to_int
,
4141 'description' : 'Whether passive service checks are activated in general (0/1)',
4142 'prop' : 'passive_service_checks_enabled',
4145 'cached_log_messages' : {
4147 'description' : 'The current number of log messages MK Livestatus keeps in memory',
4151 'check_external_commands' : {
4153 'depythonize' : from_bool_to_int
,
4154 'description' : 'Whether Nagios checks for external commands at its command pipe (0/1)',
4158 'check_host_freshness' : {
4160 'depythonize' : from_bool_to_int
,
4161 'description' : 'Whether host freshness checking is activated in general (0/1)',
4165 'check_service_freshness' : {
4167 'depythonize' : from_bool_to_int
,
4168 'description' : 'Whether service freshness checking is activated in general (0/1)',
4174 'description' : 'The number of client connections to Livestatus since program start',
4178 'connections_rate' : {
4180 'description' : 'The averaged number of new client connections to Livestatus per second',
4184 'enable_event_handlers' : {
4186 'depythonize' : from_bool_to_int
,
4187 'description' : 'Whether event handlers are activated in general (0/1)',
4188 'prop' : 'event_handlers_enabled',
4191 'enable_flap_detection' : {
4193 'depythonize' : from_bool_to_int
,
4194 'description' : 'Whether flap detection is activated in general (0/1)',
4195 'prop' : 'flap_detection_enabled',
4198 'enable_notifications' : {
4200 'depythonize' : from_bool_to_int
,
4201 'description' : 'Whether notifications are enabled in general (0/1)',
4202 'prop' : 'notifications_enabled',
4205 'execute_host_checks' : {
4207 'depythonize' : from_bool_to_int
,
4208 'description' : 'Whether host checks are executed in general (0/1)',
4209 'prop' : 'active_host_checks_enabled',
4212 'execute_service_checks' : {
4214 'depythonize' : from_bool_to_int
,
4215 'description' : 'Whether active service checks are activated in general (0/1)',
4216 'prop' : 'active_service_checks_enabled',
4221 'description' : 'The number of host checks since program start',
4225 'host_checks_rate' : {
4227 'description' : 'the averaged number of host checks per second',
4231 'interval_length' : {
4233 'description' : 'The default interval length from nagios.cfg',
4237 'last_command_check' : {
4239 'description' : 'The time of the last check for a command as UNIX timestamp',
4243 'last_log_rotation' : {
4245 'description' : 'Time time of the last log file rotation',
4249 'livestatus_version' : {
4250 'default' : '1.1.3',
4251 'description' : 'The version of the MK Livestatus module',
4257 'description' : 'The process ID of the Nagios main process',
4263 'description' : 'The number of NEB call backs since program start',
4267 'neb_callbacks_rate' : {
4269 'description' : 'The averaged number of NEB call backs per second',
4273 'obsess_over_hosts' : {
4275 'depythonize' : from_bool_to_int
,
4276 'description' : 'Whether Nagios will obsess over host checks (0/1)',
4280 'obsess_over_services' : {
4282 'depythonize' : from_bool_to_int
,
4283 'description' : 'Whether Nagios will obsess over service checks and run the ocsp_command (0/1)',
4287 'process_performance_data' : {
4289 'depythonize' : from_bool_to_int
,
4290 'description' : 'Whether processing of performance data is activated in general (0/1)',
4296 'description' : 'The time of the last program start as UNIX timestamp',
4300 'program_version' : {
4302 'description' : 'The version of the monitoring daemon',
4308 'description' : 'The number of requests to Livestatus since program start',
4314 'description' : 'The averaged number of request to Livestatus per second',
4318 'service_checks' : {
4320 'description' : 'The number of completed service checks since program start',
4324 'service_checks_rate' : {
4326 'description' : 'The averaged number of service checks per second',
4337 'description' : 'The number of the check attempt',
4341 'description' : 'The class of the message as integer (0:info, 1:state, 2:program, 3:notification, 4:passive, 5:command)',
4345 'description' : 'The name of the command of the log entry (e.g. for notifications)',
4349 'description' : 'A comment field used in various message types',
4353 'description' : 'The name of the contact the log entry is about (might be empty)',
4356 'current_command_line' : {
4357 'description' : 'The shell command line',
4360 'current_command_name' : {
4361 'description' : 'The name of the command',
4364 'current_contact_address1' : {
4365 'description' : 'The additional field address1',
4368 'current_contact_address2' : {
4369 'description' : 'The additional field address2',
4372 'current_contact_address3' : {
4373 'description' : 'The additional field address3',
4376 'current_contact_address4' : {
4377 'description' : 'The additional field address4',
4380 'current_contact_address5' : {
4381 'description' : 'The additional field address5',
4384 'current_contact_address6' : {
4385 'description' : 'The additional field address6',
4388 'current_contact_alias' : {
4389 'description' : 'The full name of the contact',
4392 'current_contact_can_submit_commands' : {
4393 'description' : 'Wether the contact is allowed to submit commands (0/1)',
4396 'current_contact_custom_variable_names' : {
4397 'description' : 'A list of all custom variables of the contact',
4400 'current_contact_custom_variable_values' : {
4401 'description' : 'A list of the values of all custom variables of the contact',
4404 'current_contact_email' : {
4405 'description' : 'The email address of the contact',
4408 'current_contact_host_notification_period' : {
4409 'description' : 'The time period in which the contact will be notified about host problems',
4412 'current_contact_host_notifications_enabled' : {
4413 'description' : 'Wether the contact will be notified about host problems in general (0/1)',
4416 'current_contact_in_host_notification_period' : {
4417 'description' : 'Wether the contact is currently in his/her host notification period (0/1)',
4420 'current_contact_in_service_notification_period' : {
4421 'description' : 'Wether the contact is currently in his/her service notification period (0/1)',
4424 'current_contact_name' : {
4425 'description' : 'The login name of the contact person',
4428 'current_contact_pager' : {
4429 'description' : 'The pager address of the contact',
4432 'current_contact_service_notification_period' : {
4433 'description' : 'The time period in which the contact will be notified about service problems',
4436 'current_contact_service_notifications_enabled' : {
4437 'description' : 'Wether the contact will be notified about service problems in general (0/1)',
4440 'current_host_accept_passive_checks' : {
4441 'description' : 'Wether passive host checks are accepted (0/1)',
4444 'current_host_acknowledged' : {
4445 'description' : 'Wether the current host problem has been acknowledged (0/1)',
4448 'current_host_acknowledgement_type' : {
4449 'description' : 'Type of acknowledgement (0: none, 1: normal, 2: stick)',
4452 'current_host_action_url' : {
4453 'description' : 'An optional URL to custom actions or information about this host',
4456 'current_host_action_url_expanded' : {
4457 'description' : 'The same as action_url, but with the most important macros expanded',
4460 'current_host_active_checks_enabled' : {
4461 'description' : 'Wether active checks are enabled for the host (0/1)',
4464 'current_host_address' : {
4465 'description' : 'IP address',
4468 'current_host_alias' : {
4469 'description' : 'An alias name for the host',
4472 'current_host_check_command' : {
4473 'description' : 'Nagios command for active host check of this host',
4476 'current_host_check_freshness' : {
4477 'description' : 'Wether freshness checks are activated (0/1)',
4480 'current_host_check_interval' : {
4481 'description' : 'Number of basic interval lengths between two scheduled checks of the host',
4484 'current_host_check_options' : {
4485 'description' : 'The current check option, forced, normal, freshness... (0-2)',
4488 'current_host_check_period' : {
4489 'description' : 'Time period in which this host will be checked. If empty then the host will always be checked.',
4492 'current_host_check_type' : {
4493 'description' : 'Type of check (0: active, 1: passive)',
4496 'current_host_checks_enabled' : {
4497 'description' : 'Wether checks of the host are enabled (0/1)',
4500 'current_host_childs' : {
4501 'description' : 'A list of all direct childs of the host',
4504 'current_host_comments' : {
4505 'description' : 'A list of the ids of all comments of this host',
4508 'current_host_contacts' : {
4509 'description' : 'A list of all contacts of this host, either direct or via a contact group',
4512 'current_host_current_attempt' : {
4513 'description' : 'Number of the current check attempts',
4516 'current_host_current_notification_number' : {
4517 'description' : 'Number of the current notification',
4520 'current_host_custom_variable_names' : {
4521 'description' : 'A list of the names of all custom variables',
4524 'current_host_custom_variable_values' : {
4525 'description' : 'A list of the values of the custom variables',
4528 'current_host_display_name' : {
4529 'description' : 'Optional display name of the host - not used by Nagios\' web interface',
4532 'current_host_downtimes' : {
4533 'description' : 'A list of the ids of all scheduled downtimes of this host',
4536 'current_host_event_handler_enabled' : {
4537 'description' : 'Wether event handling is enabled (0/1)',
4540 'current_host_execution_time' : {
4541 'description' : 'Time the host check needed for execution',
4544 'current_host_first_notification_delay' : {
4545 'description' : 'Delay before the first notification',
4548 'current_host_flap_detection_enabled' : {
4549 'description' : 'Wether flap detection is enabled (0/1)',
4552 'current_host_groups' : {
4553 'description' : 'A list of all host groups this host is in',
4556 'current_host_hard_state' : {
4557 'description' : 'The effective hard state of the host (eliminates a problem in hard_state)',
4560 'current_host_has_been_checked' : {
4561 'description' : 'Wether the host has already been checked (0/1)',
4564 'current_host_high_flap_threshold' : {
4565 'description' : 'High threshold of flap detection',
4568 'current_host_icon_image' : {
4569 'description' : 'The name of an image file to be used in the web pages',
4572 'current_host_icon_image_alt' : {
4573 'description' : 'Alternative text for the icon_image',
4576 'current_host_icon_image_expanded' : {
4577 'description' : 'The same as icon_image, but with the most important macros expanded',
4580 'current_host_in_check_period' : {
4581 'description' : 'Wether this host is currently in its check period (0/1)',
4584 'current_host_in_notification_period' : {
4585 'description' : 'Wether this host is currently in its notification period (0/1)',
4588 'current_host_initial_state' : {
4589 'description' : 'Initial host state',
4592 'current_host_is_executing' : {
4593 'default' : 0, # value in scheduler is not real-time
4594 'description' : 'is there a host check currently running... (0/1)',
4597 'current_host_is_flapping' : {
4598 'description' : 'Wether the host state is flapping (0/1)',
4601 'current_host_last_check' : {
4602 'description' : 'Time of the last check (Unix timestamp)',
4605 'current_host_last_hard_state' : {
4606 'description' : 'Last hard state',
4609 'current_host_last_hard_state_change' : {
4610 'description' : 'Time of the last hard state change (Unix timestamp)',
4613 'current_host_last_notification' : {
4614 'description' : 'Time of the last notification (Unix timestamp)',
4617 'current_host_last_state' : {
4618 'description' : 'State before last state change',
4621 'current_host_last_state_change' : {
4622 'description' : 'Time of the last state change - soft or hard (Unix timestamp)',
4625 'current_host_latency' : {
4626 'description' : 'Time difference between scheduled check time and actual check time',
4629 'current_host_long_plugin_output' : {
4630 'description' : 'Complete output from check plugin',
4633 'current_host_low_flap_threshold' : {
4634 'description' : 'Low threshold of flap detection',
4637 'current_host_max_check_attempts' : {
4638 'description' : 'Max check attempts for active host checks',
4641 'current_host_name' : {
4643 'depythonize' : lambda x
: x
.get_name(),
4644 'description' : 'Host name',
4645 'prop' : 'log_host',
4648 'current_host_next_check' : {
4649 'description' : 'Scheduled time for the next check (Unix timestamp)',
4652 'current_host_next_notification' : {
4653 'description' : 'Time of the next notification (Unix timestamp)',
4656 'current_host_notes' : {
4657 'description' : 'Optional notes for this host',
4660 'current_host_notes_expanded' : {
4661 'description' : 'The same as notes, but with the most important macros expanded',
4664 'current_host_notes_url' : {
4665 'description' : 'An optional URL with further information about the host',
4668 'current_host_notes_url_expanded' : {
4669 'description' : 'Same es notes_url, but with the most important macros expanded',
4672 'current_host_notification_interval' : {
4673 'description' : 'Interval of periodic notification or 0 if its off',
4676 'current_host_notification_period' : {
4677 'description' : 'Time period in which problems of this host will be notified. If empty then notification will be always',
4680 'current_host_notifications_enabled' : {
4681 'description' : 'Wether notifications of the host are enabled (0/1)',
4684 'current_host_num_services' : {
4685 'description' : 'The total number of services of the host',
4688 'current_host_num_services_crit' : {
4689 'description' : 'The number of the host\'s services with the soft state CRIT',
4692 'current_host_num_services_hard_crit' : {
4693 'description' : 'The number of the host\'s services with the hard state CRIT',
4696 'current_host_num_services_hard_ok' : {
4697 'description' : 'The number of the host\'s services with the hard state OK',
4700 'current_host_num_services_hard_unknown' : {
4701 'description' : 'The number of the host\'s services with the hard state UNKNOWN',
4704 'current_host_num_services_hard_warn' : {
4705 'description' : 'The number of the host\'s services with the hard state WARN',
4708 'current_host_num_services_ok' : {
4709 'description' : 'The number of the host\'s services with the soft state OK',
4712 'current_host_num_services_pending' : {
4713 'description' : 'The number of the host\'s services which have not been checked yet (pending)',
4716 'current_host_num_services_unknown' : {
4717 'description' : 'The number of the host\'s services with the soft state UNKNOWN',
4720 'current_host_num_services_warn' : {
4721 'description' : 'The number of the host\'s services with the soft state WARN',
4724 'current_host_obsess_over_host' : {
4725 'description' : 'The current obsess_over_host setting... (0/1)',
4728 'current_host_parents' : {
4729 'description' : 'A list of all direct parents of the host',
4732 'current_host_pending_flex_downtime' : {
4733 'description' : 'Wether a flex downtime is pending (0/1)',
4736 'current_host_percent_state_change' : {
4737 'description' : 'Percent state change',
4740 'current_host_perf_data' : {
4741 'description' : 'Optional performance data of the last host check',
4744 'current_host_plugin_output' : {
4745 'description' : 'Output of the last host check',
4748 'current_host_process_performance_data' : {
4749 'description' : 'Wether processing of performance data is enabled (0/1)',
4752 'current_host_retry_interval' : {
4753 'description' : 'Number of basic interval lengths between checks when retrying after a soft error',
4756 'current_host_scheduled_downtime_depth' : {
4757 'description' : 'The number of downtimes this host is currently in',
4760 'current_host_state' : {
4761 'description' : 'The current state of the host (0: up, 1: down, 2: unreachable)',
4764 'current_host_state_type' : {
4765 'description' : 'Type of the current state (0: soft, 1: hard)',
4768 'current_host_statusmap_image' : {
4769 'description' : 'The name of in image file for the status map',
4772 'current_host_total_services' : {
4773 'description' : 'The total number of services of the host',
4776 'current_host_worst_service_hard_state' : {
4777 'description' : 'The worst hard state of all of the host\'s services (OK <= WARN <= UNKNOWN <= CRIT)',
4780 'current_host_worst_service_state' : {
4781 'description' : 'The worst soft state of all of the host\'s services (OK <= WARN <= UNKNOWN <= CRIT)',
4784 'current_host_x_3d' : {
4785 'description' : '3D-Coordinates: X',
4788 'current_host_y_3d' : {
4789 'description' : '3D-Coordinates: Y',
4792 'current_host_z_3d' : {
4793 'description' : '3D-Coordinates: Z',
4796 'current_service_accept_passive_checks' : {
4797 'description' : 'Wether the service accepts passive checks (0/1)',
4800 'current_service_acknowledged' : {
4801 'description' : 'Wether the current service problem has been acknowledged (0/1)',
4804 'current_service_acknowledgement_type' : {
4805 'description' : 'The type of the acknownledgement (0: none, 1: normal, 2: sticky)',
4808 'current_service_action_url' : {
4809 'description' : 'An optional URL for actions or custom information about the service',
4812 'current_service_action_url_expanded' : {
4813 'description' : 'The action_url with (the most important) macros expanded',
4816 'current_service_active_checks_enabled' : {
4817 'description' : 'Wether active checks are enabled for the service (0/1)',
4820 'current_service_check_command' : {
4821 'description' : 'Nagios command used for active checks',
4824 'current_service_check_interval' : {
4825 'description' : 'Number of basic interval lengths between two scheduled checks of the service',
4828 'current_service_check_options' : {
4829 'description' : 'The current check option, forced, normal, freshness... (0/1)',
4832 'current_service_check_period' : {
4833 'description' : 'The name of the check period of the service. It this is empty, the service is always checked.',
4836 'current_service_check_type' : {
4837 'description' : 'The type of the last check (0: active, 1: passive)',
4840 'current_service_checks_enabled' : {
4841 'description' : 'Wether active checks are enabled for the service (0/1)',
4844 'current_service_comments' : {
4845 'description' : 'A list of all comment ids of the service',
4848 'current_service_contacts' : {
4849 'description' : 'A list of all contacts of the service, either direct or via a contact group',
4852 'current_service_current_attempt' : {
4853 'description' : 'The number of the current check attempt',
4856 'current_service_current_notification_number' : {
4857 'description' : 'The number of the current notification',
4860 'current_service_custom_variable_names' : {
4861 'description' : 'A list of the names of all custom variables of the service',
4864 'current_service_custom_variable_values' : {
4865 'description' : 'A list of the values of all custom variable of the service',
4868 'current_service_description' : {
4870 'depythonize' : lambda x
: x
.get_name(),
4871 'description' : 'Description of the service (also used as key)',
4872 'prop' : 'log_service',
4875 'current_service_display_name' : {
4876 'description' : 'An optional display name (not used by Nagios standard web pages)',
4879 'current_service_downtimes' : {
4880 'description' : 'A list of all downtime ids of the service',
4883 'current_service_event_handler' : {
4884 'description' : 'Nagios command used as event handler',
4887 'current_service_event_handler_enabled' : {
4888 'description' : 'Wether and event handler is activated for the service (0/1)',
4891 'current_service_execution_time' : {
4892 'description' : 'Time the host check needed for execution',
4895 'current_service_first_notification_delay' : {
4896 'description' : 'Delay before the first notification',
4899 'current_service_flap_detection_enabled' : {
4900 'description' : 'Wether flap detection is enabled for the service (0/1)',
4903 'current_service_groups' : {
4904 'description' : 'A list of all service groups the service is in',
4907 'current_service_has_been_checked' : {
4908 'description' : 'Wether the service already has been checked (0/1)',
4911 'current_service_high_flap_threshold' : {
4912 'description' : 'High threshold of flap detection',
4915 'current_service_icon_image' : {
4916 'description' : 'The name of an image to be used as icon in the web interface',
4919 'current_service_icon_image_alt' : {
4920 'description' : 'An alternative text for the icon_image for browsers not displaying icons',
4923 'current_service_icon_image_expanded' : {
4924 'description' : 'The icon_image with (the most important) macros expanded',
4927 'current_service_in_check_period' : {
4928 'description' : 'Wether the service is currently in its check period (0/1)',
4931 'current_service_in_notification_period' : {
4932 'description' : 'Wether the service is currently in its notification period (0/1)',
4935 'current_service_initial_state' : {
4936 'description' : 'The initial state of the service',
4939 'current_service_is_executing' : {
4940 'default' : 0, # value in scheduler is not real-time
4941 'description' : 'is there a service check currently running... (0/1)',
4944 'current_service_is_flapping' : {
4945 'description' : 'Wether the service is flapping (0/1)',
4948 'current_service_last_check' : {
4949 'description' : 'The time of the last check (Unix timestamp)',
4952 'current_service_last_hard_state' : {
4953 'description' : 'The last hard state of the service',
4956 'current_service_last_hard_state_change' : {
4957 'description' : 'The time of the last hard state change (Unix timestamp)',
4960 'current_service_last_notification' : {
4961 'description' : 'The time of the last notification (Unix timestamp)',
4964 'current_service_last_state' : {
4965 'description' : 'The last state of the service',
4968 'current_service_last_state_change' : {
4969 'description' : 'The time of the last state change (Unix timestamp)',
4972 'current_service_latency' : {
4973 'description' : 'Time difference between scheduled check time and actual check time',
4976 'current_service_long_plugin_output' : {
4977 'description' : 'Unabbreviated output of the last check plugin',
4980 'current_service_low_flap_threshold' : {
4981 'description' : 'Low threshold of flap detection',
4984 'current_service_max_check_attempts' : {
4985 'description' : 'The maximum number of check attempts',
4988 'current_service_next_check' : {
4989 'description' : 'The scheduled time of the next check (Unix timestamp)',
4992 'current_service_next_notification' : {
4993 'description' : 'The time of the next notification (Unix timestamp)',
4996 'current_service_notes' : {
4997 'description' : 'Optional notes about the service',
5000 'current_service_notes_expanded' : {
5001 'description' : 'The notes with (the most important) macros expanded',
5004 'current_service_notes_url' : {
5005 'description' : 'An optional URL for additional notes about the service',
5008 'current_service_notes_url_expanded' : {
5009 'description' : 'The notes_url with (the most important) macros expanded',
5012 'current_service_notification_interval' : {
5013 'description' : 'Interval of periodic notification or 0 if its off',
5016 'current_service_notification_period' : {
5017 'description' : 'The name of the notification period of the service. It this is empty, service problems are always notified.',
5020 'current_service_notifications_enabled' : {
5021 'description' : 'Wether notifications are enabled for the service (0/1)',
5024 'current_service_obsess_over_service' : {
5025 'description' : 'Wether \'obsess_over_service\' is enabled for the service (0/1)',
5028 'current_service_percent_state_change' : {
5029 'description' : 'Percent state change',
5032 'current_service_perf_data' : {
5033 'description' : 'Performance data of the last check plugin',
5036 'current_service_plugin_output' : {
5037 'description' : 'Output of the last check plugin',
5040 'current_service_process_performance_data' : {
5041 'description' : 'Wether processing of performance data is enabled for the service (0/1)',
5044 'current_service_retry_interval' : {
5045 'description' : 'Number of basic interval lengths between checks when retrying after a soft error',
5048 'current_service_scheduled_downtime_depth' : {
5049 'description' : 'The number of scheduled downtimes the service is currently in',
5052 'current_service_state' : {
5053 'description' : 'The current state of the service (0: OK, 1: WARN, 2: CRITICAL, 3: UNKNOWN)',
5056 'current_service_state_type' : {
5057 'description' : 'The type of the current state (0: soft, 1: hard)',
5061 'description' : 'The name of the host the log entry is about (might be empty)',
5065 'description' : 'The number of the line in the log file',
5069 'description' : 'The complete message line including the timestamp',
5073 'description' : 'The part of the message after the \':\'',
5077 'description' : 'The output of the check, if any is associated with the message',
5080 'service_description' : {
5081 'description' : 'The description of the service log entry is about (might be empty)',
5086 'description' : 'The state of the host or service in question',
5091 'description' : 'The type of the state (varies on different log classes)',
5096 'description' : 'Time of the log event (UNIX timestamp)',
5101 'description' : 'The type of the message (text before the colon), the message itself for info messages',
5109 def __init__(self
, configs
, hostname_lookup_table
, servicename_lookup_table
, hosts
, services
, contacts
, hostgroups
, servicegroups
, contactgroups
, timeperiods
, commands
, schedulers
, pollers
, reactionners
, brokers
, dbconn
, return_queue
):
5110 #self.conf = scheduler.conf
5111 #self.scheduler = scheduler
5112 self
.configs
= configs
5113 self
.hostname_lookup_table
= hostname_lookup_table
5114 self
.servicename_lookup_table
= servicename_lookup_table
5116 self
.services
= services
5117 self
.contacts
= contacts
5118 self
.hostgroups
= hostgroups
5119 self
.servicegroups
= servicegroups
5120 self
.contactgroups
= contactgroups
5121 self
.timeperiods
= timeperiods
5122 self
.commands
= commands
5123 self
.schedulers
= schedulers
5124 self
.pollers
= pollers
5125 self
.reactionners
= reactionners
5126 self
.brokers
= brokers
5127 self
.dbconn
= dbconn
5129 self
.dbconn
.row_factory
= self
.row_factory
5130 self
.return_queue
= return_queue
5131 self
.inversed_stack_queue
= (Queue
.LifoQueue
== Queue
.Queue
) # if the Queue is not in the good order for python 2.4
5132 # add Host attributes to Hostsbygroup
5133 for attribute
in LiveStatus
.out_map
['Host']:
5134 LiveStatus
.out_map
['Hostsbygroup'][attribute
] = LiveStatus
.out_map
['Host'][attribute
]
5135 for attribute
in LiveStatus
.out_map
['Service']:
5136 LiveStatus
.out_map
['Servicesbygroup'][attribute
] = LiveStatus
.out_map
['Service'][attribute
]
5137 for attribute
in LiveStatus
.out_map
['Service']:
5138 LiveStatus
.out_map
['Servicesbyhostgroup'][attribute
] = LiveStatus
.out_map
['Service'][attribute
]
5141 def debug(self
, debuglevel
, message
):
5142 f
= open("/tmp/livestatus.debug", "a")
5146 if self
.debuglevel
>= debuglevel
:
5150 # Find the converter function for a table/attribute pair
5151 def find_converter(self
, table
, attribute
):
5153 'hosts' : LiveStatus
.out_map
['Host'],
5154 'services' : LiveStatus
.out_map
['Service'],
5155 'hostgroups' : LiveStatus
.out_map
['Hostgroup'],
5156 'servicegroups' : LiveStatus
.out_map
['Servicegroup'],
5157 'contacts' : LiveStatus
.out_map
['Contact'],
5158 'contactgroups' : LiveStatus
.out_map
['Contactgroup'],
5159 'comments' : LiveStatus
.out_map
['Comment'],
5160 'downtimes' : LiveStatus
.out_map
['Downtime'],
5161 'commands' : LiveStatus
.out_map
['Command'],
5162 'timeperiods' : LiveStatus
.out_map
['Timeperiod'],
5163 'hostsbygroup' : LiveStatus
.out_map
['Hostsbygroup'],
5164 'servicesbygroup' : LiveStatus
.out_map
['Servicesbygroup'],
5165 'servicesbyhostgroup' : LiveStatus
.out_map
['Servicesbyhostgroup'],
5166 'status' : LiveStatus
.out_map
['Config'],
5167 'log' : LiveStatus
.out_map
['Logline'],
5168 'schedulers' : LiveStatus
.out_map
['SchedulerLink'],
5169 'pollers' : LiveStatus
.out_map
['PollerLink'],
5170 'reactionners' : LiveStatus
.out_map
['ReactionnerLink'],
5171 'brokers' : LiveStatus
.out_map
['BrokerLink'],
5172 'problems' : LiveStatus
.out_map
['Problem'],
5174 if attribute
in out_map
and 'type' in out_map
[attribute
]:
5175 if out_map
[attribute
]['type'] == 'int':
5177 elif out_map
[attribute
]['type'] == 'float':
5179 #if attribute in out_map and 'converter' in out_map[attribute]:
5180 # return out_map[attribute]['converter']
5184 def create_output(self
, type_map
, elt
, attributes
, filterattributes
):
5186 # type_map is usually LiveStatus.out_map[elt.__class__.__name__]
5187 # But instead of Host it can also be Hostbygroup
5188 if len(attributes
+ filterattributes
) == 0:
5189 display_attributes
= type_map
.keys()
5191 display_attributes
= list(set(attributes
+ filterattributes
))
5192 for display
in display_attributes
:
5194 if display
not in type_map
:
5195 # no mapping, use it as a direct attribute
5196 value
= getattr(elt
, display
, '')
5198 if 'prop' not in type_map
[display
] or type_map
[display
]['prop'] == None:
5199 # display is listed, but prop is not set. this must be a direct attribute
5202 # We have a prop, this means some kind of mapping between the display name (livestatus column)
5203 # and an internal name must happen
5204 prop
= type_map
[display
]['prop']
5205 value
= getattr(elt
, prop
, None)
5206 # Some attributes of Contact/Host are by defautl 'none'
5207 # TODO: look if this can be None in contact.py, host.py
5211 # The name/function listed in prop exists
5212 #Maybe it's not a value, but a function link
5215 if display
in type_map
and 'depythonize' in type_map
[display
]:
5216 f
= type_map
[display
]['depythonize']
5218 #for example "from_list_to_split". value is an array and f takes the array as an argument
5221 if isinstance(value
, list):
5222 #depythonize's argument might be an attribute or a method
5223 #example: members is an array of hosts and we want get_name() of each element
5224 value
= [getattr(item
, f
)() for item
in value
if callable(getattr(item
, f
)) ] \
5225 + [getattr(item
, f
) for item
in value
if not callable(getattr(item
, f
)) ]
5226 #at least servicegroups are nested [host,service],.. The need some flattening
5228 #I thin the 2 above lines are create a problem in json output at least
5229 #with service groups members that need to be [[hostname, desc], [hostname, desc]]
5230 #value = [y for x in value if isinstance(x, list) for y in x] + \
5231 # [x for x in value if not isinstance(x, list)]
5232 #print "DBG: Final value:", value
5235 #ok not a direct function, maybe a functin provided by value...
5236 f
= getattr(value
, f
)
5242 if len(str(value
)) == 0:
5244 elif 'default' in type_map
[display
]:
5245 # display is not a known attribute, there is no prop for mapping, but
5246 # at least we have a default value
5247 value
= type_map
[display
]['default']
5250 output
[display
] = value
5254 def get_live_data(self
, table
, columns
, prefiltercolumns
, filtercolumns
, limit
, filter_stack
, stats_filter_stack
, stats_postprocess_stack
, stats_group_by
):
5256 if table
in ['hosts', 'services', 'downtimes', 'comments', 'hostgroups', 'servicegroups', 'hostsbygroup', 'servicesbygroup', 'servicesbyhostgroup']:
5257 #Scan through the objects and apply the Filter: rules
5258 if table
== 'hosts':
5259 type_map
= LiveStatus
.out_map
['Host']
5260 without_filter
= len(filtercolumns
) == 0
5262 filtresult
= [self
.create_output(type_map
, y
, columns
, []) for y
in (x
for x
in self
.hosts
.values() if (without_filter
or filter_stack(self
.create_output(type_map
, x
, [], filtercolumns
))))]
5264 hosts
= sorted(self
.hosts
.values(), key
= lambda k
: k
.host_name
)
5265 if len(filtercolumns
) == 0:
5266 filtresult
= [y
for y
in [self
.create_output(type_map
, x
, columns
, filtercolumns
) for x
in hosts
] if filter_stack(y
)]
5268 prefiltresult
= (x
for x
in hosts
if filter_stack(self
.create_output(type_map
, x
, [], filtercolumns
)))
5269 filtresult
= [self
.create_output(x
, columns
, filtercolumns
) for x
in prefiltresult
]
5270 filtresult
= filtresult
[:limit
]
5271 elif table
== 'hostsbygroup':
5272 type_map
= LiveStatus
.out_map
['Hostsbygroup']
5273 # instead of self.hosts.values()
5274 # loop over hostgroups, then over members, then flatten the list, then add a hostgroup attribute to each host
5275 without_filter
= len(filtercolumns
) == 0
5277 filtresult
= [self
.create_output(type_map
, x
, columns
, []) for x
in [
5279 setattr(hohg
[0], 'hostgroup', hohg
[1]) or hohg
[0] for hohg
in [
5280 # (host, hg), (host, hg), ... host objects are individuals
5281 (copy
.copy(item0
), inner_list0
[1]) for inner_list0
in [
5282 # ([host, host, ...], hg), ([host], hg), ...
5283 (sorted(hg1
.members
, key
= lambda k
: k
.host_name
), hg1
) for hg1
in
5284 # hostgroups sorted by hostgroup_name
5285 sorted([hg0
for hg0
in self
.hostgroups
.values() if hg0
.members
], key
= lambda k
: k
.hostgroup_name
)
5286 ] for item0
in inner_list0
[0]
5288 ] if (without_filter
or filter_stack(self
.create_output(type_map
, host
, [], filtercolumns
)))
5291 # Now implemented. Why would one limit this anyway?
5293 elif table
== 'services':
5294 type_map
= LiveStatus
.out_map
['Service']
5295 without_filter
= len(filtercolumns
) == 0
5297 filtresult
= [self
.create_output(type_map
, y
, columns
, []) for y
in (x
for x
in self
.services
.values() if (without_filter
or filter_stack(self
.create_output(type_map
, x
, [], filtercolumns
))))]
5299 services
= sorted(self
.services
.values(), key
= lambda k
: (k
.host_name
, k
.service_description
))
5300 if len(filtercolumns
) == 0:
5301 filtresult
= [y
for y
in [self
.create_output(type_map
, x
, columns
, filtercolumns
) for x
in services
] if filter_stack(y
)]
5303 prefiltresult
= (x
for x
in services
if filter_stack(self
.create_output(type_map
, x
, [], filtercolumns
)))
5304 filtresult
= [self
.create_output(type_map
, x
, columns
, filtercolumns
) for x
in prefiltresult
]
5305 filtresult
= filtresult
[:limit
]
5306 elif table
== 'servicesbygroup':
5307 type_map
= LiveStatus
.out_map
['Servicesbygroup']
5308 without_filter
= len(filtercolumns
) == 0
5309 # Here we have more generators instead of list comprehensions, but in fact it makes no difference
5310 # (Tested with 2000 services)
5312 filtresult
= [self
.create_output(type_map
, x
, columns
, []) for x
in (
5314 setattr(servicesg
[0], 'servicegroup', servicesg
[1]) or servicesg
[0] for servicesg
in (
5315 # (service, sg), (service, sg), ... service objects are individuals
5316 (copy
.copy(item0
), inner_list0
[1]) for inner_list0
in (
5317 # ([service, service], sg), ([service, service, ...], sg), ... services are sorted
5318 (sorted(sg1
.members
, key
= lambda k
: k
.get_full_name()), sg1
) for sg1
in
5319 # servicegroups, sorted by their servicegroup_name
5320 sorted([sg0
for sg0
in self
.servicegroups
.values() if sg0
.members
], key
= lambda k
: k
.servicegroup_name
)
5321 ) for item0
in inner_list0
[0]
5323 ) if (without_filter
or filter_stack(self
.create_output(type_map
, svc
, [], filtercolumns
)))
5326 # Now implemented. Why would one limit this anyway?
5328 elif table
== 'servicesbyhostgroup':
5329 # We will use prefiltercolumns here for some serious speedup.
5330 # For example, if nagvis wants Filter: host_groups >= hgxy
5331 # we don't have to use the while list of hostgroups in
5332 # the innermost loop
5333 type_map
= LiveStatus
.out_map
['Servicesbyhostgroup']
5334 # Filter: host_groups >= linux-servers
5335 # host_groups is a service attribute
5336 # We can get all services of all hosts of all hostgroups and filter at the end
5337 # But it would save a lot of time to already filter the hostgroups. This means host_groups must be hard-coded
5338 # Also host_name, but then we must filter the second step.
5339 # And a mixture host_groups/host_name with FilterAnd/Or? Must have several filter functions
5340 # This is still under construction. The code can be made simpler
5341 without_filter
= len(filtercolumns
) == 0
5343 filtresult
= [self
.create_output(type_map
, x
, columns
, filtercolumns
) for x
in (
5345 setattr(svchgrp
[0], 'hostgroup', svchgrp
[1]) or svchgrp
[0] for svchgrp
in (
5346 # (service, hostgroup), (service, hostgroup), (service, hostgroup), ... service objects are individuals
5347 (copy
.copy(item1
), inner_list1
[1]) for inner_list1
in (
5348 # ([service, service, ...], hostgroup), ([service, ...], hostgroup), ... flattened by host. only if a host has services. sorted by service_description
5349 (sorted(item0
.services
, key
= lambda k
: k
.service_description
), inner_list0
[1]) for inner_list0
in (
5350 # ([host, host, ...], hostgroup), ([host, host, host, ...], hostgroup), ... sorted by host_name
5351 (sorted(hg1
.members
, key
= lambda k
: k
.host_name
), hg1
) for hg1
in # ([host, host], hg), ([host], hg),... hostgroup.members->explode->sort
5352 # hostgroups, sorted by hostgroup_name
5353 sorted([hg0
for hg0
in self
.hostgroups
.values() if hg0
.members
], key
= lambda k
: k
.hostgroup_name
)
5354 ) for item0
in inner_list0
[0] if item0
.services
5355 ) for item1
in inner_list1
[0]
5357 ) if (without_filter
or filter_stack(self
.create_output(type_map
, svc
, [], filtercolumns
)))
5360 # Now implemented. Why would one limit this anyway?
5362 elif table
== 'downtimes':
5363 type_map
= LiveStatus
.out_map
['Downtime']
5364 need_filter
= len(filtercolumns
) > 0
5365 if len(filtercolumns
) == 0:
5366 filtresult
= [self
.create_output(type_map
, y
, columns
, filtercolumns
) for y
in reduce(list.__add
__, [x
.downtimes
for x
in self
.services
.values() + self
.hosts
.values() if len(x
.downtimes
) > 0], [])]
5368 prefiltresult
= [d
for d
in reduce(list.__add
__, [x
.downtimes
for x
in self
.services
.values() + self
.hosts
.values() if len(x
.downtimes
) > 0], []) if filter_stack(self
.create_output(type_map
, d
, [], filtercolumns
))]
5369 filtresult
= [self
.create_output(type_map
, x
, columns
, filtercolumns
) for x
in prefiltresult
]
5370 elif table
== 'comments':
5371 type_map
= LiveStatus
.out_map
['Comment']
5372 if len(filtercolumns
) == 0:
5373 filtresult
= [self
.create_output(type_map
, y
, columns
, filtercolumns
) for y
in reduce(list.__add
__, [x
.comments
for x
in self
.services
.values() + self
.hosts
.values() if len(x
.comments
) > 0], [])]
5375 prefiltresult
= [c
for c
in reduce(list.__add
__, [x
.comments
for x
in self
.services
.values() + self
.hosts
.values() if len(x
.comments
) > 0], []) if filter_stack(self
.create_output(type_map
, c
, [], filtercolumns
))]
5376 filtresult
= [self
.create_output(type_map
, x
, columns
, filtercolumns
) for x
in prefiltresult
]
5377 elif table
== 'hostgroups':
5378 type_map
= LiveStatus
.out_map
['Hostgroup']
5379 if len(filtercolumns
) == 0:
5380 filtresult
= [y
for y
in [self
.create_output(type_map
, x
, columns
, filtercolumns
) for x
in self
.hostgroups
.values()] if filter_stack(y
)]
5382 prefiltresult
= [x
for x
in self
.hostgroups
.values() if filter_stack(self
.create_output(type_map
, x
, [], filtercolumns
))]
5383 filtresult
= [self
.create_output(type_map
, x
, columns
, filtercolumns
) for x
in prefiltresult
]
5384 elif table
== 'servicegroups':
5385 type_map
= LiveStatus
.out_map
['Servicegroup']
5386 if len(filtercolumns
) == 0:
5387 filtresult
= [y
for y
in [self
.create_output(type_map
, x
, columns
, filtercolumns
) for x
in self
.servicegroups
.values()] if filter_stack(y
)]
5389 prefiltresult
= [x
for x
in self
.servicegroups
.values() if filter_stack(self
.create_output(type_map
, x
, [], filtercolumns
))]
5390 filtresult
= [self
.create_output(type_map
, x
, columns
, filtercolumns
) for x
in prefiltresult
]
5392 if stats_filter_stack
.qsize() > 0:
5395 # Break up filtresult and prepare resultarr
5396 # rseultarr is not a simple array (for a single result line)
5397 # It is a dict with the statsgroupyby: as key
5399 for elem
in filtresult
:
5400 if not elem
[stats_group_by
] in groupedresult
:
5401 groupedresult
[elem
[stats_group_by
]] = []
5402 groupedresult
[elem
[stats_group_by
]].append(elem
)
5403 for group
in groupedresult
:
5404 resultarr
[group
] = { stats_group_by
: group
}
5406 #The number of Stats: statements
5407 #For each statement there is one function on the stack
5408 maxidx
= stats_filter_stack
.qsize()
5409 for i
in range(maxidx
):
5410 #First, get a filter for the attributes mentioned in Stats: statements
5411 filtfunc
= stats_filter_stack
.get()
5412 #Then, postprocess (sum, max, min,...) the results
5413 postprocess
= stats_postprocess_stack
.get()
5414 #If we are not inversed (like >=2.6) we are like a stack
5415 if not self
.inversed_stack_queue
:
5416 ind
= maxidx
- i
- 1
5417 else: # we take FIFO, so the order is the inversed!
5420 # Calc statistics over _all_ elements of groups
5421 # which share the same stats_filter_by
5422 for group
in groupedresult
:
5423 resultarr
[group
][ind
] = postprocess(filter(filtfunc
, groupedresult
[group
]))
5426 # Calc statistics over _all_ elements of filtresult
5427 resultarr
[ind
] = postprocess(filter(filtfunc
, filtresult
))
5429 for group
in groupedresult
:
5430 result
.append(resultarr
[group
])
5432 # Without StatsGroupBy: we have only one line
5433 result
= [resultarr
]
5435 #Results are host/service/etc dicts with the requested attributes
5436 #Columns: = keys of the dicts
5438 elif table
== 'contacts':
5439 type_map
= LiveStatus
.out_map
['Contact']
5440 for c
in self
.contacts
.values():
5441 result
.append(self
.create_output(type_map
, c
, columns
, filtercolumns
))
5442 elif table
== 'commands':
5443 type_map
= LiveStatus
.out_map
['Command']
5444 for c
in self
.commands
.values():
5445 result
.append(self
.create_output(type_map
, c
, columns
, filtercolumns
))
5446 elif table
== 'schedulers':
5447 type_map
= LiveStatus
.out_map
['SchedulerLink']
5448 for s
in self
.schedulers
.values():
5449 result
.append(self
.create_output(type_map
, s
, columns
, filtercolumns
))
5450 elif table
== 'pollers':
5451 type_map
= LiveStatus
.out_map
['PollerLink']
5452 for s
in self
.pollers
.values():
5453 result
.append(self
.create_output(type_map
, s
, columns
, filtercolumns
))
5454 elif table
== 'reactionners':
5455 type_map
= LiveStatus
.out_map
['ReactionnerLink']
5456 for s
in self
.reactionners
.values():
5457 result
.append(self
.create_output(type_map
, s
, columns
, filtercolumns
))
5458 elif table
== 'brokers':
5459 type_map
= LiveStatus
.out_map
['BrokerLink']
5460 for s
in self
.brokers
.values():
5461 result
.append(self
.create_output(type_map
, s
, columns
, filtercolumns
))
5462 elif table
== 'problems':
5463 type_map
= LiveStatus
.out_map
['Problem']
5464 #We will crate a problems list first with all problems and source in it
5465 #TODO : create with filter
5467 for h
in self
.hosts
.values():
5469 pb
= Problem(h
, h
.impacts
)
5471 for s
in self
.services
.values():
5473 pb
= Problem(s
, s
.impacts
)
5477 result
.append(self
.create_output(type_map
, pb
, columns
, filtercolumns
))
5478 elif table
== 'status':
5479 type_map
= LiveStatus
.out_map
['Config']
5480 for c
in self
.configs
.values():
5481 result
.append(self
.create_output(type_map
, c
, columns
, filtercolumns
))
5482 elif table
== 'columns':
5484 'description' : 'A description of the column' , 'name' : 'description' , 'table' : 'columns' , 'type' : 'string' })
5486 'description' : 'The name of the column within the table' , 'name' : 'name' , 'table' : 'columns' , 'type' : 'string' })
5488 'description' : 'The name of the table' , 'name' : 'table' , 'table' : 'columns' , 'type' : 'string' })
5490 'description' : 'The data type of the column (int, float, string, list)' , 'name' : 'type' , 'table' : 'columns' , 'type' : 'string' })
5491 tablenames
= { 'Host' : 'hosts', 'Service' : 'services', 'Hostgroup' : 'hostgroups', 'Servicegroup' : 'servicegroups', 'Contact' : 'contacts', 'Contactgroup' : 'contactgroups', 'Command' : 'commands', 'Downtime' : 'downtimes', 'Comment' : 'comments', 'Timeperiod' : 'timeperiods', 'Config' : 'status', 'Logline' : 'log' }
5492 for obj
in sorted(LiveStatus
.out_map
, key
=lambda x
: x
):
5493 if obj
in tablenames
:
5494 for attr
in LiveStatus
.out_map
[obj
]:
5495 if 'description' in LiveStatus
.out_map
[obj
][attr
] and LiveStatus
.out_map
[obj
][attr
]['description']:
5496 result
.append({ 'description' : LiveStatus
.out_map
[obj
][attr
]['description'], 'name' : attr
, 'table' : tablenames
[obj
], 'type' : LiveStatus
.out_map
[obj
][attr
]['type'] })
5498 result
.append({'description' : 'to_do_desc', 'name' : attr
, 'table' : tablenames
[obj
], 'type' : LiveStatus
.out_map
[obj
][attr
]['type'] })
5500 #print "result is", result
5504 def get_live_data_log(self
, table
, columns
, prefiltercolumns
, filtercolumns
, limit
, filter_stack
, sql_filter_stack
):
5507 type_map
= LiveStatus
.out_map
['Log']
5508 # we can apply the filterstack here as well. we have columns and filtercolumns.
5509 # the only additional step is to enrich log lines with host/service-attributes
5510 # a timerange can be useful for a faster preselection of lines
5511 filter_clause
, filter_values
= sql_filter_stack()
5512 c
= self
.dbconn
.cursor()
5514 #print "sql:", 'SELECT * FROM logs WHERE %s' % (filter_clause)
5515 c
.execute('SELECT * FROM logs WHERE %s' % filter_clause
, filter_values
)
5516 except sqlite3
.Error
, e
:
5517 print "An error occurred:", e
.args
[0]
5519 dbresult
= c
.fetchall()
5520 # make a generator: fill in the missing columns in the logline and filter it with filtercolumns
5521 prefiltresult
= (y
for y
in (x
.fill(self
.hosts
, self
.services
, self
.hostname_lookup_table
, self
.servicename_lookup_table
, set(columns
+ filtercolumns
)) for x
in dbresult
) if filter_stack(self
.create_output(type_map
, y
, [], filtercolumns
)))
5522 # add output columns
5523 filtresult
= [self
.create_output(type_map
, x
, columns
, filtercolumns
) for x
in prefiltresult
]
5526 # CREATE TABLE IF NOT EXISTS logs(logobject INT, attempt INT, class INT, command_name VARCHAR(64), comment VARCHAR(256), contact_name VARCHAR(64), host_name VARCHAR(64), lineno INT, message VARCHAR(512), options INT, plugin_output VARCHAR(256), service_description VARCHAR(64), state INT, state_type VARCHAR(10), time INT, type VARCHAR(64))
5528 #print "result is", result
5532 def format_live_data(self
, result
, columns
, outputformat
, columnheaders
, separators
, aliases
):
5535 if outputformat
== 'csv':
5537 if columnheaders
!= 'off' or len(columns
) == 0:
5538 if len(aliases
) > 0:
5539 #This is for statements like "Stats: .... as alias_column
5540 lines
.append(separators
[1].join([aliases
[col
] for col
in columns
]))
5542 if (len(columns
) == 0):
5543 # Show all available columns
5544 columns
= sorted(result
[0].keys())
5545 lines
.append(separators
[1].join(columns
))
5546 for object in result
:
5547 #construct one line of output for each object found
5549 for x
in [object[c
] for c
in columns
]:
5550 if isinstance(x
, list):
5551 l
.append(separators
[2].join(str(y
) for y
in x
))
5554 lines
.append(separators
[1].join(l
))
5556 if columnheaders
== 'on':
5557 if len(aliases
) > 0:
5558 lines
.append(separators
[1].join([aliases
[col
] for col
in columns
]))
5560 lines
.append(separators
[1].join(columns
))
5561 return separators
[0].join(lines
)
5563 elif outputformat
== 'json':
5565 if columnheaders
!= 'off' or len(columns
) == 0:
5566 if len(aliases
) > 0:
5567 #This is for statements like "Stats: .... as alias_column
5568 lines
.append([str(aliases
[col
]) for col
in columns
])
5570 if (len(columns
) == 0):
5571 # Show all available columns
5572 columns
= sorted(result
[0].keys())
5573 lines
.append(columns
)
5574 for object in result
:
5575 lines
.append([object[c
] for c
in columns
])
5577 if columnheaders
== 'on':
5578 if len(aliases
) > 0:
5579 lines
.append([aliases
[col
] for col
in columns
])
5581 lines
.append(columns
)
5582 return json
.dumps(lines
, separators
=(',', ':'))
5585 def make_filter(self
, operator
, attribute
, reference
):
5586 #The filters are closures.
5587 # Add parameter Class (Host, Service), lookup datatype (default string), convert reference
5589 return ref
[attribute
] == reference
5591 def eq_nocase_filter(ref
):
5592 return ref
[attribute
].lower() == reference
.lower()
5595 return ref
[attribute
] != reference
5598 return ref
[attribute
] > reference
5601 return ref
[attribute
] >= reference
5604 return ref
[attribute
] < reference
5607 return ref
[attribute
] <= reference
5609 def contains_filter(ref
):
5610 return reference
in ref
[attribute
].split(',')
5612 def match_filter(ref
):
5613 p
= re
.compile(reference
)
5614 return p
.search(ref
[attribute
])
5616 def match_nocase_filter(ref
):
5617 p
= re
.compile(reference
, re
.I
)
5618 return p
.search(ref
[attribute
])
5620 def ge_contains_filter(ref
):
5621 if isinstance(ref
[attribute
], list):
5622 return reference
in ref
[attribute
]
5624 return ref
[attribute
] >= reference
5626 def dummy_filter(ref
):
5629 def count_postproc(ref
):
5632 def extract_postproc(ref
):
5633 return [float(obj
[attribute
]) for obj
in ref
]
5635 def sum_postproc(ref
):
5636 return sum(float(obj
[attribute
]) for obj
in ref
)
5638 def max_postproc(ref
):
5640 return max(float(obj
[attribute
]) for obj
in ref
)
5643 def min_postproc(ref
):
5645 return min(float(obj
[attribute
]) for obj
in ref
)
5648 def avg_postproc(ref
):
5650 return sum(float(obj
[attribute
]) for obj
in ref
) / len(ref
)
5653 def std_postproc(ref
):
5656 ##print "check operator", operator
5659 elif operator
== '!=':
5661 elif operator
== '>':
5663 elif operator
== '>=':
5664 return ge_contains_filter
5665 elif operator
== '<':
5667 elif operator
== '<=':
5669 elif operator
== '=~':
5670 return eq_nocase_filter
5671 elif operator
== '~':
5673 elif operator
== '~~':
5674 return match_nocase_filter
5675 elif operator
== 'dummy':
5677 elif operator
== 'sum':
5679 elif operator
== 'max':
5681 elif operator
== 'min':
5683 elif operator
== 'avg':
5685 elif operator
== 'std':
5687 elif operator
== 'count':
5688 # postprocess for stats
5689 return count_postproc
5690 elif operator
== 'extract':
5691 # postprocess for max,min,...
5692 return extract_postproc
5694 raise "wrong operation", operator
5697 def get_filter_stack(self
, filter_stack
):
5698 if filter_stack
.qsize() == 0:
5699 return lambda x
: True
5701 return filter_stack
.get()
5705 def and_filter_stack(self
, num
, filter_stack
):
5707 for i
in range(int(num
)):
5708 filters
.append(filter_stack
.get())
5709 # Take from the stack:
5710 # List of functions taking parameter ref
5711 # Make a combined anded function
5712 # Put it on the stack
5713 def and_filter(ref
):
5716 for filter in myfilters
:
5723 filter_stack
.put(and_filter
)
5727 def or_filter_stack(self
, num
, filter_stack
):
5729 for i
in range(int(num
)):
5730 filters
.append(filter_stack
.get())
5731 # Take from the stack:
5732 # List of functions taking parameter ref
5733 # Make a combined ored function
5734 # Put it on the stack
5738 for filter in myfilters
:
5745 filter_stack
.put(or_filter
)
5749 def make_sql_filter(self
, operator
, attribute
, reference
):
5750 #The filters are closures.
5751 # Add parameter Class (Host, Service), lookup datatype (default string), convert reference
5754 return ['%s IS NULL' % attribute
, ()]
5756 return ['%s = ?' % attribute
, (reference
, )]
5759 return ['%s IS NOT NULL' % attribute
, ()]
5761 return ['%s != ?' % attribute
, (reference
, )]
5763 return ['%s >= ?' % attribute
, (reference
, )]
5765 return ['%s <= ?' % attribute
, (reference
, )]
5767 return ['%s LIKE ?' % attribute
, ('%'+reference
+'%', )]
5770 if operator
== '>=':
5772 if operator
== '<=':
5774 if operator
== '!=':
5780 def get_sql_filter_stack(self
, filter_stack
):
5781 if filter_stack
.qsize() == 0:
5784 return filter_stack
.get()
5788 def and_sql_filter_stack(self
, num
, filter_stack
):
5790 for i
in range(int(num
)):
5791 filters
.append(filter_stack
.get())
5792 # Take from the stack:
5793 # List of functions returning [a where clause with ?, a tuple with the values for ?]
5794 # Combine the clauses with "and", merge the value tuples
5795 # Put a new function on the stack (returns anded clause and merged values)
5796 and_clause
= '(' + (' AND ').join([ x()[0] for x
in filters
]) + ')'
5797 and_values
= reduce(lambda x
, y
: x
+y
, [ x()[1] for x
in filters
])
5798 filter_stack
.put(lambda : [and_clause
, and_values
])
5802 def or_sql_filter_stack(self
, num
, filter_stack
):
5804 for i
in range(int(num
)):
5805 filters
.append(filter_stack
.get())
5806 and_clause
= '(' + (' OR ').join([ x()[0] for x
in filters
]) + ')'
5807 and_values
= reduce(lambda x
, y
: x
+y
, [ x()[1] for x
in filters
])
5808 filter_stack
.put(lambda : [and_clause
, and_values
])
5812 def handle_request(self
, data
):
5813 #Dirty hack to change the output of get_full_name for services
5815 global get_full_name
5821 prefiltercolumns
= []
5822 responseheader
= 'off'
5823 outputformat
= 'csv'
5827 #So set first this format in out global function
5828 get_full_name
.outputformat
= outputformat
5830 columnheaders
= 'off'
5831 stats_group_by
= False
5834 print "REQUEST", data
5835 # Set the default values for the separators
5836 separators
= LiveStatus
.separators
5837 # Initialize the stacks which are needed for the Filter: and Stats:
5838 # filter- and count-operations
5839 filter_stack
= Queue
.LifoQueue()
5840 sql_filter_stack
= Queue
.LifoQueue()
5841 stats_filter_stack
= Queue
.LifoQueue()
5842 stats_postprocess_stack
= Queue
.LifoQueue()
5843 for line
in data
.splitlines():
5845 if line
.find('GET ') != -1:
5846 # Get the name of the base table
5847 cmd
, table
= line
.split(' ', 1)
5848 elif line
.find('Columns: ') != -1:
5849 # Get the names of the desired columns
5850 p
= re
.compile(r
'\s+')
5851 cmd
, columns
= p
.split(line
, 1)
5852 columns
= p
.split(columns
)
5853 columnheaders
= 'off'
5854 elif line
.find('ResponseHeader:') != -1:
5855 cmd
, responseheader
= line
.split(':', 1)
5856 #strip the responseheader because a can be here
5857 responseheader
= responseheader
.strip()
5858 print "responseheader", responseheader
5859 elif line
.find('OutputFormat:') != -1:
5860 cmd
, outputformat
= line
.split(':', 1)
5861 #Maybe we have a space before it
5862 outputformat
= outputformat
.strip()
5863 print "Output format:", outputformat
5864 get_full_name
.outputformat
= outputformat
5865 elif line
.find('KeepAlive:') != -1:
5866 cmd
, keepalive
= line
.split(':', 1)
5867 keepalive
= keepalive
.strip()
5868 elif line
.find('ColumnHeaders:') != -1:
5869 cmd
, columnheaders
= line
.split(':', 1)
5870 columnheaders
= columnheaders
.strip()
5871 elif line
.find('Limit:') != -1:
5872 cmd
, limit
= line
.split(':', 1)
5873 limit
= int(limit
.strip())
5874 elif line
.find('Filter:') != -1:
5876 cmd
, attribute
, operator
, reference
= line
.split(' ', 3)
5878 cmd
, attribute
, operator
= line
.split(' ', 3)
5880 if operator
in ['=', '!=', '>', '>=', '<', '<=', '=~', '~', '~~']:
5881 # Put a function on top of the filter_stack which implements
5882 # the desired operation
5883 filtercolumns
.append(attribute
)
5884 prefiltercolumns
.append(attribute
)
5885 # reference is now datatype string. The referring object attribute on the other hand
5886 # may be an integer. (current_attempt for example)
5887 # So for the filter to work correctly (the two values compared must be
5888 # of the same type), we need to convert the reference to the desired type
5889 converter
= self
.find_converter(table
, attribute
)
5891 reference
= converter(reference
)
5892 filter_stack
.put(self
.make_filter(operator
, attribute
, reference
))
5894 if attribute
== 'time':
5895 sql_filter_stack
.put(self
.make_sql_filter(operator
, attribute
, reference
))
5897 print "illegal operation", operator
5898 pass # illegal operation
5899 elif line
.find('And: ', 0, 5) != -1:
5900 cmd
, andnum
= line
.split(' ', 1)
5901 # Take the last andnum functions from the stack
5902 # Construct a new function which makes a logical and
5903 # Put the function back onto the stack
5904 filter_stack
= self
.and_filter_stack(andnum
, filter_stack
)
5905 elif line
.find('Or: ', 0, 4) != -1:
5906 cmd
, ornum
= line
.split(' ', 1)
5907 # Take the last ornum functions from the stack
5908 # Construct a new function which makes a logical or
5909 # Put the function back onto the stack
5910 filter_stack
= self
.or_filter_stack(ornum
, filter_stack
)
5911 elif line
.find('StatsGroupBy: ') != -1:
5912 cmd
, stats_group_by
= line
.split(' ', 1)
5913 filtercolumns
.append(stats_group_by
)
5914 elif line
.find('Stats: ') != -1:
5916 cmd
, attribute
, operator
, reference
= line
.split(' ', 3)
5917 if attribute
in ['sum', 'min', 'max', 'avg', 'std'] and reference
.find('as ', 3) != -1:
5918 attribute
, operator
= operator
, attribute
5919 asas
, alias
= reference
.split(' ')
5920 aliases
.append(alias
)
5921 elif attribute
in ['sum', 'min', 'max', 'avg', 'std'] and reference
== '=':
5922 # workaround for thruk-cmds like: Stats: sum latency =
5923 attribute
, operator
= operator
, attribute
5926 cmd
, attribute
, operator
= line
.split(' ', 3)
5927 if attribute
in ['sum', 'min', 'max', 'avg', 'std']:
5928 attribute
, operator
= operator
, attribute
5930 if operator
in ['=', '!=', '>', '>=']:
5931 filtercolumns
.append(attribute
)
5932 converter
= self
.find_converter(table
, attribute
)
5934 reference
= converter(reference
)
5935 stats_filter_stack
.put(self
.make_filter(operator
, attribute
, reference
))
5936 stats_postprocess_stack
.put(self
.make_filter('count', attribute
, None))
5937 elif operator
in ['sum', 'min', 'max', 'avg', 'std']:
5938 columns
.append(attribute
)
5939 stats_filter_stack
.put(self
.make_filter('dummy', attribute
, None))
5940 stats_postprocess_stack
.put(self
.make_filter(operator
, attribute
, None))
5942 print "illegal operation", operator
5943 pass # illegal operation
5945 elif line
.find('StatsAnd: ') != -1:
5946 cmd
, andnum
= line
.split(' ', 1)
5947 stats_filter_stack
= self
.and_filter_stack(andnum
, stats_filter_stack
)
5948 elif line
.find('StatsOr: ') != -1:
5949 cmd
, ornum
= line
.split(' ', 1)
5950 stats_filter_stack
= self
.or_filter_stack(ornum
, stats_filter_stack
)
5951 elif line
.find('Separators: ') != -1:
5952 # check Class.attribute exists
5953 cmd
, sep1
, sep2
, sep3
, sep4
= line
.split(' ', 5)
5954 separators
= map(lambda x
: chr(int(x
)), [sep1
, sep2
, sep3
, sep4
])
5955 elif line
.find('COMMAND') != -1:
5956 cmd
, extcmd
= line
.split(' ', 1)
5958 # This line is not valid or not implemented
5959 print "Received a line of input which i can't handle : '%s'" % line
5961 #External command are send back to broker
5963 print "Managing an external command", extcmd
5964 e
= ExternalCommand(extcmd
)
5965 self
.return_queue
.put(e
)
5966 #command_file = self.configs[0].command_file
5967 #if os.path.exists(command_file):
5969 # fifo = os.open(command_file, os.O_NONBLOCK|os.O_WRONLY)
5970 # os.write(fifo, extcmd)
5973 # print "Unable to open/write the external command pipe"
5974 return '\n', keepalive
5976 # make filtercolumns unique
5977 filtercolumns
= list(set(filtercolumns
))
5978 if filter_stack
.qsize() > 1:
5979 #If we have Filter: statements but no FilterAnd/Or statements
5980 #Make one big filter where the single filters are anded
5981 filter_stack
= self
.and_filter_stack(filter_stack
.qsize(), filter_stack
)
5983 #Get the function which implements the Filter: statements
5984 simplefilter_stack
= self
.get_filter_stack(filter_stack
)
5986 if sql_filter_stack
.qsize() > 1:
5987 sql_filter_stack
= self
.and_sql_filter_stack(sql_filter_stack
.qsize(), sql_filter_stack
)
5988 sql_simplefilter_stack
= self
.get_sql_filter_stack(sql_filter_stack
)
5989 result
= self
.get_live_data_log(table
, columns
, prefiltercolumns
, filtercolumns
, limit
, simplefilter_stack
, sql_simplefilter_stack
)
5991 #Get the function which implements the Stats: statements
5992 stats
= stats_filter_stack
.qsize()
5993 #Apply the filters on the broker's host/service/etc elements
5994 result
= self
.get_live_data(table
, columns
, prefiltercolumns
, filtercolumns
, limit
, simplefilter_stack
, stats_filter_stack
, stats_postprocess_stack
, stats_group_by
)
5996 columns
= range(stats
)
5998 columns
.insert(0, stats_group_by
)
5999 print "all my columns", columns
6000 if len(aliases
) == 0:
6001 #If there were Stats: staments without "as", show no column headers at all
6002 columnheaders
= 'off'
6004 columnheaders
= 'on'
6006 #Now bring the retrieved information to a form which can be sent back to the client
6007 response
= self
.format_live_data(result
, columns
, outputformat
, columnheaders
, separators
, aliases
) + "\n"
6008 except Exception, e
:
6010 print "REQUEST produces an exception", data
6011 print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
6013 traceback
.print_exc(32)
6014 print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
6017 if responseheader
== 'fixed16':
6019 responselength
= len(response
) # no error
6020 response
= '%3d %11d\n' % (statuscode
, responselength
) + response
6023 print "REQUEST", data
6024 print "RESPONSE\n%s\n" % response
6025 return response
, keepalive
6027 def row_factory(self
, cursor
, row
):
6028 return Logline(cursor
, row
)