Icinga-core 1.4.0
next gen monitoring
base/perfdata.c
Go to the documentation of this file.
00001 /*****************************************************************************
00002  *
00003  * PERFDATA.C - Performance data routines for Icinga
00004  *
00005  * Copyright (c) 2000-2008 Ethan Galstad (egalstad@nagios.org)
00006  * Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
00007  * Copyright (c) 2009-2011 Icinga Development Team (http://www.icinga.org)
00008  *
00009  * License:
00010  *
00011  * This program is free software; you can redistribute it and/or modify
00012  * it under the terms of the GNU General Public License version 2 as
00013  * published by the Free Software Foundation.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00023  *
00024  *****************************************************************************/
00025 
00026 
00027 /*********** COMMON HEADER FILES ***********/
00028 
00029 #include "../include/config.h"
00030 #include "../include/common.h"
00031 #include "../include/objects.h"
00032 #include "../include/perfdata.h"
00033 #include "../include/macros.h"
00034 
00035 /***** IMPLEMENTATION-SPECIFIC HEADER FILES *****/
00036 
00037 #ifdef USE_XPDDEFAULT
00038 #include "../xdata/xpddefault.h"
00039 #endif
00040 
00041 
00042 extern int   process_performance_data;
00043 
00044 
00045 
00046 /******************************************************************/
00047 /************** INITIALIZATION & CLEANUP FUNCTIONS ****************/
00048 /******************************************************************/
00049 
00050 /* initializes performance data */
00051 int initialize_performance_data(char *config_file){
00052 
00053 #ifdef USE_XPDDEFAULT
00054         xpddefault_initialize_performance_data(config_file);
00055 #endif
00056 
00057         return OK;
00058         }
00059 
00060 
00061 
00062 /* cleans up performance data */
00063 int cleanup_performance_data(char *config_file){
00064 
00065 #ifdef USE_XPDDEFAULT
00066         xpddefault_cleanup_performance_data(config_file);
00067 #endif
00068 
00069         return OK;
00070         }
00071 
00072 
00073 
00074 /******************************************************************/
00075 /****************** PERFORMANCE DATA FUNCTIONS ********************/
00076 /******************************************************************/
00077 
00078 
00079 /* updates service performance data */
00080 int update_service_performance_data(service *svc){
00081 
00082         /* should we be processing performance data for anything? */
00083         if(process_performance_data==FALSE)
00084                 return OK;
00085 
00086         /* should we process performance data for this service? */
00087         if(svc->process_performance_data==FALSE)
00088                 return OK;
00089 
00090         /* process the performance data! */
00091 #ifdef USE_XPDDEFAULT
00092         xpddefault_update_service_performance_data(svc);
00093 #endif
00094 
00095         return OK;
00096         }
00097 
00098 
00099 
00100 /* updates host performance data */
00101 int update_host_performance_data(host *hst){
00102 
00103         /* should we be processing performance data for anything? */
00104         if(process_performance_data==FALSE)
00105                 return OK;
00106 
00107         /* should we process performance data for this host? */
00108         if(hst->process_performance_data==FALSE)
00109                 return OK;
00110 
00111         /* process the performance data! */
00112 #ifdef USE_XPDDEFAULT
00113         xpddefault_update_host_performance_data(hst);
00114 #endif
00115 
00116         return OK;
00117         }
 All Data Structures Files Functions Variables Typedefs Defines