![]() |
Icinga-core 1.4.0
next gen monitoring
|
00001 /***************************************************************************** 00002 * 00003 * OBJECTS.H - Header file for object addition/search functions 00004 * 00005 * Copyright (c) 1999-2009 Ethan Galstad (egalstad@nagios.org) 00006 * Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors 00007 * Copyright (c) 2009-2011 Icinga Development Team (http://www.icinga.org) 00008 * 00009 * License: 00010 * 00011 * This program is free software; you can redistribute it and/or modify 00012 * it under the terms of the GNU General Public License version 2 as 00013 * published by the Free Software Foundation. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with this program; if not, write to the Free Software 00022 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00023 * 00024 *****************************************************************************/ 00025 00026 00027 #ifndef _OBJECTS_H 00028 #define _OBJECTS_H 00029 00030 #include "config.h" 00031 #include "common.h" 00032 00033 #ifdef __cplusplus 00034 extern "C" { 00035 #endif 00036 00037 00038 00039 /*************** CURRENT OBJECT REVISION **************/ 00040 00041 #define CURRENT_OBJECT_STRUCTURE_VERSION 307 /* increment when changes are made to data structures... */ 00042 /* Nagios 3 starts at 300, Nagios 4 at 400, etc. */ 00043 00044 00045 00046 /***************** OBJECT SIZE LIMITS *****************/ 00047 00048 #define MAX_STATE_HISTORY_ENTRIES 21 /* max number of old states to keep track of for flap detection */ 00049 #define MAX_CONTACT_ADDRESSES 6 /* max number of custom addresses a contact can have */ 00050 00051 00052 00053 /***************** SKIP LISTS ****************/ 00054 00055 #define NUM_OBJECT_SKIPLISTS 13 00056 00057 #define HOST_SKIPLIST 0 00058 #define SERVICE_SKIPLIST 1 00059 #define COMMAND_SKIPLIST 2 00060 #define TIMEPERIOD_SKIPLIST 3 00061 #define CONTACT_SKIPLIST 4 00062 #define CONTACTGROUP_SKIPLIST 5 00063 #define HOSTGROUP_SKIPLIST 6 00064 #define SERVICEGROUP_SKIPLIST 7 00065 #define HOSTDEPENDENCY_SKIPLIST 8 00066 #define SERVICEDEPENDENCY_SKIPLIST 9 00067 #define HOSTESCALATION_SKIPLIST 10 00068 #define SERVICEESCALATION_SKIPLIST 11 00069 #define MODULE_SKIPLIST 12 00070 00071 /****************** DEFINITIONS *******************/ 00072 /*#define VOLATILE_FALSE 0 - uses FALSE*/ 00073 /*#define VOLATILE_TRUE 1 - uses TRUE */ 00074 #define VOLATILE_WITH_RENOTIFICATION_INTERVAL 2 00075 00076 00077 /******** escalation condition connectors ******/ 00078 #define EC_CONNECTOR_NO 0 00079 #define EC_CONNECTOR_OR 1 00080 #define EC_CONNECTOR_AND 2 00081 00082 /****************** DATA STRUCTURES *******************/ 00083 00084 typedef struct host_struct host; 00085 typedef struct service_struct service; 00086 typedef struct contact_struct contact; 00087 00088 /* OBJECT LIST STRUCTURE */ 00089 typedef struct objectlist_struct{ 00090 void *object_ptr; 00091 struct objectlist_struct *next; 00092 }objectlist; 00093 00094 00095 /* TIMERANGE structure */ 00096 typedef struct timerange_struct{ 00097 unsigned long range_start; 00098 unsigned long range_end; 00099 struct timerange_struct *next; 00100 }timerange; 00101 00102 00103 /* DATERANGE structure */ 00104 typedef struct daterange_struct{ 00105 int type; 00106 int syear; /* start year */ 00107 int smon; /* start month */ 00108 int smday; /* start day of month (may 3rd, last day in feb) */ 00109 int swday; /* start day of week (thursday) */ 00110 int swday_offset; /* start weekday offset (3rd thursday, last monday in jan) */ 00111 int eyear; 00112 int emon; 00113 int emday; 00114 int ewday; 00115 int ewday_offset; 00116 int skip_interval; 00117 timerange *times; 00118 struct daterange_struct *next; 00119 }daterange; 00120 00121 00122 /* TIMEPERIODEXCLUSION structure */ 00123 typedef struct timeperiodexclusion_struct{ 00124 char *timeperiod_name; 00125 struct timeperiod_struct *timeperiod_ptr; 00126 struct timeperiodexclusion_struct *next; 00127 }timeperiodexclusion; 00128 00129 00130 /* TIMEPERIOD structure */ 00131 typedef struct timeperiod_struct{ 00132 char *name; 00133 char *alias; 00134 timerange *days[7]; 00135 daterange *exceptions[DATERANGE_TYPES]; 00136 timeperiodexclusion *exclusions; 00137 struct timeperiod_struct *next; 00138 struct timeperiod_struct *nexthash; 00139 }timeperiod; 00140 00141 00142 /* CONTACTSMEMBER structure */ 00143 typedef struct contactsmember_struct{ 00144 char *contact_name; 00145 #ifdef NSCORE 00146 contact *contact_ptr; 00147 #endif 00148 struct contactsmember_struct *next; 00149 }contactsmember; 00150 00151 00152 /* CONTACTGROUP structure */ 00153 typedef struct contactgroup_struct{ 00154 char *group_name; 00155 char *alias; 00156 contactsmember *members; 00157 struct contactgroup_struct *next; 00158 struct contactgroup_struct *nexthash; 00159 }contactgroup; 00160 00161 00162 /* CONTACTGROUPSMEMBER structure */ 00163 typedef struct contactgroupsmember_struct{ 00164 char *group_name; 00165 #ifdef NSCORE 00166 contactgroup *group_ptr; 00167 #endif 00168 struct contactgroupsmember_struct *next; 00169 }contactgroupsmember; 00170 00171 00172 /* CUSTOMVARIABLESMEMBER structure */ 00173 typedef struct customvariablesmember_struct{ 00174 char *variable_name; 00175 char *variable_value; 00176 int has_been_modified; 00177 struct customvariablesmember_struct *next; 00178 }customvariablesmember; 00179 00180 00181 /* COMMAND structure */ 00182 typedef struct command_struct{ 00183 char *name; 00184 char *command_line; 00185 struct command_struct *next; 00186 struct command_struct *nexthash; 00187 }command; 00188 00189 00190 /* COMMANDSMEMBER structure */ 00191 typedef struct commandsmember_struct{ 00192 char *command; 00193 #ifdef NSCORE 00194 command *command_ptr; 00195 #endif 00196 struct commandsmember_struct *next; 00197 }commandsmember; 00198 00199 00200 /* CONTACT structure */ 00201 struct contact_struct{ 00202 char *name; 00203 char *alias; 00204 char *email; 00205 char *pager; 00206 char *address[MAX_CONTACT_ADDRESSES]; 00207 commandsmember *host_notification_commands; 00208 commandsmember *service_notification_commands; 00209 int notify_on_service_unknown; 00210 int notify_on_service_warning; 00211 int notify_on_service_critical; 00212 int notify_on_service_recovery; 00213 int notify_on_service_flapping; 00214 int notify_on_service_downtime; 00215 int notify_on_host_down; 00216 int notify_on_host_unreachable; 00217 int notify_on_host_recovery; 00218 int notify_on_host_flapping; 00219 int notify_on_host_downtime; 00220 char *host_notification_period; 00221 char *service_notification_period; 00222 int host_notifications_enabled; 00223 int service_notifications_enabled; 00224 int can_submit_commands; 00225 int retain_status_information; 00226 int retain_nonstatus_information; 00227 customvariablesmember *custom_variables; 00228 #ifdef NSCORE 00229 time_t last_host_notification; 00230 time_t last_service_notification; 00231 unsigned long modified_attributes; 00232 unsigned long modified_host_attributes; 00233 unsigned long modified_service_attributes; 00234 00235 timeperiod *host_notification_period_ptr; 00236 timeperiod *service_notification_period_ptr; 00237 objectlist *contactgroups_ptr; 00238 #endif 00239 struct contact_struct *next; 00240 struct contact_struct *nexthash; 00241 }; 00242 00243 00244 /* SERVICESMEMBER structure */ 00245 typedef struct servicesmember_struct{ 00246 char *host_name; 00247 char *service_description; 00248 #ifdef NSCORE 00249 service *service_ptr; 00250 #endif 00251 struct servicesmember_struct *next; 00252 }servicesmember; 00253 00254 00255 /* HOSTSMEMBER structure */ 00256 typedef struct hostsmember_struct{ 00257 char *host_name; 00258 #ifdef NSCORE 00259 host *host_ptr; 00260 #endif 00261 struct hostsmember_struct *next; 00262 }hostsmember; 00263 00264 00265 /* HOSTGROUP structure */ 00266 typedef struct hostgroup_struct{ 00267 char *group_name; 00268 char *alias; 00269 hostsmember *members; 00270 char *notes; 00271 char *notes_url; 00272 char *action_url; 00273 struct hostgroup_struct *next; 00274 struct hostgroup_struct *nexthash; 00275 }hostgroup; 00276 00277 00278 /* HOST structure */ 00279 struct host_struct{ 00280 char *name; 00281 char *display_name; 00282 char *alias; 00283 char *address; 00284 hostsmember *parent_hosts; 00285 hostsmember *child_hosts; 00286 servicesmember *services; 00287 char *host_check_command; 00288 int initial_state; 00289 double check_interval; 00290 double retry_interval; 00291 int max_attempts; 00292 char *event_handler; 00293 contactgroupsmember *contact_groups; 00294 contactsmember *contacts; 00295 double notification_interval; 00296 double first_notification_delay; 00297 int notify_on_down; 00298 int notify_on_unreachable; 00299 int notify_on_recovery; 00300 int notify_on_flapping; 00301 int notify_on_downtime; 00302 char *notification_period; 00303 char *check_period; 00304 int flap_detection_enabled; 00305 double low_flap_threshold; 00306 double high_flap_threshold; 00307 int flap_detection_on_up; 00308 int flap_detection_on_down; 00309 int flap_detection_on_unreachable; 00310 int stalk_on_up; 00311 int stalk_on_down; 00312 int stalk_on_unreachable; 00313 int check_freshness; 00314 int freshness_threshold; 00315 int process_performance_data; 00316 int checks_enabled; 00317 int accept_passive_host_checks; 00318 int event_handler_enabled; 00319 int retain_status_information; 00320 int retain_nonstatus_information; 00321 int failure_prediction_enabled; 00322 char *failure_prediction_options; 00323 int obsess_over_host; 00324 char *notes; 00325 char *notes_url; 00326 char *action_url; 00327 char *icon_image; 00328 char *icon_image_alt; 00329 char *vrml_image; 00330 char *statusmap_image; 00331 int have_2d_coords; 00332 int x_2d; 00333 int y_2d; 00334 int have_3d_coords; 00335 double x_3d; 00336 double y_3d; 00337 double z_3d; 00338 int should_be_drawn; 00339 customvariablesmember *custom_variables; 00340 #ifdef NSCORE 00341 int problem_has_been_acknowledged; 00342 int acknowledgement_type; 00343 int check_type; 00344 int current_state; 00345 int last_state; 00346 int last_hard_state; 00347 char *plugin_output; 00348 char *long_plugin_output; 00349 char *perf_data; 00350 int state_type; 00351 int current_attempt; 00352 unsigned long current_event_id; 00353 unsigned long last_event_id; 00354 unsigned long current_problem_id; 00355 unsigned long last_problem_id; 00356 double latency; 00357 double execution_time; 00358 int is_executing; 00359 int check_options; 00360 int notifications_enabled; 00361 time_t last_host_notification; 00362 time_t next_host_notification; 00363 time_t next_check; 00364 int should_be_scheduled; 00365 time_t last_check; 00366 time_t last_state_change; 00367 time_t last_hard_state_change; 00368 time_t last_time_up; 00369 time_t last_time_down; 00370 time_t last_time_unreachable; 00371 int has_been_checked; 00372 int is_being_freshened; 00373 int notified_on_down; 00374 int notified_on_unreachable; 00375 int current_notification_number; 00376 #ifdef USE_ST_BASED_ESCAL_RANGES 00377 int current_down_notification_number; 00378 int current_unreachable_notification_number; 00379 #endif 00380 int no_more_notifications; 00381 unsigned long current_notification_id; 00382 int check_flapping_recovery_notification; 00383 int scheduled_downtime_depth; 00384 int pending_flex_downtime; 00385 int state_history[MAX_STATE_HISTORY_ENTRIES]; /* flap detection */ 00386 int state_history_index; 00387 time_t last_state_history_update; 00388 int is_flapping; 00389 unsigned long flapping_comment_id; 00390 double percent_state_change; 00391 int total_services; 00392 unsigned long total_service_check_interval; 00393 unsigned long modified_attributes; 00394 int circular_path_checked; 00395 int contains_circular_path; 00396 00397 command *event_handler_ptr; 00398 command *check_command_ptr; 00399 timeperiod *check_period_ptr; 00400 timeperiod *notification_period_ptr; 00401 objectlist *hostgroups_ptr; 00402 #endif 00403 struct host_struct *next; 00404 struct host_struct *nexthash; 00405 /* 2011-02-07 MF: added for keeping the command for NEB callback 00406 PROCESSED state on host|service checks */ 00407 char *processed_command; 00408 /* 2011-02-07 MF: added for dualstack IPv6 support as 00409 $HOSTADDRESS6$ macro */ 00410 char *address6; 00411 }; 00412 00413 00414 /* SERVICEGROUP structure */ 00415 typedef struct servicegroup_struct{ 00416 char *group_name; 00417 char *alias; 00418 servicesmember *members; 00419 char *notes; 00420 char *notes_url; 00421 char *action_url; 00422 struct servicegroup_struct *next; 00423 struct servicegroup_struct *nexthash; 00424 }servicegroup; 00425 00426 00427 /* SERVICE structure */ 00428 struct service_struct{ 00429 char *host_name; 00430 char *description; 00431 char *display_name; 00432 char *service_check_command; 00433 char *event_handler; 00434 int initial_state; 00435 double check_interval; 00436 double retry_interval; 00437 int max_attempts; 00438 int parallelize; 00439 contactgroupsmember *contact_groups; 00440 contactsmember *contacts; 00441 double notification_interval; 00442 double first_notification_delay; 00443 int notify_on_unknown; 00444 int notify_on_warning; 00445 int notify_on_critical; 00446 int notify_on_recovery; 00447 int notify_on_flapping; 00448 int notify_on_downtime; 00449 int stalk_on_ok; 00450 int stalk_on_warning; 00451 int stalk_on_unknown; 00452 int stalk_on_critical; 00453 int is_volatile; 00454 char *notification_period; 00455 char *check_period; 00456 int flap_detection_enabled; 00457 double low_flap_threshold; 00458 double high_flap_threshold; 00459 int flap_detection_on_ok; 00460 int flap_detection_on_warning; 00461 int flap_detection_on_unknown; 00462 int flap_detection_on_critical; 00463 int process_performance_data; 00464 int check_freshness; 00465 int freshness_threshold; 00466 int accept_passive_service_checks; 00467 int event_handler_enabled; 00468 int checks_enabled; 00469 int retain_status_information; 00470 int retain_nonstatus_information; 00471 int notifications_enabled; 00472 int obsess_over_service; 00473 int failure_prediction_enabled; 00474 char *failure_prediction_options; 00475 char *notes; 00476 char *notes_url; 00477 char *action_url; 00478 char *icon_image; 00479 char *icon_image_alt; 00480 customvariablesmember *custom_variables; 00481 #ifdef NSCORE 00482 int problem_has_been_acknowledged; 00483 int acknowledgement_type; 00484 int host_problem_at_last_check; 00485 int check_type; 00486 int current_state; 00487 int last_state; 00488 int last_hard_state; 00489 char *plugin_output; 00490 char *long_plugin_output; 00491 char *perf_data; 00492 int state_type; 00493 time_t next_check; 00494 int should_be_scheduled; 00495 time_t last_check; 00496 int current_attempt; 00497 unsigned long current_event_id; 00498 unsigned long last_event_id; 00499 unsigned long current_problem_id; 00500 unsigned long last_problem_id; 00501 time_t last_notification; 00502 time_t next_notification; 00503 int no_more_notifications; 00504 int check_flapping_recovery_notification; 00505 time_t last_state_change; 00506 time_t last_hard_state_change; 00507 time_t last_time_ok; 00508 time_t last_time_warning; 00509 time_t last_time_unknown; 00510 time_t last_time_critical; 00511 int has_been_checked; 00512 int is_being_freshened; 00513 int notified_on_unknown; 00514 int notified_on_warning; 00515 int notified_on_critical; 00516 int current_notification_number; 00517 #ifdef USE_ST_BASED_ESCAL_RANGES 00518 int current_warning_notification_number; 00519 int current_critical_notification_number; 00520 int current_unknown_notification_number; 00521 #endif 00522 unsigned long current_notification_id; 00523 double latency; 00524 double execution_time; 00525 int is_executing; 00526 int check_options; 00527 int scheduled_downtime_depth; 00528 int pending_flex_downtime; 00529 int state_history[MAX_STATE_HISTORY_ENTRIES]; /* flap detection */ 00530 int state_history_index; 00531 int is_flapping; 00532 unsigned long flapping_comment_id; 00533 double percent_state_change; 00534 unsigned long modified_attributes; 00535 00536 host *host_ptr; 00537 command *event_handler_ptr; 00538 char *event_handler_args; 00539 command *check_command_ptr; 00540 char *check_command_args; 00541 timeperiod *check_period_ptr; 00542 timeperiod *notification_period_ptr; 00543 objectlist *servicegroups_ptr; 00544 #endif 00545 struct service_struct *next; 00546 struct service_struct *nexthash; 00547 /* 2011-02-07 MF: added for keeping the command for NEB callback 00548 PROCESSED state on host|service checks */ 00549 char *processed_command; 00550 }; 00551 00552 /* ESCALATION CONDITION STRUCTURE 00553 * Vitali Voroth, 25.10.2009 00554 * A condition is written this way: 00555 * escalation_condition host linux01 = c 00556 * More than one condition are connected via & OR | : 00557 * escalation_condition host linux01 = c | service linux01.SSH = c,w 00558 * where & is an AND connection and | is and OR connection. 00559 */ 00560 typedef struct escalation_condition_struct{ 00561 char *host_name; 00562 char *service_description; 00563 00564 /* Connects this and the next condition either with an AND or with an OR. 00565 * 0: EC_CONNECTOR_NO 00566 * 1: EC_CONNECTOR_AND 00567 * 2: EC_CONNECTOR_OR 00568 */ 00569 int connector; 00570 00571 int escalate_on_down; 00572 int escalate_on_unreachable; 00573 int escalate_on_warning; 00574 int escalate_on_unknown; 00575 int escalate_on_critical; 00576 int escalate_on_ok; 00577 00578 struct escalation_condition_struct *next; 00579 }escalation_condition; 00580 00581 /* SERVICE ESCALATION structure */ 00582 typedef struct serviceescalation_struct{ 00583 char *host_name; 00584 char *description; 00585 int first_notification; 00586 int last_notification; 00587 #ifdef USE_ST_BASED_ESCAL_RANGES 00588 int first_warning_notification; 00589 int last_warning_notification; 00590 int first_critical_notification; 00591 int last_critical_notification; 00592 int first_unknown_notification; 00593 int last_unknown_notification; 00594 #endif 00595 double notification_interval; 00596 char *escalation_period; 00597 int escalate_on_recovery; 00598 int escalate_on_warning; 00599 int escalate_on_unknown; 00600 int escalate_on_critical; 00601 escalation_condition *condition; 00602 contactgroupsmember *contact_groups; 00603 contactsmember *contacts; 00604 #ifdef NSCORE 00605 service *service_ptr; 00606 timeperiod *escalation_period_ptr; 00607 #endif 00608 struct serviceescalation_struct *next; 00609 struct serviceescalation_struct *nexthash; 00610 }serviceescalation; 00611 00612 00613 /* SERVICE DEPENDENCY structure */ 00614 typedef struct servicedependency_struct{ 00615 int dependency_type; 00616 char *dependent_host_name; 00617 char *dependent_service_description; 00618 char *host_name; 00619 char *service_description; 00620 char *dependency_period; 00621 int inherits_parent; 00622 int fail_on_ok; 00623 int fail_on_warning; 00624 int fail_on_unknown; 00625 int fail_on_critical; 00626 int fail_on_pending; 00627 #ifdef NSCORE 00628 int circular_path_checked; 00629 int contains_circular_path; 00630 00631 service *master_service_ptr; 00632 service *dependent_service_ptr; 00633 timeperiod *dependency_period_ptr; 00634 #endif 00635 struct servicedependency_struct *next; 00636 struct servicedependency_struct *nexthash; 00637 }servicedependency; 00638 00639 00640 /* HOST ESCALATION structure */ 00641 typedef struct hostescalation_struct{ 00642 char *host_name; 00643 int first_notification; 00644 int last_notification; 00645 #ifdef USE_ST_BASED_ESCAL_RANGES 00646 int first_down_notification; 00647 int last_down_notification; 00648 int first_unreachable_notification; 00649 int last_unreachable_notification; 00650 #endif 00651 double notification_interval; 00652 char *escalation_period; 00653 int escalate_on_recovery; 00654 int escalate_on_down; 00655 int escalate_on_unreachable; 00656 escalation_condition *condition; 00657 contactgroupsmember *contact_groups; 00658 contactsmember *contacts; 00659 #ifdef NSCORE 00660 host *host_ptr; 00661 timeperiod *escalation_period_ptr; 00662 #endif 00663 struct hostescalation_struct *next; 00664 struct hostescalation_struct *nexthash; 00665 }hostescalation; 00666 00667 00668 /* HOST DEPENDENCY structure */ 00669 typedef struct hostdependency_struct{ 00670 int dependency_type; 00671 char *dependent_host_name; 00672 char *host_name; 00673 char *dependency_period; 00674 int inherits_parent; 00675 int fail_on_up; 00676 int fail_on_down; 00677 int fail_on_unreachable; 00678 int fail_on_pending; 00679 #ifdef NSCORE 00680 int circular_path_checked; 00681 int contains_circular_path; 00682 00683 host *master_host_ptr; 00684 host *dependent_host_ptr; 00685 timeperiod *dependency_period_ptr; 00686 #endif 00687 struct hostdependency_struct *next; 00688 struct hostdependency_struct *nexthash; 00689 }hostdependency; 00690 00691 00692 /* MODULE structure */ 00693 typedef struct module_struct{ 00694 char *name; 00695 char *type; 00696 char *path; 00697 char *args; 00698 struct module_struct *next; 00699 struct module_struct *nexthash; 00700 }module; 00701 00702 00703 00704 /****************** HASH STRUCTURES ********************/ 00705 00706 typedef struct host_cursor_struct{ 00707 int host_hashchain_iterator; 00708 host *current_host_pointer; 00709 }host_cursor; 00710 00711 00712 00713 00714 00715 /********************* FUNCTIONS **********************/ 00716 00717 /**** Top-level input functions ****/ 00718 int read_object_config_data(char *,int,int,int); /* reads all external configuration data of specific types */ 00719 00720 00721 /**** Object Creation Functions ****/ 00722 contact *add_contact(char *,char *,char *,char *,char **,char *,char *,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int); /* adds a contact definition */ 00723 commandsmember *add_service_notification_command_to_contact(contact *,char *); /* adds a service notification command to a contact definition */ 00724 commandsmember *add_host_notification_command_to_contact(contact *,char *); /* adds a host notification command to a contact definition */ 00725 customvariablesmember *add_custom_variable_to_contact(contact *,char *,char *); /* adds a custom variable to a service definition */ 00726 host *add_host(char *,char *,char *,char *,char *,char *,int,double,double,int,int,int,int,int,int,double,double,char *,int,char *,int,int,char *,int,int,double,double,int,int,int,int,int,int,int,int,char *,int,int,char *,char *,char *,char *,char *,char *,char *,int,int,int,double,double,double,int,int,int,int,int); /* adds a host definition */ 00727 hostsmember *add_parent_host_to_host(host *,char *); /* adds a parent host to a host definition */ 00728 hostsmember *add_child_link_to_host(host *,host *); /* adds a child host to a host definition */ 00729 contactgroupsmember *add_contactgroup_to_host(host *,char *); /* adds a contactgroup to a host definition */ 00730 contactsmember *add_contact_to_host(host *,char *); /* adds a contact to a host definition */ 00731 customvariablesmember *add_custom_variable_to_host(host *,char *,char *); /* adds a custom variable to a host definition */ 00732 timeperiod *add_timeperiod(char *,char *); /* adds a timeperiod definition */ 00733 timeperiodexclusion *add_exclusion_to_timeperiod(timeperiod *,char *); /* adds an exclusion to a timeperiod */ 00734 timerange *add_timerange_to_timeperiod(timeperiod *,int,unsigned long,unsigned long); /* adds a timerange to a timeperiod definition */ 00735 daterange *add_exception_to_timeperiod(timeperiod *,int,int,int,int,int,int,int,int,int,int,int,int); 00736 timerange *add_timerange_to_daterange(daterange *,unsigned long,unsigned long); 00737 hostgroup *add_hostgroup(char *,char *,char *,char *,char *); /* adds a hostgroup definition */ 00738 hostsmember *add_host_to_hostgroup(hostgroup *, char *); /* adds a host to a hostgroup definition */ 00739 servicegroup *add_servicegroup(char *,char *,char *,char *,char *); /* adds a servicegroup definition */ 00740 servicesmember *add_service_to_servicegroup(servicegroup *,char *,char *); /* adds a service to a servicegroup definition */ 00741 contactgroup *add_contactgroup(char *,char *); /* adds a contactgroup definition */ 00742 contactsmember *add_contact_to_contactgroup(contactgroup *,char *); /* adds a contact to a contact group definition */ 00743 command *add_command(char *,char *); /* adds a command definition */ 00744 service *add_service(char *,char *,char *,char *,int,int,int,int,double,double,double,double,char *,int,int,int,int,int,int,int,int,char *,int,char *,int,int,double,double,int,int,int,int,int,int,int,int,int,int,char *,int,int,char *,char *,char *,char *,char *,int,int,int); /* adds a service definition */ 00745 contactgroupsmember *add_contactgroup_to_service(service *,char *); /* adds a contact group to a service definition */ 00746 contactsmember *add_contact_to_service(service *,char *); /* adds a contact to a host definition */ 00747 #ifndef USE_ST_BASED_ESCAL_RANGES 00748 serviceescalation *add_serviceescalation(char *,char *,int,int,double,char *,int,int,int,int); /* adds a service escalation definition */ 00749 #else 00750 serviceescalation *add_serviceescalation(char *,char *,int,int,int,int,int,int,int,int,double,char *,int,int,int,int); /* adds a service escalation definition */ 00751 #endif 00752 contactgroupsmember *add_contactgroup_to_serviceescalation(serviceescalation *,char *); /* adds a contact group to a service escalation definition */ 00753 contactsmember *add_contact_to_serviceescalation(serviceescalation *,char *); /* adds a contact to a service escalation definition */ 00754 customvariablesmember *add_custom_variable_to_service(service *,char *,char *); /* adds a custom variable to a service definition */ 00755 servicedependency *add_service_dependency(char *,char *,char *,char *,int,int,int,int,int,int,int,char *); /* adds a service dependency definition */ 00756 hostdependency *add_host_dependency(char *,char *,int,int,int,int,int,int,char *); /* adds a host dependency definition */ 00757 #ifndef USE_ST_BASED_ESCAL_RANGES 00758 hostescalation *add_hostescalation(char *,int,int,double,char *,int,int,int); /* adds a host escalation definition */ 00759 #else 00760 hostescalation *add_hostescalation(char *,int,int,int,int,int,int,double,char *,int,int,int); /* adds a host escalation definition */ 00761 #endif 00762 contactsmember *add_contact_to_hostescalation(hostescalation *,char *); /* adds a contact to a host escalation definition */ 00763 contactgroupsmember *add_contactgroup_to_hostescalation(hostescalation *,char *); /* adds a contact group to a host escalation definition */ 00764 00765 contactsmember *add_contact_to_object(contactsmember **,char *); /* adds a contact to an object */ 00766 customvariablesmember *add_custom_variable_to_object(customvariablesmember **,char *,char *); /* adds a custom variable to an object */ 00767 00768 00769 servicesmember *add_service_link_to_host(host *,service *); 00770 00771 escalation_condition *add_serviceescalation_condition(serviceescalation *, escalation_condition *, char *, char *, int, int, int, int, int, int, int); /* add a condition to a service escalation in memory */ 00772 escalation_condition *add_hostescalation_condition(hostescalation *, escalation_condition *, char *, char *, int, int, int, int, int, int, int); /* add a condition to a host escalation in memory */ 00773 00774 module *add_module(char *,char *,char *,char *); /* adds a module definition */ 00775 int add_module_objects_to_neb(void); /* add modules to neb, backwards compatible */ 00776 00777 /*** Object Skiplist Functions ****/ 00778 int init_object_skiplists(void); 00779 int free_object_skiplists(void); 00780 int skiplist_compare_text(const char *val1a, const char *val1b, const char *val2a, const char *val2b); 00781 int skiplist_compare_host(void *a, void *b); 00782 int skiplist_compare_service(void *a, void *b); 00783 int skiplist_compare_command(void *a, void *b); 00784 int skiplist_compare_timeperiod(void *a, void *b); 00785 int skiplist_compare_contact(void *a, void *b); 00786 int skiplist_compare_contactgroup(void *a, void *b); 00787 int skiplist_compare_hostgroup(void *a, void *b); 00788 int skiplist_compare_servicegroup(void *a, void *b); 00789 int skiplist_compare_hostescalation(void *a, void *b); 00790 int skiplist_compare_serviceescalation(void *a, void *b); 00791 int skiplist_compare_hostdependency(void *a, void *b); 00792 int skiplist_compare_servicedependency(void *a, void *b); 00793 int skiplist_compare_module(void *a, void *b); 00794 00795 int get_host_count(void); 00796 int get_service_count(void); 00797 00798 00799 00800 /**** Object Search Functions ****/ 00801 timeperiod * find_timeperiod(char *); /* finds a timeperiod object */ 00802 host * find_host(char *); /* finds a host object */ 00803 hostgroup * find_hostgroup(char *); /* finds a hostgroup object */ 00804 servicegroup * find_servicegroup(char *); /* finds a servicegroup object */ 00805 contact * find_contact(char *); /* finds a contact object */ 00806 contactgroup * find_contactgroup(char *); /* finds a contactgroup object */ 00807 command * find_command(char *); /* finds a command object */ 00808 service * find_service(char *,char *); /* finds a service object */ 00809 module * find_module(char *); /* finds a module object */ 00810 00811 00812 /**** Object Traversal Functions ****/ 00813 hostescalation *get_first_hostescalation_by_host(char *, void **); 00814 hostescalation *get_next_hostescalation_by_host(char *,void **); 00815 serviceescalation *get_first_serviceescalation_by_service(char *,char *, void **); 00816 serviceescalation *get_next_serviceescalation_by_service(char *,char *,void **); 00817 hostdependency *get_first_hostdependency_by_dependent_host(char *, void **); 00818 hostdependency *get_next_hostdependency_by_dependent_host(char *, void **); 00819 servicedependency *get_first_servicedependency_by_dependent_service(char *,char *, void **); 00820 servicedependency *get_next_servicedependency_by_dependent_service(char *,char *,void **); 00821 00822 #ifdef NSCORE 00823 int add_object_to_objectlist(objectlist **,void *); 00824 int free_objectlist(objectlist **); 00825 #endif 00826 00827 /**** Object Hash Functions ****/ 00828 int add_servicedependency_to_hashlist(servicedependency *); 00829 00830 00831 /**** Object Query Functions ****/ 00832 int is_host_immediate_child_of_host(host *,host *); /* checks if a host is an immediate child of another host */ 00833 int is_host_primary_immediate_child_of_host(host *,host *); /* checks if a host is an immediate child (and primary child) of another host */ 00834 int is_host_immediate_parent_of_host(host *,host *); /* checks if a host is an immediate child of another host */ 00835 int is_host_member_of_hostgroup(hostgroup *,host *); /* tests whether or not a host is a member of a specific hostgroup */ 00836 int is_host_member_of_servicegroup(servicegroup *,host *); /* tests whether or not a service is a member of a specific servicegroup */ 00837 int is_service_member_of_servicegroup(servicegroup *,service *); /* tests whether or not a service is a member of a specific servicegroup */ 00838 int is_contact_member_of_contactgroup(contactgroup *, contact *); /* tests whether or not a contact is a member of a specific contact group */ 00839 int is_contact_for_hostgroup(hostgroup *,contact *); /* tests whether or not a contact is a member of a specific hostgroup */ 00840 int is_contact_for_servicegroup(servicegroup *,contact *); /* tests whether or not a contact is a member of a specific servicegroup */ 00841 int is_contact_for_host(host *,contact *); /* tests whether or not a contact is a contact member for a specific host */ 00842 int is_escalated_contact_for_host(host *,contact *); /* checks whether or not a contact is an escalated contact for a specific host */ 00843 int is_contact_for_service(service *,contact *); /* tests whether or not a contact is a contact member for a specific service */ 00844 int is_escalated_contact_for_service(service *,contact *); /* checks whether or not a contact is an escalated contact for a specific service */ 00845 int is_host_immediate_parent_of_host(host *,host *); /* tests whether or not a host is an immediate parent of another host */ 00846 00847 int number_of_immediate_child_hosts(host *); /* counts the number of immediate child hosts for a particular host */ 00848 int number_of_total_child_hosts(host *); /* counts the number of total child hosts for a particular host */ 00849 int number_of_immediate_parent_hosts(host *); /* counts the number of immediate parents hosts for a particular host */ 00850 int number_of_total_parent_hosts(host *); /* counts the number of total parents hosts for a particular host */ 00851 00852 #ifdef NSCORE 00853 int check_for_circular_servicedependency_path(servicedependency *,servicedependency *,int); /* checks if a circular dependency exists for a given service */ 00854 int check_for_circular_hostdependency_path(hostdependency *,hostdependency *,int); /* checks if a circular dependency exists for a given host */ 00855 #endif 00856 00857 00858 /**** Object Cleanup Functions ****/ 00859 int free_object_data(void); /* frees all allocated memory for the object definitions */ 00860 00861 00862 00863 00864 #ifdef __cplusplus 00865 } 00866 #endif 00867 00868 #endif