1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
/*****************************************************************************
*
* PERFDATA.C - Performance data routines for Icinga
*
* Copyright (c) 2000-2008 Ethan Galstad (egalstad@nagios.org)
* Copyright (c) 2009-2013 Nagios Core Development Team and Community Contributors
* Copyright (c) 2009-2015 Icinga Development Team (http://www.icinga.org)
*
* License:
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*****************************************************************************/
/*********** COMMON HEADER FILES ***********/
#include "../include/config.h"
#include "../include/common.h"
#include "../include/objects.h"
#include "../include/perfdata.h"
#include "../include/macros.h"
/***** IMPLEMENTATION-SPECIFIC HEADER FILES *****/
#ifdef USE_XPDDEFAULT
#include "../xdata/xpddefault.h"
#endif
extern int process_performance_data;
/******************************************************************/
/************** INITIALIZATION & CLEANUP FUNCTIONS ****************/
/******************************************************************/
/* initializes performance data */
int initialize_performance_data(char *config_file) {
#ifdef USE_XPDDEFAULT
xpddefault_initialize_performance_data(config_file);
#endif
return OK;
}
/* cleans up performance data */
int cleanup_performance_data(char *config_file) {
#ifdef USE_XPDDEFAULT
xpddefault_cleanup_performance_data(config_file);
#endif
return OK;
}
/******************************************************************/
/****************** PERFORMANCE DATA FUNCTIONS ********************/
/******************************************************************/
/* updates service performance data */
int update_service_performance_data(service *svc) {
/* should we be processing performance data for anything? */
if (process_performance_data == FALSE)
return OK;
/* should we process performance data for this service? */
if (svc->process_performance_data == FALSE)
return OK;
/* process the performance data! */
#ifdef USE_XPDDEFAULT
xpddefault_update_service_performance_data(svc);
#endif
return OK;
}
/* updates host performance data */
int update_host_performance_data(host *hst) {
/* should we be processing performance data for anything? */
if (process_performance_data == FALSE)
return OK;
/* should we process performance data for this host? */
if (hst->process_performance_data == FALSE)
return OK;
/* process the performance data! */
#ifdef USE_XPDDEFAULT
xpddefault_update_host_performance_data(hst);
#endif
return OK;
}
|