base/utils.c File Reference

#include "../include/config.h"
#include "../include/common.h"
#include "../include/objects.h"
#include "../include/statusdata.h"
#include "../include/comments.h"
#include "../include/macros.h"
#include "../include/icinga.h"
#include "../include/netutils.h"
#include "../include/broker.h"
#include "../include/nebmods.h"
#include "../include/nebmodules.h"
#include "../include/epn_icinga.h"

Functions

int my_system_r (icinga_macros *mac, char *cmd, int timeout, int *early_timeout, double *exectime, char **output, int max_output_length)
int my_system (char *cmd, int timeout, int *early_timeout, double *exectime, char **output, int max_output_length)
int get_raw_command_line_r (icinga_macros *mac, command *cmd_ptr, char *cmd, char **full_command, int macro_options)
int get_raw_command_line (command *cmd_ptr, char *cmd, char **full_command, int macro_options)
int set_environment_var (char *name, char *value, int set)
int check_time_against_period (time_t test_time, timeperiod *tperiod)
void _get_next_valid_time (time_t pref_time, time_t current_time, time_t *valid_time, timeperiod *tperiod)
void get_earliest_time (time_t pref_time, time_t *valid_time, time_t current_time, timeperiod *tperiod, int level)
void _get_next_valid_time_per_timeperiod (time_t pref_time, time_t *valid_time, time_t current_time, timeperiod *tperiod)
void get_min_invalid_time_per_timeperiod (time_t pref_time, time_t *valid_time, time_t current_time, timeperiod *tperiod)
void get_next_valid_time (time_t pref_time, time_t *valid_time, timeperiod *tperiod)
int is_daterange_single_day (daterange *dr)
time_t calculate_time_from_day_of_month (int year, int month, int monthday)
time_t calculate_time_from_weekday_of_month (int year, int month, int weekday, int weekday_offset)
time_t get_next_log_rotation_time (void)
void setup_sighandler (void)
void reset_sighandler (void)
void sighandler (int sig)
void service_check_sighandler (int sig)
void host_check_sighandler (int sig)
void my_system_sighandler (int sig)
int daemon_init (void)
int drop_privileges (char *user, char *group)
int move_check_result_to_queue (char *checkresult_file)
int process_check_result_queue (char *dirname)
int process_check_result_file (char *fname)
int delete_check_result_file (char *fname)
check_resultread_check_result (void)
int init_check_result (check_result *info)
int add_check_result_to_list (check_result *new_cr)
int free_check_result_list (void)
int free_check_result (check_result *info)
int parse_check_output (char *buf, char **short_output, char **long_output, char **perf_data, int escape_newlines_please, int newlines_are_escaped)
int open_command_file (void)
int close_command_file (void)
char * get_next_string_from_buf (char *buf, int *start_index, int bufsize)
int contains_illegal_object_chars (char *name)
char * escape_newlines (char *rawbuf)
int compare_strings (char *val1a, char *val2a)
int my_rename (char *source, char *dest)
int my_fdcopy (char *source, char *dest, int dest_fd)
int my_fcopy (char *source, char *dest)
int dbuf_init (dbuf *db, int chunk_size)
int dbuf_free (dbuf *db)
int dbuf_strcat (dbuf *db, char *buf)
int init_embedded_perl (char **env)
int deinit_embedded_perl (void)
int file_uses_embedded_perl (char *fname)
int init_command_file_worker_thread (void)
int shutdown_command_file_worker_thread (void)
void cleanup_command_file_worker_thread (void *arg)
void * command_file_worker_thread (void *arg)
int submit_external_command (char *cmd, int *buffer_items)
int submit_raw_external_command (char *cmd, time_t *ts, int *buffer_items)
int init_check_stats (void)
int update_check_stats (int check_type, time_t check_time)
int generate_check_stats (void)
char * get_program_version (void)
char * get_program_modification_date (void)
int has_shell_metachars (const char *s)
void cleanup (void)
void free_memory (icinga_macros *mac)
void free_notification_list (void)
int reset_variables (void)

Variables

