Icinga-core 1.4.0
next gen monitoring
cgi/trends.c File Reference
#include "../include/config.h"
#include "../include/common.h"
#include "../include/objects.h"
#include "../include/comments.h"
#include "../include/statusdata.h"
#include "../include/readlogs.h"
#include "../include/cgiutils.h"
#include "../include/getcgi.h"
#include "../include/cgiauth.h"
#include <gd.h>
#include <gdfonts.h>
#include "../include/skiplist.h"

Go to the source code of this file.

Data Structures

struct  archived_state_struct

Defines

#define AS_CURRENT_STATE   -1
#define AS_NO_DATA   0
#define AS_PROGRAM_END   1
#define AS_PROGRAM_START   2
#define AS_HOST_UP   3
#define AS_HOST_DOWN   4
#define AS_HOST_UNREACHABLE   5
#define AS_SVC_OK   6
#define AS_SVC_UNKNOWN   7
#define AS_SVC_WARNING   8
#define AS_SVC_CRITICAL   9
#define AS_SOFT_STATE   1
#define AS_HARD_STATE   2
#define DISPLAY_HOST_TRENDS   0
#define DISPLAY_SERVICE_TRENDS   1
#define DISPLAY_NO_TRENDS   2
#define GET_INPUT_NONE   0
#define GET_INPUT_TARGET_TYPE   1
#define GET_INPUT_HOST_TARGET   2
#define GET_INPUT_SERVICE_TARGET   3
#define GET_INPUT_OPTIONS   4
#define MIN_TIMESTAMP_SPACING   10
#define MAX_ARCHIVE_SPREAD   65
#define MAX_ARCHIVE   65
#define MAX_ARCHIVE_BACKTRACKS   60
#define HOST_DRAWING_WIDTH   498
#define HOST_DRAWING_HEIGHT   70
#define HOST_DRAWING_X_OFFSET   116
#define HOST_DRAWING_Y_OFFSET   55
#define SVC_DRAWING_WIDTH   498
#define SVC_DRAWING_HEIGHT   90
#define SVC_DRAWING_X_OFFSET   116
#define SVC_DRAWING_Y_OFFSET   55
#define SMALL_HOST_DRAWING_WIDTH   500
#define SMALL_HOST_DRAWING_HEIGHT   20
#define SMALL_HOST_DRAWING_X_OFFSET   0
#define SMALL_HOST_DRAWING_Y_OFFSET   0
#define SMALL_SVC_DRAWING_WIDTH   500
#define SMALL_SVC_DRAWING_HEIGHT   20
#define SMALL_SVC_DRAWING_X_OFFSET   0
#define SMALL_SVC_DRAWING_Y_OFFSET   0

Typedefs

typedef struct
archived_state_struct 
archived_state

Functions

void graph_all_trend_data (void)
void graph_trend_data (int, int, time_t, time_t, time_t, char *)
void draw_timestamps (void)
void draw_timestamp (int, time_t)
void draw_time_breakdowns (void)
void draw_horizontal_grid_lines (void)
void draw_dashed_line (int, int, int, int, int)
int convert_host_state_to_archived_state (int)
int convert_service_state_to_archived_state (int)
void add_archived_state (int, int, time_t, char *)
void free_archived_state_list (void)
void read_archived_state_data (void)
void scan_log_file_for_archived_state_data (char *)
void scan_log_file_for_archived_state_data_old (char *)
void compute_report_times (void)
void get_time_breakdown_string (unsigned long, unsigned long, char *, char *buffer, int)
int process_cgivars (void)
int main (int argc, char **argv)

Variables

