Icinga-core 1.4.0
next gen monitoring
include/readlogs.h
Go to the documentation of this file.
00001 /************************************************************************
00002  *
00003  * READLOGS.H - Header file for log reading functions
00004  *
00005  * Copyright (c) 1999-2008  Ethan Galstad (egalstad@nagios.org)
00006  * Copyright (c) 2009-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 
00028 #ifndef _READLOGS_H
00029 #define _READLOGS_H
00030 
00031 #include "config.h"
00032 
00033 #ifdef __cplusplus
00034 extern "C" {
00035 #endif
00036 
00037 
00040 #define LOGENTRY_STARTUP                        1
00041 #define LOGENTRY_SHUTDOWN                       2
00042 #define LOGENTRY_RESTART                        3
00043 #define LOGENTRY_BAILOUT                        4
00044 #define LOGENTRY_LOG_ROTATION                   5
00045 #define LOGENTRY_ACTIVE_MODE                    6
00046 #define LOGENTRY_STANDBY_MODE                   7
00047 #define LOGENTRY_EXTERNAL_COMMAND               8
00048 #define LOGENTRY_ERROR_COMMAND_EXECUTION        9
00049 
00050 #define LOGENTRY_HOST_DOWN                      10
00051 #define LOGENTRY_HOST_UNREACHABLE               11
00052 #define LOGENTRY_HOST_RECOVERY                  12
00053 #define LOGENTRY_HOST_UP                        13
00054 #define LOGENTRY_HOST_NOTIFICATION              14
00055 #define LOGENTRY_HOST_EVENT_HANDLER             15
00056 
00057 #define LOGENTRY_HOST_FLAPPING_STARTED          16
00058 #define LOGENTRY_HOST_FLAPPING_STOPPED          17
00059 #define LOGENTRY_HOST_FLAPPING_DISABLED         18
00060 #define LOGENTRY_HOST_DOWNTIME_STARTED          19
00061 #define LOGENTRY_HOST_DOWNTIME_STOPPED          20
00062 #define LOGENTRY_HOST_DOWNTIME_CANCELLED        21
00063 
00064 #define LOGENTRY_HOST_INITIAL_STATE             22
00065 #define LOGENTRY_HOST_CURRENT_STATE             23
00066 
00067 #define LOGENTRY_PASSIVE_HOST_CHECK             24
00068 
00069 #define LOGENTRY_SERVICE_CRITICAL               25
00070 #define LOGENTRY_SERVICE_WARNING                26
00071 #define LOGENTRY_SERVICE_UNKNOWN                27
00072 #define LOGENTRY_SERVICE_RECOVERY               28
00073 #define LOGENTRY_SERVICE_OK                     29
00074 #define LOGENTRY_SERVICE_NOTIFICATION           30
00075 #define LOGENTRY_SERVICE_EVENT_HANDLER          31
00076 
00077 #define LOGENTRY_SERVICE_FLAPPING_STARTED       32
00078 #define LOGENTRY_SERVICE_FLAPPING_STOPPED       33
00079 #define LOGENTRY_SERVICE_FLAPPING_DISABLED      34
00080 #define LOGENTRY_SERVICE_DOWNTIME_STARTED       35
00081 #define LOGENTRY_SERVICE_DOWNTIME_STOPPED       36
00082 #define LOGENTRY_SERVICE_DOWNTIME_CANCELLED     37
00083 
00084 #define LOGENTRY_SERVICE_INITIAL_STATE          38
00085 #define LOGENTRY_SERVICE_CURRENT_STATE          39
00086 
00087 #define LOGENTRY_PASSIVE_SERVICE_CHECK          40
00088 
00089 #define LOGENTRY_IDOMOD                         41
00090 #define LOGENTRY_NPCDMOD                        42
00091 #define LOGENTRY_AUTOSAVE                       43
00092 #define LOGENTRY_SYSTEM_WARNING                 44
00093 
00094 #define LOGENTRY_UNDEFINED                      999
00095 
00099 #define LOGFILTER_INCLUDE                       333
00100 #define LOGFILTER_EXCLUDE                       666
00101 
00107 #define READLOG_OK              0
00108 #define READLOG_ERROR           1
00109 #define READLOG_ERROR_MEMORY    2
00110 #define READLOG_ERROR_NOFILE    3
00111 #define READLOG_ERROR_FILTER    4
00112 
00119 typedef struct logentry_struct {
00120         time_t  timestamp;              
00121         int     type;                   
00122         char    *entry_text;            
00123         struct  logentry_struct *next;  
00124         }logentry;
00125 
00130 typedef struct logentry_filter {
00131         int     include;                
00132         int     exclude;                
00133         struct  logentry_filter *next;  
00134         }logfilter;
00135 
00136 /* for documentation on these functions see cgi/readlogs.c */
00139 int add_log_filter(int, int);
00140 int get_log_entries(char *, char *, int, time_t, time_t);
00141 void free_log_filters(void);
00142 void free_log_entries(void);
00147 void get_log_archive_to_use(int,char *,int);
00148 int determine_archive_to_use_from_time(time_t);
00149 void determine_log_rotation_times(int);
00152 #ifdef __cplusplus
00153 }
00154 #endif
00155 
00156 #endif
00157 
 All Data Structures Files Functions Variables Typedefs Defines