static PerlInterpreter * my_perl = NULL
int use_embedded_perl = TRUE
char * config_file
char * log_file
char * command_file
char * temp_file
char * temp_path
char * check_result_path
char * check_result_path
char * lock_file
char * log_archive_path
char * auth_file
char * p1_file
char * nagios_user
char * nagios_group
char * macro_x_names [MACRO_X_COUNT]
char * macro_user [MAX_USER_MACROS]
customvariablesmembermacro_custom_host_vars
customvariablesmembermacro_custom_service_vars
customvariablesmembermacro_custom_contact_vars
hostmacro_host_ptr
hostgroupmacro_hostgroup_ptr
servicemacro_service_ptr
servicegroupmacro_servicegroup_ptr
contactmacro_contact_ptr
contactgroupmacro_contactgroup_ptr
char * global_host_event_handler
char * global_service_event_handler
commandglobal_host_event_handler_ptr
commandglobal_service_event_handler_ptr
char * ocsp_command
char * ochp_command
commandocsp_command_ptr
commandochp_command_ptr
char * illegal_object_chars
char * illegal_output_chars
int use_regexp_matches
int use_true_regexp_matching
int sigshutdown
int sigrestart
char * sigs [35]
int caught_signal
int sig_id
int daemon_mode
int daemon_dumps_core
int nagios_pid
int use_daemon_log
int use_syslog
int use_syslog_local_facility
int syslog_local_facility
int log_notifications
int log_service_retries
int log_host_retries
int log_event_handlers
int log_external_commands
int log_external_commands_user
int log_passive_checks
unsigned long logging_options
unsigned long syslog_options
int service_check_timeout
int service_check_timeout_state
int host_check_timeout
int event_handler_timeout
int notification_timeout
int ocsp_timeout
int ochp_timeout
int log_initial_states
double sleep_time
int interval_length
int service_inter_check_delay_method
int host_inter_check_delay_method
int service_interleave_factor_method
int max_host_check_spread
int max_service_check_spread
int command_check_interval
int check_reaper_interval
int max_check_reaper_time
int service_freshness_check_interval
int host_freshness_check_interval
int auto_rescheduling_interval
int auto_rescheduling_window
int check_external_commands
int check_orphaned_services
int check_orphaned_hosts
int check_service_freshness
int check_host_freshness
int auto_reschedule_checks
int additional_freshness_latency
int use_aggressive_host_checking
unsigned long cached_host_check_horizon
unsigned long cached_service_check_horizon
int enable_predictive_host_dependency_checks
int enable_predictive_service_dependency_checks
int soft_state_dependencies
int retain_state_information
int retention_update_interval
int use_retained_program_state
int use_retained_scheduling_info
int retention_scheduling_horizon
unsigned long modified_host_process_attributes
unsigned long modified_service_process_attributes
unsigned long retained_host_attribute_mask
unsigned long retained_service_attribute_mask
unsigned long retained_contact_host_attribute_mask
unsigned long retained_contact_service_attribute_mask
unsigned long retained_process_host_attribute_mask
unsigned long retained_process_service_attribute_mask
unsigned long next_comment_id
unsigned long next_downtime_id
unsigned long next_event_id
unsigned long next_notification_id
int log_rotation_method
time_t program_start
time_t last_command_check
time_t last_command_status_update
time_t last_log_rotation
int verify_config
int test_scheduling
check_result check_result_info
int max_parallel_service_checks
int currently_running_service_checks
int enable_notifications
int execute_service_checks
int accept_passive_service_checks
int execute_host_checks
int accept_passive_host_checks
int enable_event_handlers
int obsess_over_services
int obsess_over_hosts
int enable_failure_prediction
int process_performance_data
int translate_passive_host_checks
int passive_host_checks_are_soft
int aggregate_status_updates
int status_update_interval
int time_change_threshold
unsigned long event_broker_options
int process_performance_data
int enable_flap_detection
double low_service_flap_threshold
double high_service_flap_threshold
double low_host_flap_threshold
double high_host_flap_threshold
int use_large_installation_tweaks
int enable_environment_macros
int free_child_process_memory
int child_processes_fork_twice
int enable_embedded_perl
int use_embedded_perl_implicitly
int stalking_event_handlers_for_hosts
int stalking_event_handlers_for_services
int date_format
contactcontact_list
contactgroupcontactgroup_list
hosthost_list
hostgrouphostgroup_list
serviceservice_list
servicegroupservicegroup_list
timed_eventevent_list_high
timed_eventevent_list_low
notificationnotification_list
commandcommand_list
timeperiodtimeperiod_list
int command_file_fd
FILE * command_file_fp
int command_file_created
check_resultcheck_result_list
unsigned long max_check_result_file_age
dbuf check_result_dbuf
pthread_t worker_threads [TOTAL_WORKER_THREADS]
circular_buffer external_command_buffer
circular_buffer check_result_buffer
circular_buffer event_broker_buffer
int external_command_buffer_slots
check_stats check_statistics [MAX_CHECK_STATS_TYPES]
char * debug_file
int debug_level
int debug_verbosity
unsigned long max_debug_file_size
int errno

Function Documentation

void _get_next_valid_time ( time_t  pref_time,
time_t  current_time,
time_t *  valid_time,
timeperiod tperiod 
)

void _get_next_valid_time_per_timeperiod ( time_t  pref_time,
time_t *  valid_time,
time_t  current_time,
timeperiod tperiod 
)