char main_config_file [MAX_FILENAME_LENGTH]
char url_html_path [MAX_FILENAME_LENGTH]
char url_images_path [MAX_FILENAME_LENGTH]
char url_stylesheets_path [MAX_FILENAME_LENGTH]
char url_js_path [MAX_FILENAME_LENGTH]
char physical_images_path [MAX_FILENAME_LENGTH]
int log_rotation_method
hosthost_list
serviceservice_list
logentryentry_list
skiplistobject_skiplists [NUM_OBJECT_SKIPLISTS]
authdata current_authdata
archived_stateas_list = NULL
time_t t1
time_t t2
int start_second = 0
int start_minute = 0
int start_hour = 0
int start_day = 1
int start_month = 1
int start_year = 2000
int end_second = 0
int end_minute = 0
int end_hour = 24
int end_day = 1
int end_month = 1
int end_year = 2000
int content_type
int input_type = GET_INPUT_NONE
int timeperiod_type = TIMEPERIOD_LAST24HOURS
int compute_time_from_parts = FALSE
int display_popups = TRUE
int use_map = TRUE
int small_image = FALSE
int embedded
int display_header
int daemon_check
int assume_initial_states = TRUE
int assume_state_retention = TRUE
int assume_states_during_notrunning = TRUE
int include_soft_states = FALSE
int ignore_daemon_restart = FALSE
gdImagePtr trends_image = 0
int color_white = 0
int color_black = 0
int color_red = 0
int color_darkred = 0
int color_green = 0
int color_darkgreen = 0
int color_yellow = 0
int color_orange = 0
FILE * image_file = NULL
int image_width = 900
int image_height = 300
int drawing_width = 0
int drawing_height = 0
int drawing_x_offset = 0
int drawing_y_offset = 0
int last_known_state = AS_NO_DATA
int zoom_factor = 4
int backtrack_archives = 2
int earliest_archive = 0
time_t earliest_time
time_t latest_time
int earliest_state = AS_NO_DATA
int latest_state = AS_NO_DATA
int initial_assumed_host_state = AS_NO_DATA
int initial_assumed_service_state = AS_NO_DATA
unsigned long time_up = 0L
unsigned long time_down = 0L
unsigned long time_unreachable = 0L
unsigned long time_ok = 0L
unsigned long time_warning = 0L
unsigned long time_unknown = 0L
unsigned long time_critical = 0L
int problem_found
int display_type = DISPLAY_NO_TRENDS
int show_all_hosts = TRUE
int show_all_hostgroups = TRUE
int show_all_servicegroups = TRUE
char * host_name = ""
char * host_filter = NULL
char * hostgroup_name = NULL
char * servicegroup_name = NULL
char * service_desc = ""
char * service_filter = NULL
int CGI_ID = TRENDS_CGI_ID

Define Documentation

#define AS_CURRENT_STATE   -1

Definition at line 60 of file trends.c.

#define AS_HARD_STATE   2

Definition at line 73 of file trends.c.

#define AS_HOST_DOWN   4

Definition at line 65 of file trends.c.

#define AS_HOST_UNREACHABLE   5

Definition at line 66 of file trends.c.

#define AS_HOST_UP   3

Definition at line 64 of file trends.c.

#define AS_NO_DATA   0

Definition at line 61 of file trends.c.

#define AS_PROGRAM_END   1

Definition at line 62 of file trends.c.

#define AS_PROGRAM_START   2

Definition at line 63 of file trends.c.

#define AS_SOFT_STATE   1

Definition at line 72 of file trends.c.

#define AS_SVC_CRITICAL   9

Definition at line 70 of file trends.c.

#define AS_SVC_OK   6

Definition at line 67 of file trends.c.

#define AS_SVC_UNKNOWN   7

Definition at line 68 of file trends.c.

#define AS_SVC_WARNING   8

Definition at line 69 of file trends.c.

#define DISPLAY_HOST_TRENDS   0

Definition at line 76 of file trends.c.

#define DISPLAY_NO_TRENDS   2

Definition at line 78 of file trends.c.

#define DISPLAY_SERVICE_TRENDS   1

Definition at line 77 of file trends.c.

#define GET_INPUT_HOST_TARGET   2

Definition at line 83 of file trends.c.

#define GET_INPUT_NONE   0

Definition at line 81 of file trends.c.

#define GET_INPUT_OPTIONS   4

Definition at line 85 of file trends.c.

#define GET_INPUT_SERVICE_TARGET   3

Definition at line 84 of file trends.c.

#define GET_INPUT_TARGET_TYPE   1

Definition at line 82 of file trends.c.

#define HOST_DRAWING_HEIGHT   70

Definition at line 177 of file trends.c.

#define HOST_DRAWING_WIDTH   498

Definition at line 176 of file trends.c.

#define HOST_DRAWING_X_OFFSET   116

Definition at line 178 of file trends.c.

#define HOST_DRAWING_Y_OFFSET   55

Definition at line 179 of file trends.c.

#define MAX_ARCHIVE   65

Definition at line 90 of file trends.c.

#define MAX_ARCHIVE_BACKTRACKS   60

Definition at line 91 of file trends.c.

#define MAX_ARCHIVE_SPREAD   65

Definition at line 89 of file trends.c.

#define MIN_TIMESTAMP_SPACING   10

Definition at line 87 of file trends.c.

#define SMALL_HOST_DRAWING_HEIGHT   20

