![]() |
Icinga-core 1.4.0
next gen monitoring
|
00001 /***************************************************************************** 00002 * 00003 * LOGGING.H - Header file for logging functions 00004 * 00005 * Copyright (c) 2010-2011 Nagios Core Development Team and Community Contributors 00006 * Copyright (c) 2010-2011 Icinga Development Team (http://www.icinga.org) 00007 * 00008 * License: 00009 * 00010 * This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License version 2 as 00012 * published by the Free Software Foundation. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU General Public License 00020 * along with this program; if not, write to the Free Software 00021 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00022 * 00023 *****************************************************************************/ 00024 00025 00026 #ifndef INCLUDE_logging_h__ 00027 #define INCLUDE_logging_h__ 00028 00029 #include "objects.h" 00030 00031 /******************* LOGGING TYPES ********************/ 00032 00033 #define NSLOG_RUNTIME_ERROR 1 00034 #define NSLOG_RUNTIME_WARNING 2 00035 00036 #define NSLOG_VERIFICATION_ERROR 4 00037 #define NSLOG_VERIFICATION_WARNING 8 00038 00039 #define NSLOG_CONFIG_ERROR 16 00040 #define NSLOG_CONFIG_WARNING 32 00041 00042 #define NSLOG_PROCESS_INFO 64 00043 #define NSLOG_EVENT_HANDLER 128 00044 /*#define NSLOG_NOTIFICATION 256*/ /* NOT USED ANYMORE - CAN BE REUSED */ 00045 #define NSLOG_EXTERNAL_COMMAND 512 00046 00047 #define NSLOG_HOST_UP 1024 00048 #define NSLOG_HOST_DOWN 2048 00049 #define NSLOG_HOST_UNREACHABLE 4096 00050 00051 #define NSLOG_SERVICE_OK 8192 00052 #define NSLOG_SERVICE_UNKNOWN 16384 00053 #define NSLOG_SERVICE_WARNING 32768 00054 #define NSLOG_SERVICE_CRITICAL 65536 00055 00056 #define NSLOG_PASSIVE_CHECK 131072 00057 00058 #define NSLOG_INFO_MESSAGE 262144 00059 00060 #define NSLOG_HOST_NOTIFICATION 524288 00061 #define NSLOG_SERVICE_NOTIFICATION 1048576 00062 00063 /***************** DEBUGGING LEVELS *******************/ 00064 00065 #define DEBUGL_ALL -1 00066 #define DEBUGL_NONE 0 00067 #define DEBUGL_FUNCTIONS 1 00068 #define DEBUGL_CONFIG 2 00069 #define DEBUGL_PROCESS 4 00070 #define DEBUGL_STATUSDATA 4 00071 #define DEBUGL_RETENTIONDATA 4 00072 #define DEBUGL_EVENTS 8 00073 #define DEBUGL_CHECKS 16 00074 #define DEBUGL_IPC 16 00075 #define DEBUGL_FLAPPING 16 00076 #define DEBUGL_EVENTHANDLERS 16 00077 #define DEBUGL_PERFDATA 16 00078 #define DEBUGL_NOTIFICATIONS 32 00079 #define DEBUGL_EVENTBROKER 64 00080 #define DEBUGL_EXTERNALCOMMANDS 128 00081 #define DEBUGL_COMMANDS 256 00082 #define DEBUGL_DOWNTIME 512 00083 #define DEBUGL_COMMENTS 1024 00084 #define DEBUGL_MACROS 2048 00085 00086 #define DEBUGV_BASIC 0 00087 #define DEBUGV_MORE 1 00088 #define DEBUGV_MOST 2 00089 00090 00091 /**** Logging Functions ****/ 00092 void logit(int,int,const char *, ...) 00093 __attribute__((__format__(__printf__, 3, 4))); 00094 int log_debug_info(int,int,const char *,...) 00095 __attribute__((__format__(__printf__, 3, 4))); 00096 00097 #ifndef NSCGI 00098 int write_to_all_logs(char *,unsigned long); /* writes a string to main log file and syslog facility */ 00099 int write_to_log(char *,unsigned long,time_t *); /* write a string to the main log file */ 00100 int write_to_syslog(char *,unsigned long); /* write a string to the syslog facility */ 00101 int log_service_event(service *); /* logs a service event */ 00102 int log_host_event(host *); /* logs a host event */ 00103 int log_host_states(int,time_t *); /* logs initial/current host states */ 00104 int log_service_states(int,time_t *); /* logs initial/current service states */ 00105 int rotate_log_file(time_t); /* rotates the main log file */ 00106 int write_log_file_info(time_t *); /* records log file/version info */ 00107 int open_debug_log(void); 00108 int close_debug_log(void); 00109 00110 #endif /* !NSCGI */ 00111 00112 #endif 00113