File: pl.h

package info (click to toggle)
nagircbot 0.0.33-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 296 kB
  • sloc: cpp: 3,293; sh: 208; makefile: 90; ansic: 66
file content (117 lines) | stat: -rw-r--r-- 3,442 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/* (C) 2006-2010 by folkert@vanheusden.com GPLv2 applies */

#define TYPE_IGNORE	0
#define TYPE_HOST	1
#define TYPE_SERVICE	2

#define V1_0_MAX_ELEMENTS	32

#define VARTYPE_PCHAR	0
#define VARTYPE_INT	1
#define VARTYPE_TIMET	2
#define VARTYPE_DOUBLE	3

#define STATS_OFFSET(x)	(int)(offsetof(struct stats, x))

#define ST_HARD			1
#define ST_SOFT			0

struct v2_0_config
{
	char *str;
	int offset;
	int type;
};

struct stats
{
	int type;

	char *host_name;
	int current_state;
	char *service_description;
	char *plugin_output;
	time_t last_state_change;
	int active_checks_enabled;
	int passive_checks_enabled;
	int notifications_enabled;
	int problem_has_been_acknowledged;
	double scheduled_downtime_depth;
	int state_type;
	int last_hard_state;
        double percent_state_change;
        double check_execution_time;
        double check_latency;
	int modified_attributes;
	int event_handler;
	int has_been_checked;
	int should_be_scheduled;
	int current_attempt;
	int max_attempts;
	int last_hard_state_change;
	int last_time_ok;
	int last_time_warning;
	int last_time_unknown;
	int last_time_critical;
	time_t last_check;
	time_t next_check;
	int check_type;
	double current_notification_number;
	int last_notification;
	int next_notification;
	int no_more_notifications;
	int event_handler_enabled;
	int acknowledgement_type;
	int flap_detection_enabled;
	int failure_prediction_enabled;
	int process_performance_data;
	int obsess_over_service;
	int obsess_over_host;
	time_t last_update;
	int is_flapping;
	char * performance_data;
	char * check_command;
	int last_time_up;
	int last_time_down;
	int last_time_unreachable;
	/* newly added in 3.0 */
	char *author;
	double check_interval;
	int check_options;
	char *check_period;
	char *comment_data;
	int comment_id;
	int current_event_id;
	int current_notification_id;
	int current_problem_id;
	time_t entry_time;
	int entry_type;
	int expires;
	time_t expire_time;
	char *host_notification_period;
	int last_event_id;
	int last_problem_id;
	char *long_plugin_output;
	int next_comment_id;
	char *notification_period;
	int persistent;
	double retry_interval;
	char *service_notification_period;
	int source;
	int downtime_id;
	time_t start_time, end_time;
	int triggered_by;
	int fixed;
	int duration;
	char *comment;
};

void parse_1_0_statuslog(int fd, struct stats **pstats, int *n_stats);
void parse_2_0_statuslog(int fd, struct stats **pstats, int *n_stats);
void free_stats_array(struct stats *pstats, int n_stats);
void sort_stats_array(struct stats *pstats, int n_stats);
int host_is_down(struct stats *pstats, int n_stats, char *host_name);
int should_i_show_entry(struct stats *pstats, int n_stats, int cur_index, char list_all_problems, char always_notify, char also_acknowledged, char hide_ok);
int find_index_by_host_and_service(struct stats *pstats, int n_stats, char *host_name, char *service_description);
int check_max_age_last_check(struct stats *pstats, int n_stats, int max_time_last_host_update, int max_time_oldest_host_update, int max_time_last_host_check, int max_time_oldest_host_check, int max_time_last_service_check, int max_time_oldest_service_check, int max_time_oldest_next_service_check, char **message);
void calc_stats_stats(struct stats *pstats, int n_stats, char list_all_problems, char always_notify, char also_acknowledged, char hide_ok, int *n_critical, int *n_warning, int *n_ok, int *n_up, int *n_down, int *n_unreachable, int *n_pending);