Definition at line 187 of file trends.c.

#define SMALL_HOST_DRAWING_WIDTH   500

Definition at line 186 of file trends.c.

#define SMALL_HOST_DRAWING_X_OFFSET   0

Definition at line 188 of file trends.c.

#define SMALL_HOST_DRAWING_Y_OFFSET   0

Definition at line 189 of file trends.c.

#define SMALL_SVC_DRAWING_HEIGHT   20

Definition at line 192 of file trends.c.

#define SMALL_SVC_DRAWING_WIDTH   500

Definition at line 191 of file trends.c.

#define SMALL_SVC_DRAWING_X_OFFSET   0

Definition at line 193 of file trends.c.

#define SMALL_SVC_DRAWING_Y_OFFSET   0

Definition at line 194 of file trends.c.

#define SVC_DRAWING_HEIGHT   90

Definition at line 182 of file trends.c.

#define SVC_DRAWING_WIDTH   498

Definition at line 181 of file trends.c.

#define SVC_DRAWING_X_OFFSET   116

Definition at line 183 of file trends.c.

#define SVC_DRAWING_Y_OFFSET   55

Definition at line 184 of file trends.c.


Typedef Documentation


Function Documentation

void add_archived_state ( int  entry_type,
int  state_type,
time_t  time_stamp,
char *  state_info 
)

Definition at line 2301 of file trends.c.

void compute_report_times ( void  )
int convert_host_state_to_archived_state ( int  current_status)
int convert_service_state_to_archived_state ( int  current_status)
void draw_dashed_line ( int  x1,
int  y1,
int  x2,
int  y2,
int  color 
)
void draw_horizontal_grid_lines ( void  )

Definition at line 2821 of file trends.c.

void draw_time_breakdowns ( void  )

Definition at line 2668 of file trends.c.

void draw_timestamp ( int  ts_pixel,
time_t  ts_time 
)

Definition at line 2643 of file trends.c.

void draw_timestamps ( void  )

Definition at line 2607 of file trends.c.

void free_archived_state_list ( void  )

Definition at line 2356 of file trends.c.

void get_time_breakdown_string ( unsigned long  total_time,
unsigned long  state_time,
char *  state_string,
char *  buffer,
int  buffer_length 
)

Definition at line 2739 of file trends.c.

void graph_all_trend_data ( void  )

Definition at line 1668 of file trends.c.

void graph_trend_data ( int  first_state,
int  last_state,
time_t  real_start_time,
time_t  start_time,
time_t  end_time,
char *  state_info 
)

Definition at line 1982 of file trends.c.

int main ( int  argc,
char **  argv 
)

Definition at line 239 of file trends.c.

int process_cgivars ( void  )
void read_archived_state_data ( void  )
void scan_log_file_for_archived_state_data ( char *  filename)
void scan_log_file_for_archived_state_data_old ( char *  )

Variable Documentation

Definition at line 105 of file trends.c.

Definition at line 135 of file trends.c.

Definition at line 136 of file trends.c.

Definition at line 137 of file trends.c.

Definition at line 205 of file trends.c.

int CGI_ID = TRENDS_CGI_ID

ID to identify the cgi for functions in cgiutils.c

Definition at line 237 of file trends.c.

int color_black = 0

Definition at line 164 of file trends.c.

int color_darkgreen = 0

Definition at line 168 of file trends.c.

int color_darkred = 0

Definition at line 166 of file trends.c.

int color_green = 0

Definition at line 167 of file trends.c.

int color_orange = 0

Definition at line 170 of file trends.c.

int color_red = 0

Definition at line 165 of file trends.c.

int color_white = 0

Definition at line 163 of file trends.c.

int color_yellow = 0

Definition at line 169 of file trends.c.

Definition at line 126 of file trends.c.

Definition at line 165 of file cgiutils.c.

Definition at line 93 of file trends.c.

Definition at line 169 of file cgiutils.c.

Definition at line 167 of file cgiutils.c.

int display_popups = TRUE

Definition at line 128 of file trends.c.

int display_type = DISPLAY_NO_TRENDS

determine the view (host/service)

Definition at line 225 of file trends.c.

int drawing_height = 0

Definition at line 197 of file trends.c.

int drawing_width = 0

Definition at line 196 of file trends.c.

Definition at line 199 of file trends.c.

Definition at line 200 of file trends.c.

Definition at line 206 of file trends.c.

int earliest_state = AS_NO_DATA

Definition at line 209 of file trends.c.

time_t earliest_time

Definition at line 207 of file trends.c.

