import: Fix progress output ETA when skipping files
[nagios-reports-module.git] / nagios / statusdata.h
blob7e886c1dea2276900fd05e9bcc3ebf3466451784
1 /*****************************************************************************
3 * STATUSDATA.H - Header for external status data routines
5 * Copyright (c) 2000-2007 Ethan Galstad (nagios@nagios.org)
6 * Last Modified: 10-19-2007
8 * License:
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 *****************************************************************************/
25 #ifndef _STATUSDATA_H
26 #define _STATUSDATA_H
28 #ifdef NSCORE
29 #include "objects.h"
30 #endif
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
36 #ifdef NSCGI
38 #define READ_PROGRAM_STATUS 1
39 #define READ_HOST_STATUS 2
40 #define READ_SERVICE_STATUS 4
41 #define READ_CONTACT_STATUS 8
43 #define READ_ALL_STATUS_DATA READ_PROGRAM_STATUS | READ_HOST_STATUS | READ_SERVICE_STATUS | READ_CONTACT_STATUS
47 /*************************** CHAINED HASH LIMITS ***************************/
49 #define SERVICESTATUS_HASHSLOTS 1024
50 #define HOSTSTATUS_HASHSLOTS 1024
53 /**************************** DATA STRUCTURES ******************************/
56 /* HOST STATUS structure */
57 typedef struct hoststatus_struct{
58 char *host_name;
59 char *plugin_output;
60 char *long_plugin_output;
61 char *perf_data;
62 int status;
63 time_t last_update;
64 int has_been_checked;
65 int should_be_scheduled;
66 int current_attempt;
67 int max_attempts;
68 time_t last_check;
69 time_t next_check;
70 int check_options;
71 int check_type;
72 time_t last_state_change;
73 time_t last_hard_state_change;
74 int last_hard_state;
75 time_t last_time_up;
76 time_t last_time_down;
77 time_t last_time_unreachable;
78 int state_type;
79 time_t last_notification;
80 time_t next_notification;
81 int no_more_notifications;
82 int notifications_enabled;
83 int problem_has_been_acknowledged;
84 int acknowledgement_type;
85 int current_notification_number;
86 int accept_passive_host_checks;
87 int event_handler_enabled;
88 int checks_enabled;
89 int flap_detection_enabled;
90 int is_flapping;
91 double percent_state_change;
92 double latency;
93 double execution_time;
94 int scheduled_downtime_depth;
95 int failure_prediction_enabled;
96 int process_performance_data;
97 int obsess_over_host;
98 struct hoststatus_struct *next;
99 struct hoststatus_struct *nexthash;
100 }hoststatus;
103 /* SERVICE STATUS structure */
104 typedef struct servicestatus_struct{
105 char *host_name;
106 char *description;
107 char *plugin_output;
108 char *long_plugin_output;
109 char *perf_data;
110 int max_attempts;
111 int current_attempt;
112 int status;
113 time_t last_update;
114 int has_been_checked;
115 int should_be_scheduled;
116 time_t last_check;
117 time_t next_check;
118 int check_options;
119 int check_type;
120 int checks_enabled;
121 time_t last_state_change;
122 time_t last_hard_state_change;
123 int last_hard_state;
124 time_t last_time_ok;
125 time_t last_time_warning;
126 time_t last_time_unknown;
127 time_t last_time_critical;
128 int state_type;
129 time_t last_notification;
130 time_t next_notification;
131 int no_more_notifications;
132 int notifications_enabled;
133 int problem_has_been_acknowledged;
134 int acknowledgement_type;
135 int current_notification_number;
136 int accept_passive_service_checks;
137 int event_handler_enabled;
138 int flap_detection_enabled;
139 int is_flapping;
140 double percent_state_change;
141 double latency;
142 double execution_time;
143 int scheduled_downtime_depth;
144 int failure_prediction_enabled;
145 int process_performance_data;
146 int obsess_over_service;
147 struct servicestatus_struct *next;
148 struct servicestatus_struct *nexthash;
149 }servicestatus;
152 /*************************** SERVICE STATES ***************************/
154 #define SERVICE_PENDING 1
155 #define SERVICE_OK 2
156 #define SERVICE_WARNING 4
157 #define SERVICE_UNKNOWN 8
158 #define SERVICE_CRITICAL 16
162 /**************************** HOST STATES ****************************/
164 #define HOST_PENDING 1
165 #define HOST_UP 2
166 #define HOST_DOWN 4
167 #define HOST_UNREACHABLE 8
171 /**************************** FUNCTIONS ******************************/
173 int read_status_data(char *,int); /* reads all status data */
174 int add_host_status(hoststatus *); /* adds a host status entry to the list in memory */
175 int add_service_status(servicestatus *); /* adds a service status entry to the list in memory */
177 int add_hoststatus_to_hashlist(hoststatus *);
178 int add_servicestatus_to_hashlist(servicestatus *);
180 servicestatus *find_servicestatus(char *,char *); /* finds status information for a specific service */
181 hoststatus *find_hoststatus(char *); /* finds status information for a specific host */
182 int get_servicestatus_count(char *,int); /* gets total number of services of a certain type for a specific host */
184 void free_status_data(void); /* free all memory allocated to status data */
185 #endif
187 #ifdef NSCORE
188 int initialize_status_data(char *); /* initializes status data at program start */
189 int update_all_status_data(void); /* updates all status data */
190 int cleanup_status_data(char *,int); /* cleans up status data at program termination */
191 int update_program_status(int); /* updates program status data */
192 int update_host_status(host *,int); /* updates host status data */
193 int update_service_status(service *,int); /* updates service status data */
194 int update_contact_status(contact *,int); /* updates contact status data */
195 #endif
197 #ifdef __cplusplus
199 #endif
201 #endif