int add_check_result_to_list ( check_result new_cr  ) 

time_t calculate_time_from_day_of_month ( int  year,
int  month,
int  monthday 
)

time_t calculate_time_from_weekday_of_month ( int  year,
int  month,
int  weekday,
int  weekday_offset 
)

int check_time_against_period ( time_t  test_time,
timeperiod tperiod 
)

void cleanup ( void   ) 

void cleanup_command_file_worker_thread ( void *  arg  ) 

int close_command_file ( void   ) 

void* command_file_worker_thread ( void *  arg  ) 

int compare_strings ( char *  val1a,
char *  val2a 
)

int contains_illegal_object_chars ( char *  name  ) 

int daemon_init ( void   ) 

int dbuf_free ( dbuf db  ) 

int dbuf_init ( dbuf db,
int  chunk_size 
)

int dbuf_strcat ( dbuf db,
char *  buf 
)

int deinit_embedded_perl ( void   ) 

int delete_check_result_file ( char *  fname  ) 

int drop_privileges ( char *  user,
char *  group 
)

char* escape_newlines ( char *  rawbuf  ) 

int file_uses_embedded_perl ( char *  fname  ) 

int free_check_result ( check_result info  ) 

int free_check_result_list ( void   ) 

void free_memory ( icinga_macros mac  ) 

void free_notification_list ( void   ) 

int generate_check_stats ( void   ) 

void get_earliest_time ( time_t  pref_time,
time_t *  valid_time,
time_t  current_time,
timeperiod tperiod,
int  level 
)

void get_min_invalid_time_per_timeperiod ( time_t  pref_time,
time_t *  valid_time,
time_t  current_time,
timeperiod tperiod 
)

time_t get_next_log_rotation_time ( void   ) 

char* get_next_string_from_buf ( char *  buf,
int *  start_index,
int  bufsize 
)

void get_next_valid_time ( time_t  pref_time,
time_t *  valid_time,
timeperiod tperiod 
)

char* get_program_modification_date ( void   ) 

char* get_program_version ( void   ) 

int get_raw_command_line ( command cmd_ptr,
char *  cmd,
char **  full_command,
int  macro_options 
)

int get_raw_command_line_r ( icinga_macros mac,
command cmd_ptr,
char *  cmd,
char **  full_command,
int  macro_options 
)

int has_shell_metachars ( const char *  s  ) 

void host_check_sighandler ( int  sig  ) 

int init_check_result ( check_result info  ) 

int init_check_stats ( void   ) 

int init_command_file_worker_thread ( void   ) 

int init_embedded_perl ( char **  env  ) 

int is_daterange_single_day ( daterange dr  ) 

int move_check_result_to_queue ( char *  checkresult_file  ) 

int my_fcopy ( char *  source,
char *  dest 
)

int my_fdcopy ( char *  source,
char *  dest,
int  dest_fd 
)

int my_rename ( char *  source,
char *  dest 
)

int my_system ( char *  cmd,
int  timeout,
int *  early_timeout,
double *  exectime,
char **  output,
int  max_output_length 
)

int my_system_r ( icinga_macros mac,
char *  cmd,
int  timeout,
int *  early_timeout,
double *  exectime,
char **  output,
int  max_output_length 
)

void my_system_sighandler ( int  sig  ) 

int open_command_file ( void   ) 

int parse_check_output ( char *  buf,
char **  short_output,
char **  long_output,
char **  perf_data,
int  escape_newlines_please,
int  newlines_are_escaped 
)

int process_check_result_file ( char *  fname  ) 

int process_check_result_queue ( char *  dirname  ) 

check_result* read_check_result ( void   ) 

void reset_sighandler ( void   ) 

int reset_variables ( void   ) 

void service_check_sighandler ( int  sig  ) 

int set_environment_var ( char *  name,
char *  value,
int  set 
)

void setup_sighandler ( void   ) 

int shutdown_command_file_worker_thread ( void   ) 

void sighandler ( int  sig  ) 

int submit_external_command ( char *  cmd,
int *  buffer_items 
)

int submit_raw_external_command ( char *  cmd,
time_t *  ts,
int *  buffer_items 
)

int update_check_stats ( int  check_type,
time_t  check_time 
)


Variable Documentation

int accept_passive_host_checks

int accept_passive_service_checks

int additional_freshness_latency

int aggregate_status_updates

char* auth_file

int auto_reschedule_checks

int auto_rescheduling_interval

int auto_rescheduling_window

unsigned long cached_host_check_horizon

unsigned long cached_service_check_horizon

int caught_signal

int check_external_commands

int check_host_freshness

int check_orphaned_hosts

int check_orphaned_services

int check_reaper_interval

circular_buffer check_result_buffer