int embedded

Definition at line 166 of file cgiutils.c.

int end_day = 1

Definition at line 119 of file trends.c.

int end_hour = 24

Definition at line 118 of file trends.c.

int end_minute = 0

Definition at line 117 of file trends.c.

int end_month = 1

Definition at line 120 of file trends.c.

int end_second = 0

Definition at line 116 of file trends.c.

int end_year = 2000

Definition at line 121 of file trends.c.

the list with all current logentries

Definition at line 36 of file readlogs.c.

char* host_filter = NULL

Definition at line 231 of file trends.c.

Definition at line 52 of file objects.c.

char* host_name = ""

requested host name

the requested host name

Definition at line 230 of file trends.c.

char* hostgroup_name = NULL

requested hostgroup name

Definition at line 232 of file trends.c.

int ignore_daemon_restart = FALSE

Definition at line 139 of file trends.c.

FILE* image_file = NULL

Definition at line 171 of file trends.c.

int image_height = 300

Definition at line 174 of file trends.c.

int image_width = 900

Definition at line 173 of file trends.c.

int include_soft_states = FALSE

Definition at line 138 of file trends.c.

int initial_assumed_host_state = AS_NO_DATA

Definition at line 212 of file trends.c.

Definition at line 213 of file trends.c.

int input_type = GET_INPUT_NONE

Definition at line 124 of file trends.c.

int last_known_state = AS_NO_DATA

Definition at line 202 of file trends.c.

int latest_state = AS_NO_DATA

Definition at line 210 of file trends.c.

time_t latest_time

Definition at line 208 of file trends.c.

the log rotation method of the main Icinga log file see common.h

readlogs.c

Definition at line 174 of file icinga.c.

char main_config_file[MAX_FILENAME_LENGTH]

Definition at line 50 of file icingastats.c.

skiplist* object_skiplists[NUM_OBJECT_SKIPLISTS]

Definition at line 66 of file objects.c.

char physical_images_path[MAX_FILENAME_LENGTH]

Definition at line 36 of file cgiutils.c.

Definition at line 223 of file trends.c.

char* service_desc = ""

requested service name

the requested service name

Definition at line 234 of file trends.c.

char* service_filter = NULL

Definition at line 235 of file trends.c.

Definition at line 53 of file objects.c.

char* servicegroup_name = NULL

requested servicegroup name

Definition at line 233 of file trends.c.

int show_all_hostgroups = TRUE

Definition at line 227 of file trends.c.

int show_all_hosts = TRUE

if historical data is requested for all hosts

Definition at line 226 of file trends.c.

Definition at line 228 of file trends.c.

int small_image = FALSE

Definition at line 130 of file trends.c.

int start_day = 1

Definition at line 113 of file trends.c.

int start_hour = 0

Definition at line 112 of file trends.c.

int start_minute = 0

Definition at line 111 of file trends.c.

int start_month = 1

Definition at line 114 of file trends.c.

int start_second = 0

Definition at line 110 of file trends.c.

int start_year = 2000

Definition at line 115 of file trends.c.

time_t t1

Definition at line 107 of file trends.c.

time_t t2

Definition at line 108 of file trends.c.

unsigned long time_critical = 0L

Definition at line 221 of file trends.c.

unsigned long time_down = 0L

Definition at line 216 of file trends.c.

unsigned long time_ok = 0L

Definition at line 218 of file trends.c.

unsigned long time_unknown = 0L

Definition at line 220 of file trends.c.

unsigned long time_unreachable = 0L

Definition at line 217 of file trends.c.

unsigned long time_up = 0L

Definition at line 215 of file trends.c.

unsigned long time_warning = 0L

Definition at line 219 of file trends.c.

int timeperiod_type = TIMEPERIOD_LAST24HOURS

Definition at line 125 of file trends.c.

gdImagePtr trends_image = 0

Definition at line 162 of file trends.c.

char url_html_path[MAX_FILENAME_LENGTH]

Definition at line 38 of file cgiutils.c.

char url_images_path[MAX_FILENAME_LENGTH]

Definition at line 41 of file cgiutils.c.

char url_js_path[MAX_FILENAME_LENGTH]

Definition at line 44 of file cgiutils.c.

char url_stylesheets_path[MAX_FILENAME_LENGTH]

Definition at line 43 of file cgiutils.c.

int use_map = TRUE

Definition at line 129 of file trends.c.

int zoom_factor = 4

Definition at line 204 of file trends.c.

 All Data Structures Files Functions Variables Typedefs Defines