12 #include <nagios/broker.h>
13 #include <nagios/nebcallbacks.h>
16 #define CLR_RESET "\033[m"
17 #define CLR_BOLD "\033[1m"
18 #define CLR_RED "\033[31m"
19 #define CLR_GREEN "\033[32m"
20 #define CLR_BROWN "\033[33m"
21 #define CLR_YELLOW "\033[33m\033[1m"
22 #define CLR_BLUE "\033[34m"
23 #define CLR_MAGENTA "\033[35m"
24 #define CLR_CYAN "\033[36m"
25 #define CLR_BG_RED "\033[41m"
26 #define CLR_BRIGHT_RED "\033[31m\033[1m"
27 #define CLR_BRIGHT_GREEN "\033[32m\033[1m"
28 #define CLR_BRIGHT_BLUE "\033[34m\033[1m"
29 #define CLR_BRIGHT_MAGENTA "\033[35m\033[1m"
30 #define CLR_BRIGHT_CYAN "\033[36m\033[1m"
32 #define prefixcmp(s1, s2) strncmp(s1, s2, strlen(s2))
34 /* for the string code structs */
35 #define add_code(n, s, c) { n, s, sizeof(s) - 1, c, }
36 #define add_ignored(s) add_code(0, s, IGNORE_LINE)
37 #define add_cdef(__nvecs, __define) add_code(__nvecs, #__define, __define)
38 #define get_event_type(str, len) get_string_code(event_codes, str, len)
39 #define get_command_type(str, len) get_string_code(command_codes, str, len)
43 #define CONCERNS_HOST 50
44 #define CONCERNS_SERVICE 60
46 #define DEL_HOST_DOWNTIME 1
47 #define DEL_SVC_DOWNTIME 2
48 #define SCHEDULE_AND_PROPAGATE_HOST_DOWNTIME 3
49 #define SCHEDULE_AND_PROPAGATE_TRIGGERED_HOST_DOWNTIME 4
50 #define SCHEDULE_HOSTGROUP_HOST_DOWNTIME 5
51 #define SCHEDULE_HOSTGROUP_SVC_DOWNTIME 6
52 #define SCHEDULE_HOST_DOWNTIME 7
53 #define SCHEDULE_HOST_SVC_DOWNTIME 8
54 #define SCHEDULE_SERVICEGROUP_HOST_DOWNTIME 9
55 #define SCHEDULE_SERVICEGROUP_SVC_DOWNTIME 10
56 #define SCHEDULE_SVC_DOWNTIME 11
57 #define ACKNOWLEDGE_HOST_PROBLEM 12
58 #define ACKNOWLEDGE_SVC_PROBLEM 13
59 #define RESTART_PROGRAM 14
61 /* for some reason these aren't defined inside Nagios' headers */
63 #define SERVICE_WARNING 1
64 #define SERVICE_CRITICAL 2
65 #define SERVICE_UNKNOWN 3
67 typedef unsigned int uint
;
75 extern struct naglog_file
*nfile
;
84 extern int debug_level
;
86 extern struct naglog_file
*cur_file
; /* the file we're currently importing */
88 extern uint num_unhandled
;
91 extern int vectorize_string(char *str
, int nvecs
);
92 extern void handle_unknown_event(const char *line
);
93 extern void print_unhandled_events(void);
95 extern int parse_service_state(const char *str
);
96 extern int parse_host_state(const char *str
);
97 extern int soft_hard(const char *str
);
99 extern void print_interesting_objects(void);
100 extern int add_interesting_object(const char *orig_str
);
101 extern int is_interesting_host(const char *host
);
102 extern int is_interesting_service(const char *host
, const char *service
);
103 extern int is_interesting(const char *ptr
);
104 extern int is_start_event(const char *ptr
);
105 extern int is_stop_event(const char *ptr
);
106 extern int add_naglog_path(char *path
);
109 extern struct string_code
*get_string_code(struct string_code
*codes
,
110 const char *str
, uint len
);
112 extern uint warnings
;
113 extern void crash(const char *fmt
, ...)
114 __attribute__((__format__(__printf__
, 1, 2), __noreturn__
));
115 extern void pdebug(int lvl
, const char *fmt
, ...)
116 __attribute__((__format__(__printf__
, 2, 3)));
117 #define debug(...) pdebug(1, __VA_ARGS__)
118 extern void warn(const char *fmt
, ...);
120 int strtotimet(const char *str
, time_t *val
);
123 extern uint
path_cmp_number(char *path
);
124 extern void first_log_time(struct naglog_file
*nf
);
125 extern int nfile_cmp(const void *p1
, const void *p2
);
126 extern int nfile_rev_cmp(const void *p1
, const void *p2
);