dbuf check_result_dbuf

check_result check_result_info

check_result* check_result_list

char* check_result_path

char* check_result_path

int check_service_freshness

check_stats check_statistics[MAX_CHECK_STATS_TYPES]

int child_processes_fork_twice

int command_check_interval

char* command_file

int command_file_created

int command_file_fd

FILE* command_file_fp

command* command_list

char* config_file

contact* contact_list

contactgroup* contactgroup_list

int currently_running_service_checks

int daemon_dumps_core

int daemon_mode

int date_format

char* debug_file

int debug_level

int debug_verbosity

int enable_embedded_perl

int enable_environment_macros

int enable_event_handlers

int enable_failure_prediction

int enable_flap_detection

int enable_notifications

int enable_predictive_host_dependency_checks

int enable_predictive_service_dependency_checks

int errno

circular_buffer event_broker_buffer

unsigned long event_broker_options

int event_handler_timeout

timed_event* event_list_high

timed_event* event_list_low

int execute_host_checks

int execute_service_checks

circular_buffer external_command_buffer

int external_command_buffer_slots

int free_child_process_memory

char* global_host_event_handler

command* global_host_event_handler_ptr

char* global_service_event_handler

command* global_service_event_handler_ptr

double high_host_flap_threshold

double high_service_flap_threshold

int host_check_timeout

int host_freshness_check_interval

int host_inter_check_delay_method

host* host_list

hostgroup* hostgroup_list

char* illegal_object_chars

char* illegal_output_chars

int interval_length

time_t last_command_check

time_t last_command_status_update

time_t last_log_rotation

char* lock_file

char* log_archive_path

int log_event_handlers

int log_external_commands

int log_external_commands_user

char* log_file

int log_host_retries

int log_initial_states

int log_notifications

int log_passive_checks

int log_rotation_method

int log_service_retries

unsigned long logging_options

double low_host_flap_threshold

double low_service_flap_threshold

contact* macro_contact_ptr

contactgroup* macro_contactgroup_ptr

customvariablesmember* macro_custom_contact_vars

customvariablesmember* macro_custom_host_vars

customvariablesmember* macro_custom_service_vars

host* macro_host_ptr

hostgroup* macro_hostgroup_ptr

service* macro_service_ptr

servicegroup* macro_servicegroup_ptr

char* macro_user[MAX_USER_MACROS]

char* macro_x_names[MACRO_X_COUNT]

int max_check_reaper_time

unsigned long max_check_result_file_age

unsigned long max_debug_file_size

int max_host_check_spread

int max_parallel_service_checks

int max_service_check_spread

unsigned long modified_host_process_attributes

unsigned long modified_service_process_attributes

PerlInterpreter* my_perl = NULL [static]

char* nagios_group

int nagios_pid

char* nagios_user

unsigned long next_comment_id

unsigned long next_downtime_id

unsigned long next_event_id

unsigned long next_notification_id

notification* notification_list

int notification_timeout

int obsess_over_hosts

int obsess_over_services

char* ochp_command

command* ochp_command_ptr

int ochp_timeout

char* ocsp_command

command* ocsp_command_ptr

int ocsp_timeout

char* p1_file

int passive_host_checks_are_soft

int process_performance_data

int process_performance_data

time_t program_start

int retain_state_information

unsigned long retained_contact_host_attribute_mask

unsigned long retained_contact_service_attribute_mask

unsigned long retained_host_attribute_mask

unsigned long retained_process_host_attribute_mask

unsigned long retained_process_service_attribute_mask

unsigned long retained_service_attribute_mask

int retention_scheduling_horizon

int retention_update_interval

int service_check_timeout

int service_check_timeout_state

int service_freshness_check_interval

int service_inter_check_delay_method

int service_interleave_factor_method

service* service_list

servicegroup* servicegroup_list

int sig_id

int sigrestart

char* sigs[35]

int sigshutdown

double sleep_time

int soft_state_dependencies

int stalking_event_handlers_for_hosts

int stalking_event_handlers_for_services

int status_update_interval

int syslog_local_facility

unsigned long syslog_options

char* temp_file

char* temp_path

int test_scheduling

int time_change_threshold

timeperiod* timeperiod_list

int translate_passive_host_checks

int use_aggressive_host_checking

int use_daemon_log

int use_embedded_perl = TRUE

int use_embedded_perl_implicitly

int use_large_installation_tweaks

int use_regexp_matches

int use_retained_program_state

int use_retained_scheduling_info

int use_syslog

int use_syslog_local_facility

int use_true_regexp_matching

int verify_config

pthread_t worker_threads[TOTAL_WORKER_THREADS]


Generated on Wed Mar 30 17:22:22 2011 for icinga-core by  doxygen 1.4.7