initial commit
This commit is contained in:
2
nagios/README
Normal file
2
nagios/README
Normal file
@@ -0,0 +1,2 @@
|
||||
These files are taken directly from Nagios 3.2.0 with a minimal patch
|
||||
that fixes one compilation error on g++.
|
||||
223
nagios/broker.h
Normal file
223
nagios/broker.h
Normal file
@@ -0,0 +1,223 @@
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* BROKER.H - Event broker includes for Nagios
|
||||
*
|
||||
* Copyright (c) 2002-2006 Ethan Galstad (egalstad@nagios.org)
|
||||
* Last Modified: 12-12-2006
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _BROKER_H
|
||||
#define _BROKER_H
|
||||
|
||||
#include "config.h"
|
||||
#include "nagios.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*************** EVENT BROKER OPTIONS *****************/
|
||||
|
||||
#define BROKER_NOTHING 0
|
||||
#define BROKER_EVERYTHING 1048575
|
||||
|
||||
#define BROKER_PROGRAM_STATE 1 /* DONE */
|
||||
#define BROKER_TIMED_EVENTS 2 /* DONE */
|
||||
#define BROKER_SERVICE_CHECKS 4 /* DONE */
|
||||
#define BROKER_HOST_CHECKS 8 /* DONE */
|
||||
#define BROKER_EVENT_HANDLERS 16 /* DONE */
|
||||
#define BROKER_LOGGED_DATA 32 /* DONE */
|
||||
#define BROKER_NOTIFICATIONS 64 /* DONE */
|
||||
#define BROKER_FLAPPING_DATA 128 /* DONE */
|
||||
#define BROKER_COMMENT_DATA 256 /* DONE */
|
||||
#define BROKER_DOWNTIME_DATA 512 /* DONE */
|
||||
#define BROKER_SYSTEM_COMMANDS 1024 /* DONE */
|
||||
#define BROKER_OCP_DATA 2048 /* DONE */
|
||||
#define BROKER_STATUS_DATA 4096 /* DONE */
|
||||
#define BROKER_ADAPTIVE_DATA 8192 /* DONE */
|
||||
#define BROKER_EXTERNALCOMMAND_DATA 16384 /* DONE */
|
||||
#define BROKER_RETENTION_DATA 32768 /* DONE */
|
||||
#define BROKER_ACKNOWLEDGEMENT_DATA 65536
|
||||
#define BROKER_STATECHANGE_DATA 131072
|
||||
#define BROKER_RESERVED18 262144
|
||||
#define BROKER_RESERVED19 524288
|
||||
|
||||
|
||||
/****** EVENT TYPES ************************/
|
||||
|
||||
#define NEBTYPE_NONE 0
|
||||
|
||||
#define NEBTYPE_HELLO 1
|
||||
#define NEBTYPE_GOODBYE 2
|
||||
#define NEBTYPE_INFO 3
|
||||
|
||||
#define NEBTYPE_PROCESS_START 100
|
||||
#define NEBTYPE_PROCESS_DAEMONIZE 101
|
||||
#define NEBTYPE_PROCESS_RESTART 102
|
||||
#define NEBTYPE_PROCESS_SHUTDOWN 103
|
||||
#define NEBTYPE_PROCESS_PRELAUNCH 104 /* before objects are read or verified */
|
||||
#define NEBTYPE_PROCESS_EVENTLOOPSTART 105
|
||||
#define NEBTYPE_PROCESS_EVENTLOOPEND 106
|
||||
|
||||
#define NEBTYPE_TIMEDEVENT_ADD 200
|
||||
#define NEBTYPE_TIMEDEVENT_REMOVE 201
|
||||
#define NEBTYPE_TIMEDEVENT_EXECUTE 202
|
||||
#define NEBTYPE_TIMEDEVENT_DELAY 203 /* NOT IMPLEMENTED */
|
||||
#define NEBTYPE_TIMEDEVENT_SKIP 204 /* NOT IMPLEMENTED */
|
||||
#define NEBTYPE_TIMEDEVENT_SLEEP 205
|
||||
|
||||
#define NEBTYPE_LOG_DATA 300
|
||||
#define NEBTYPE_LOG_ROTATION 301
|
||||
|
||||
#define NEBTYPE_SYSTEM_COMMAND_START 400
|
||||
#define NEBTYPE_SYSTEM_COMMAND_END 401
|
||||
|
||||
#define NEBTYPE_EVENTHANDLER_START 500
|
||||
#define NEBTYPE_EVENTHANDLER_END 501
|
||||
|
||||
#define NEBTYPE_NOTIFICATION_START 600
|
||||
#define NEBTYPE_NOTIFICATION_END 601
|
||||
#define NEBTYPE_CONTACTNOTIFICATION_START 602
|
||||
#define NEBTYPE_CONTACTNOTIFICATION_END 603
|
||||
#define NEBTYPE_CONTACTNOTIFICATIONMETHOD_START 604
|
||||
#define NEBTYPE_CONTACTNOTIFICATIONMETHOD_END 605
|
||||
|
||||
#define NEBTYPE_SERVICECHECK_INITIATE 700
|
||||
#define NEBTYPE_SERVICECHECK_PROCESSED 701
|
||||
#define NEBTYPE_SERVICECHECK_RAW_START 702 /* NOT IMPLEMENTED */
|
||||
#define NEBTYPE_SERVICECHECK_RAW_END 703 /* NOT IMPLEMENTED */
|
||||
#define NEBTYPE_SERVICECHECK_ASYNC_PRECHECK 704
|
||||
|
||||
#define NEBTYPE_HOSTCHECK_INITIATE 800 /* a check of the route to the host has been initiated */
|
||||
#define NEBTYPE_HOSTCHECK_PROCESSED 801 /* the processed/final result of a host check */
|
||||
#define NEBTYPE_HOSTCHECK_RAW_START 802 /* the start of a "raw" host check */
|
||||
#define NEBTYPE_HOSTCHECK_RAW_END 803 /* a finished "raw" host check */
|
||||
#define NEBTYPE_HOSTCHECK_ASYNC_PRECHECK 804
|
||||
#define NEBTYPE_HOSTCHECK_SYNC_PRECHECK 805
|
||||
|
||||
#define NEBTYPE_COMMENT_ADD 900
|
||||
#define NEBTYPE_COMMENT_DELETE 901
|
||||
#define NEBTYPE_COMMENT_LOAD 902
|
||||
|
||||
#define NEBTYPE_FLAPPING_START 1000
|
||||
#define NEBTYPE_FLAPPING_STOP 1001
|
||||
|
||||
#define NEBTYPE_DOWNTIME_ADD 1100
|
||||
#define NEBTYPE_DOWNTIME_DELETE 1101
|
||||
#define NEBTYPE_DOWNTIME_LOAD 1102
|
||||
#define NEBTYPE_DOWNTIME_START 1103
|
||||
#define NEBTYPE_DOWNTIME_STOP 1104
|
||||
|
||||
#define NEBTYPE_PROGRAMSTATUS_UPDATE 1200
|
||||
#define NEBTYPE_HOSTSTATUS_UPDATE 1201
|
||||
#define NEBTYPE_SERVICESTATUS_UPDATE 1202
|
||||
#define NEBTYPE_CONTACTSTATUS_UPDATE 1203
|
||||
|
||||
#define NEBTYPE_ADAPTIVEPROGRAM_UPDATE 1300
|
||||
#define NEBTYPE_ADAPTIVEHOST_UPDATE 1301
|
||||
#define NEBTYPE_ADAPTIVESERVICE_UPDATE 1302
|
||||
#define NEBTYPE_ADAPTIVECONTACT_UPDATE 1303
|
||||
|
||||
#define NEBTYPE_EXTERNALCOMMAND_START 1400
|
||||
#define NEBTYPE_EXTERNALCOMMAND_END 1401
|
||||
|
||||
#define NEBTYPE_AGGREGATEDSTATUS_STARTDUMP 1500
|
||||
#define NEBTYPE_AGGREGATEDSTATUS_ENDDUMP 1501
|
||||
|
||||
#define NEBTYPE_RETENTIONDATA_STARTLOAD 1600
|
||||
#define NEBTYPE_RETENTIONDATA_ENDLOAD 1601
|
||||
#define NEBTYPE_RETENTIONDATA_STARTSAVE 1602
|
||||
#define NEBTYPE_RETENTIONDATA_ENDSAVE 1603
|
||||
|
||||
#define NEBTYPE_ACKNOWLEDGEMENT_ADD 1700
|
||||
#define NEBTYPE_ACKNOWLEDGEMENT_REMOVE 1701 /* NOT IMPLEMENTED */
|
||||
#define NEBTYPE_ACKNOWLEDGEMENT_LOAD 1702 /* NOT IMPLEMENTED */
|
||||
|
||||
#define NEBTYPE_STATECHANGE_START 1800 /* NOT IMPLEMENTED */
|
||||
#define NEBTYPE_STATECHANGE_END 1801
|
||||
|
||||
|
||||
|
||||
/****** EVENT FLAGS ************************/
|
||||
|
||||
#define NEBFLAG_NONE 0
|
||||
#define NEBFLAG_PROCESS_INITIATED 1 /* event was initiated by Nagios process */
|
||||
#define NEBFLAG_USER_INITIATED 2 /* event was initiated by a user request */
|
||||
#define NEBFLAG_MODULE_INITIATED 3 /* event was initiated by an event broker module */
|
||||
|
||||
|
||||
|
||||
|
||||
/****** EVENT ATTRIBUTES *******************/
|
||||
|
||||
#define NEBATTR_NONE 0
|
||||
|
||||
#define NEBATTR_SHUTDOWN_NORMAL 1
|
||||
#define NEBATTR_SHUTDOWN_ABNORMAL 2
|
||||
#define NEBATTR_RESTART_NORMAL 4
|
||||
#define NEBATTR_RESTART_ABNORMAL 8
|
||||
|
||||
#define NEBATTR_FLAPPING_STOP_NORMAL 1
|
||||
#define NEBATTR_FLAPPING_STOP_DISABLED 2 /* flapping stopped because flap detection was disabled */
|
||||
|
||||
#define NEBATTR_DOWNTIME_STOP_NORMAL 1
|
||||
#define NEBATTR_DOWNTIME_STOP_CANCELLED 2
|
||||
|
||||
|
||||
|
||||
/****** EVENT BROKER FUNCTIONS *************/
|
||||
|
||||
#ifdef USE_EVENT_BROKER
|
||||
struct timeval get_broker_timestamp(struct timeval *);
|
||||
void broker_program_state(int,int,int,struct timeval *);
|
||||
void broker_timed_event(int,int,int,timed_event *,struct timeval *);
|
||||
void broker_log_data(int,int,int,char *,unsigned long,time_t,struct timeval *);
|
||||
void broker_event_handler(int,int,int,int,void *,int,int,struct timeval,struct timeval,double,int,int,int,char *,char *,char *,struct timeval *);
|
||||
void broker_ocp_data(int,int,int,void *,int,int,double,int,int,struct timeval *);
|
||||
void broker_system_command(int,int,int,struct timeval,struct timeval,double,int,int,int,char *,char *,struct timeval *);
|
||||
int broker_host_check(int,int,int,host *,int,int,int,struct timeval,struct timeval,char *,double,double,int,int,int,char *,char *,char *,char *,struct timeval *);
|
||||
int broker_service_check(int,int,int,service *,int,struct timeval,struct timeval,char *,double,double,int,int,int,char *,struct timeval *);
|
||||
void broker_comment_data(int,int,int,int,int,char *,char *,time_t,char *,char *,int,int,int,time_t,unsigned long,struct timeval *);
|
||||
void broker_downtime_data(int,int,int,int,char *,char *,time_t,char *,char *,time_t,time_t,int,unsigned long,unsigned long,unsigned long,struct timeval *);
|
||||
void broker_flapping_data(int,int,int,int,void *,double,double,double,struct timeval *);
|
||||
void broker_program_status(int,int,int,struct timeval *);
|
||||
void broker_host_status(int,int,int,host *,struct timeval *);
|
||||
void broker_service_status(int,int,int,service *,struct timeval *);
|
||||
void broker_contact_status(int,int,int,contact *,struct timeval *);
|
||||
void broker_notification_data(int,int,int,int,int,struct timeval,struct timeval,void *,char *,char *,int,int,struct timeval *);
|
||||
void broker_contact_notification_data(int,int,int,int,int,struct timeval,struct timeval,void *,contact *,char *,char *,int,struct timeval *);
|
||||
void broker_contact_notification_method_data(int,int,int,int,int,struct timeval,struct timeval,void *,contact *,char *,char *,char *,int,struct timeval *);
|
||||
void broker_adaptive_program_data(int,int,int,int,unsigned long,unsigned long,unsigned long,unsigned long,struct timeval *);
|
||||
void broker_adaptive_host_data(int,int,int,host *,int,unsigned long,unsigned long,struct timeval *);
|
||||
void broker_adaptive_service_data(int,int,int,service *,int,unsigned long,unsigned long,struct timeval *);
|
||||
void broker_adaptive_contact_data(int,int,int,contact *,int,unsigned long,unsigned long,unsigned long,unsigned long,unsigned long,unsigned long, struct timeval *);
|
||||
void broker_external_command(int,int,int,int,time_t,char *,char *,struct timeval *);
|
||||
void broker_aggregated_status_data(int,int,int,struct timeval *);
|
||||
void broker_retention_data(int,int,int,struct timeval *);
|
||||
void broker_acknowledgement_data(int,int,int,int,void *,char *,char *,int,int,int,struct timeval *);
|
||||
void broker_statechange_data(int,int,int,int,void *,int,int,int,int,struct timeval *);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
74
nagios/cgiauth.h
Normal file
74
nagios/cgiauth.h
Normal file
@@ -0,0 +1,74 @@
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* CGIAUTH.H - Authorization utilities header file
|
||||
*
|
||||
* Last Modified: 11-24-2005
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _AUTH_H
|
||||
#define _AUTH_H
|
||||
|
||||
#include "common.h"
|
||||
#include "objects.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct authdata_struct{
|
||||
char *username;
|
||||
int authorized_for_all_hosts;
|
||||
int authorized_for_all_host_commands;
|
||||
int authorized_for_all_services;
|
||||
int authorized_for_all_service_commands;
|
||||
int authorized_for_system_information;
|
||||
int authorized_for_system_commands;
|
||||
int authorized_for_configuration_information;
|
||||
int authorized_for_read_only;
|
||||
int authenticated;
|
||||
}authdata;
|
||||
|
||||
|
||||
|
||||
int get_authentication_information(authdata *); /* gets current authentication information */
|
||||
|
||||
int is_authorized_for_host(host *,authdata *);
|
||||
int is_authorized_for_service(service *,authdata *);
|
||||
|
||||
int is_authorized_for_all_hosts(authdata *);
|
||||
int is_authorized_for_all_services(authdata *);
|
||||
|
||||
int is_authorized_for_system_information(authdata *);
|
||||
int is_authorized_for_system_commands(authdata *);
|
||||
int is_authorized_for_host_commands(host *,authdata *);
|
||||
int is_authorized_for_service_commands(service *,authdata *);
|
||||
|
||||
int is_authorized_for_hostgroup(hostgroup *,authdata *);
|
||||
int is_authorized_for_servicegroup(servicegroup *,authdata *);
|
||||
|
||||
int is_authorized_for_configuration_information(authdata *);
|
||||
|
||||
int is_authorized_for_read_only(authdata *);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
533
nagios/cgiutils.h
Normal file
533
nagios/cgiutils.h
Normal file
@@ -0,0 +1,533 @@
|
||||
|
||||
/* include/cgiutils.h. Generated by configure. */
|
||||
/************************************************************************
|
||||
*
|
||||
* CGIUTILS.H - Header file for common CGI functions
|
||||
* Copyright (c) 1999-2008 Ethan Galstad (egalstad@nagios.org)
|
||||
* Last Modified: 10-15-2008
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
************************************************************************/
|
||||
|
||||
#ifndef _CGIUTILS_H
|
||||
#define _CGIUTILS_H
|
||||
|
||||
#include "objects.h"
|
||||
#include "cgiauth.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* should we compile and use the statusmap CGI? */
|
||||
#define USE_STATUSMAP 1
|
||||
/* should we compile and use the statuswrl CGI? */
|
||||
#define USE_STATUSWRL 1
|
||||
/* should we compile and use the trends CGI? */
|
||||
#define USE_TRENDS 1
|
||||
/* should we compile and use the histogram CGI? */
|
||||
#define USE_HISTOGRAM 1
|
||||
|
||||
|
||||
/**************************** CGI REFRESH RATE ******************************/
|
||||
|
||||
#define DEFAULT_REFRESH_RATE 60 /* 60 second refresh rate for CGIs */
|
||||
|
||||
|
||||
/******************************* CGI NAMES **********************************/
|
||||
|
||||
#define STATUS_CGI "status.cgi"
|
||||
#define STATUSMAP_CGI "statusmap.cgi"
|
||||
#define STATUSWORLD_CGI "statuswrl.cgi"
|
||||
#define COMMAND_CGI "cmd.cgi"
|
||||
#define EXTINFO_CGI "extinfo.cgi"
|
||||
#define SHOWLOG_CGI "showlog.cgi"
|
||||
#define NOTIFICATIONS_CGI "notifications.cgi"
|
||||
#define HISTORY_CGI "history.cgi"
|
||||
#define CONFIG_CGI "config.cgi"
|
||||
#define OUTAGES_CGI "outages.cgi"
|
||||
#define TRENDS_CGI "trends.cgi"
|
||||
#define AVAIL_CGI "avail.cgi"
|
||||
#define TAC_CGI "tac.cgi"
|
||||
#define STATUSWML_CGI "statuswml.cgi"
|
||||
#define TRACEROUTE_CGI "traceroute.cgi"
|
||||
#define HISTOGRAM_CGI "histogram.cgi"
|
||||
#define CHECKSANITY_CGI "checksanity.cgi"
|
||||
#define MINISTATUS_CGI "ministatus.cgi"
|
||||
#define SUMMARY_CGI "summary.cgi"
|
||||
|
||||
|
||||
/**************************** STYLE SHEET NAMES ******************************/
|
||||
|
||||
#define COMMON_CSS "common.css"
|
||||
|
||||
#define SHOWLOG_CSS "showlog.css"
|
||||
#define STATUS_CSS "status.css"
|
||||
#define STATUSMAP_CSS "statusmap.css"
|
||||
#define COMMAND_CSS "cmd.css"
|
||||
#define EXTINFO_CSS "extinfo.css"
|
||||
#define NOTIFICATIONS_CSS "notifications.css"
|
||||
#define HISTORY_CSS "history.css"
|
||||
#define CONFIG_CSS "config.css"
|
||||
#define OUTAGES_CSS "outages.css"
|
||||
#define TRENDS_CSS "trends.css"
|
||||
#define AVAIL_CSS "avail.css"
|
||||
#define TAC_CSS "tac.css"
|
||||
#define HISTOGRAM_CSS "histogram.css"
|
||||
#define CHECKSANITY_CSS "checksanity.css"
|
||||
#define MINISTATUS_CSS "ministatus.css"
|
||||
#define SUMMARY_CSS "summary.css"
|
||||
|
||||
|
||||
/********************************* ICONS ************************************/
|
||||
|
||||
#define STATUS_ICON_WIDTH 20
|
||||
#define STATUS_ICON_HEIGHT 20
|
||||
|
||||
#define INFO_ICON "info.png"
|
||||
#define INFO_ICON_ALT "Informational Message"
|
||||
#define START_ICON "start.gif"
|
||||
#define START_ICON_ALT "Program Start"
|
||||
#define STOP_ICON "stop.gif"
|
||||
#define STOP_ICON_ALT "Program End"
|
||||
#define RESTART_ICON "restart.gif"
|
||||
#define RESTART_ICON_ALT "Program Restart"
|
||||
#define OK_ICON "recovery.png"
|
||||
#define OK_ICON_ALT "Service Ok"
|
||||
#define CRITICAL_ICON "critical.png"
|
||||
#define CRITICAL_ICON_ALT "Service Critical"
|
||||
#define WARNING_ICON "warning.png"
|
||||
#define WARNING_ICON_ALT "Service Warning"
|
||||
#define UNKNOWN_ICON "unknown.png"
|
||||
#define UNKNOWN_ICON_ALT "Service Unknown"
|
||||
#define NOTIFICATION_ICON "notify.gif"
|
||||
#define NOTIFICATION_ICON_ALT "Service Notification"
|
||||
#define LOG_ROTATION_ICON "logrotate.png"
|
||||
#define LOG_ROTATION_ICON_ALT "Log Rotation"
|
||||
#define EXTERNAL_COMMAND_ICON "command.png"
|
||||
#define EXTERNAL_COMMAND_ICON_ALT "External Command"
|
||||
|
||||
#define STATUS_DETAIL_ICON "status2.gif"
|
||||
#define STATUS_OVERVIEW_ICON "status.gif"
|
||||
#define STATUSMAP_ICON "status3.gif"
|
||||
#define STATUSWORLD_ICON "status4.gif"
|
||||
#define EXTINFO_ICON "extinfo.gif"
|
||||
#define HISTORY_ICON "history.gif"
|
||||
#define CONTACTGROUP_ICON "contactgroup.gif"
|
||||
#define TRENDS_ICON "trends.gif"
|
||||
|
||||
#define DISABLED_ICON "disabled.gif"
|
||||
#define ENABLED_ICON "enabled.gif"
|
||||
#define PASSIVE_ONLY_ICON "passiveonly.gif"
|
||||
#define NOTIFICATIONS_DISABLED_ICON "ndisabled.gif"
|
||||
#define ACKNOWLEDGEMENT_ICON "ack.gif"
|
||||
#define REMOVE_ACKNOWLEDGEMENT_ICON "noack.gif"
|
||||
#define COMMENT_ICON "comment.gif"
|
||||
#define DELETE_ICON "delete.gif"
|
||||
#define DELAY_ICON "delay.gif"
|
||||
#define DOWNTIME_ICON "downtime.gif"
|
||||
#define PASSIVE_ICON "passiveonly.gif"
|
||||
#define RIGHT_ARROW_ICON "right.gif"
|
||||
#define LEFT_ARROW_ICON "left.gif"
|
||||
#define UP_ARROW_ICON "up.gif"
|
||||
#define DOWN_ARROW_ICON "down.gif"
|
||||
#define FLAPPING_ICON "flapping.gif"
|
||||
#define SCHEDULED_DOWNTIME_ICON "downtime.gif"
|
||||
#define EMPTY_ICON "empty.gif"
|
||||
|
||||
#define ACTIVE_ICON "active.gif"
|
||||
#define ACTIVE_ICON_ALT "Active Mode"
|
||||
#define STANDBY_ICON "standby.gif"
|
||||
#define STANDBY_ICON_ALT "Standby Mode"
|
||||
|
||||
#define HOST_DOWN_ICON "critical.png"
|
||||
#define HOST_DOWN_ICON_ALT "Host Down"
|
||||
#define HOST_UNREACHABLE_ICON "critical.png"
|
||||
#define HOST_UNREACHABLE_ICON_ALT "Host Unreachable"
|
||||
#define HOST_UP_ICON "recovery.png"
|
||||
#define HOST_UP_ICON_ALT "Host Up"
|
||||
#define HOST_NOTIFICATION_ICON "notify.gif"
|
||||
#define HOST_NOTIFICATION_ICON_ALT "Host Notification"
|
||||
|
||||
#define SERVICE_EVENT_ICON "serviceevent.gif"
|
||||
#define SERVICE_EVENT_ICON_ALT "Service Event Handler"
|
||||
#define HOST_EVENT_ICON "hostevent.gif"
|
||||
#define HOST_EVENT_ICON_ALT "Host Event Handler"
|
||||
|
||||
#define THERM_OK_IMAGE "thermok.png"
|
||||
#define THERM_WARNING_IMAGE "thermwarn.png"
|
||||
#define THERM_CRITICAL_IMAGE "thermcrit.png"
|
||||
|
||||
#define CONFIGURATION_ICON "config.gif"
|
||||
#define NOTES_ICON "notes.gif"
|
||||
#define ACTION_ICON "action.gif"
|
||||
#define DETAIL_ICON "detail.gif"
|
||||
|
||||
#define PARENT_TRAVERSAL_ICON "parentup.gif"
|
||||
|
||||
#define TAC_DISABLED_ICON "tacdisabled.png"
|
||||
#define TAC_ENABLED_ICON "tacenabled.png"
|
||||
|
||||
#define ZOOM1_ICON "zoom1.gif"
|
||||
#define ZOOM2_ICON "zoom2.gif"
|
||||
|
||||
#define CONTEXT_HELP_ICON1 "contexthelp1.gif"
|
||||
#define CONTEXT_HELP_ICON2 "contexthelp2.gif"
|
||||
|
||||
#define SPLUNK_SMALL_WHITE_ICON "splunk1.gif"
|
||||
#define SPLUNK_SMALL_BLACK_ICON "splunk2.gif"
|
||||
|
||||
|
||||
|
||||
/************************** PLUGIN RETURN VALUES ****************************/
|
||||
|
||||
#define STATE_OK 0
|
||||
#define STATE_WARNING 1
|
||||
#define STATE_CRITICAL 2
|
||||
#define STATE_UNKNOWN 3 /* changed from -1 on 02/24/2001 */
|
||||
|
||||
|
||||
/********************* EXTENDED INFO CGI DISPLAY TYPES *********************/
|
||||
|
||||
#define DISPLAY_PROCESS_INFO 0
|
||||
#define DISPLAY_HOST_INFO 1
|
||||
#define DISPLAY_SERVICE_INFO 2
|
||||
#define DISPLAY_COMMENTS 3
|
||||
#define DISPLAY_PERFORMANCE 4
|
||||
#define DISPLAY_HOSTGROUP_INFO 5
|
||||
#define DISPLAY_DOWNTIME 6
|
||||
#define DISPLAY_SCHEDULING_QUEUE 7
|
||||
#define DISPLAY_SERVICEGROUP_INFO 8
|
||||
|
||||
|
||||
/************************ COMMAND CGI COMMAND MODES *************************/
|
||||
|
||||
#define CMDMODE_NONE 0
|
||||
#define CMDMODE_REQUEST 1
|
||||
#define CMDMODE_COMMIT 2
|
||||
|
||||
|
||||
|
||||
/******************** HOST AND SERVICE NOTIFICATION TYPES ******************/
|
||||
|
||||
#define NOTIFICATION_ALL 0 /* all service and host notifications */
|
||||
#define NOTIFICATION_SERVICE_ALL 1 /* all types of service notifications */
|
||||
#define NOTIFICATION_HOST_ALL 2 /* all types of host notifications */
|
||||
#define NOTIFICATION_SERVICE_WARNING 4
|
||||
#define NOTIFICATION_SERVICE_UNKNOWN 8
|
||||
#define NOTIFICATION_SERVICE_CRITICAL 16
|
||||
#define NOTIFICATION_SERVICE_RECOVERY 32
|
||||
#define NOTIFICATION_HOST_DOWN 64
|
||||
#define NOTIFICATION_HOST_UNREACHABLE 128
|
||||
#define NOTIFICATION_HOST_RECOVERY 256
|
||||
#define NOTIFICATION_SERVICE_ACK 512
|
||||
#define NOTIFICATION_HOST_ACK 1024
|
||||
#define NOTIFICATION_SERVICE_FLAP 2048
|
||||
#define NOTIFICATION_HOST_FLAP 4096
|
||||
#define NOTIFICATION_SERVICE_CUSTOM 8192
|
||||
#define NOTIFICATION_HOST_CUSTOM 16384
|
||||
|
||||
|
||||
/********************** HOST AND SERVICE ALERT TYPES **********************/
|
||||
|
||||
#define HISTORY_ALL 0 /* all service and host alert */
|
||||
#define HISTORY_SERVICE_ALL 1 /* all types of service alerts */
|
||||
#define HISTORY_HOST_ALL 2 /* all types of host alerts */
|
||||
#define HISTORY_SERVICE_WARNING 4
|
||||
#define HISTORY_SERVICE_UNKNOWN 8
|
||||
#define HISTORY_SERVICE_CRITICAL 16
|
||||
#define HISTORY_SERVICE_RECOVERY 32
|
||||
#define HISTORY_HOST_DOWN 64
|
||||
#define HISTORY_HOST_UNREACHABLE 128
|
||||
#define HISTORY_HOST_RECOVERY 256
|
||||
|
||||
|
||||
/****************************** SORT TYPES *******************************/
|
||||
|
||||
#define SORT_NONE 0
|
||||
#define SORT_ASCENDING 1
|
||||
#define SORT_DESCENDING 2
|
||||
|
||||
|
||||
/***************************** SORT OPTIONS ******************************/
|
||||
|
||||
#define SORT_NOTHING 0
|
||||
#define SORT_HOSTNAME 1
|
||||
#define SORT_SERVICENAME 2
|
||||
#define SORT_SERVICESTATUS 3
|
||||
#define SORT_LASTCHECKTIME 4
|
||||
#define SORT_CURRENTATTEMPT 5
|
||||
#define SORT_STATEDURATION 6
|
||||
#define SORT_NEXTCHECKTIME 7
|
||||
#define SORT_HOSTSTATUS 8
|
||||
|
||||
|
||||
/****************** HOST AND SERVICE FILTER PROPERTIES *******************/
|
||||
|
||||
#define HOST_SCHEDULED_DOWNTIME 1
|
||||
#define HOST_NO_SCHEDULED_DOWNTIME 2
|
||||
#define HOST_STATE_ACKNOWLEDGED 4
|
||||
#define HOST_STATE_UNACKNOWLEDGED 8
|
||||
#define HOST_CHECKS_DISABLED 16
|
||||
#define HOST_CHECKS_ENABLED 32
|
||||
#define HOST_EVENT_HANDLER_DISABLED 64
|
||||
#define HOST_EVENT_HANDLER_ENABLED 128
|
||||
#define HOST_FLAP_DETECTION_DISABLED 256
|
||||
#define HOST_FLAP_DETECTION_ENABLED 512
|
||||
#define HOST_IS_FLAPPING 1024
|
||||
#define HOST_IS_NOT_FLAPPING 2048
|
||||
#define HOST_NOTIFICATIONS_DISABLED 4096
|
||||
#define HOST_NOTIFICATIONS_ENABLED 8192
|
||||
#define HOST_PASSIVE_CHECKS_DISABLED 16384
|
||||
#define HOST_PASSIVE_CHECKS_ENABLED 32768
|
||||
#define HOST_PASSIVE_CHECK 65536
|
||||
#define HOST_ACTIVE_CHECK 131072
|
||||
#define HOST_HARD_STATE 262144
|
||||
#define HOST_SOFT_STATE 524288
|
||||
|
||||
|
||||
#define SERVICE_SCHEDULED_DOWNTIME 1
|
||||
#define SERVICE_NO_SCHEDULED_DOWNTIME 2
|
||||
#define SERVICE_STATE_ACKNOWLEDGED 4
|
||||
#define SERVICE_STATE_UNACKNOWLEDGED 8
|
||||
#define SERVICE_CHECKS_DISABLED 16
|
||||
#define SERVICE_CHECKS_ENABLED 32
|
||||
#define SERVICE_EVENT_HANDLER_DISABLED 64
|
||||
#define SERVICE_EVENT_HANDLER_ENABLED 128
|
||||
#define SERVICE_FLAP_DETECTION_ENABLED 256
|
||||
#define SERVICE_FLAP_DETECTION_DISABLED 512
|
||||
#define SERVICE_IS_FLAPPING 1024
|
||||
#define SERVICE_IS_NOT_FLAPPING 2048
|
||||
#define SERVICE_NOTIFICATIONS_DISABLED 4096
|
||||
#define SERVICE_NOTIFICATIONS_ENABLED 8192
|
||||
#define SERVICE_PASSIVE_CHECKS_DISABLED 16384
|
||||
#define SERVICE_PASSIVE_CHECKS_ENABLED 32768
|
||||
#define SERVICE_PASSIVE_CHECK 65536
|
||||
#define SERVICE_ACTIVE_CHECK 131072
|
||||
#define SERVICE_HARD_STATE 262144
|
||||
#define SERVICE_SOFT_STATE 524288
|
||||
|
||||
|
||||
/****************************** SSI TYPES ********************************/
|
||||
|
||||
#define SSI_HEADER 0
|
||||
#define SSI_FOOTER 1
|
||||
|
||||
|
||||
|
||||
/************************ CONTEXT-SENSITIVE HELP *************************/
|
||||
|
||||
#define CONTEXTHELP_STATUS_DETAIL "A1"
|
||||
#define CONTEXTHELP_STATUS_HGOVERVIEW "A2"
|
||||
#define CONTEXTHELP_STATUS_HGSUMMARY "A3"
|
||||
#define CONTEXTHELP_STATUS_HGGRID "A4"
|
||||
#define CONTEXTHELP_STATUS_SVCPROBLEMS "A5"
|
||||
#define CONTEXTHELP_STATUS_HOST_DETAIL "A6"
|
||||
#define CONTEXTHELP_STATUS_HOSTPROBLEMS "A7"
|
||||
#define CONTEXTHELP_STATUS_SGOVERVIEW "A8"
|
||||
#define CONTEXTHELP_STATUS_SGSUMMARY "A9"
|
||||
#define CONTEXTHELP_STATUS_SGGRID "A10"
|
||||
|
||||
#define CONTEXTHELP_TAC "B1"
|
||||
|
||||
#define CONTEXTHELP_MAP "C1"
|
||||
|
||||
#define CONTEXTHELP_LOG "D1"
|
||||
|
||||
#define CONTEXTHELP_HISTORY "E1"
|
||||
|
||||
#define CONTEXTHELP_NOTIFICATIONS "F1"
|
||||
|
||||
#define CONTEXTHELP_TRENDS_MENU1 "G1"
|
||||
#define CONTEXTHELP_TRENDS_MENU2 "G2"
|
||||
#define CONTEXTHELP_TRENDS_MENU3 "G3"
|
||||
#define CONTEXTHELP_TRENDS_MENU4 "G4"
|
||||
#define CONTEXTHELP_TRENDS_HOST "G5"
|
||||
#define CONTEXTHELP_TRENDS_SERVICE "G6"
|
||||
|
||||
#define CONTEXTHELP_AVAIL_MENU1 "H1"
|
||||
#define CONTEXTHELP_AVAIL_MENU2 "H2"
|
||||
#define CONTEXTHELP_AVAIL_MENU3 "H3"
|
||||
#define CONTEXTHELP_AVAIL_MENU4 "H4"
|
||||
#define CONTEXTHELP_AVAIL_MENU5 "H5"
|
||||
#define CONTEXTHELP_AVAIL_HOSTGROUP "H6"
|
||||
#define CONTEXTHELP_AVAIL_HOST "H7"
|
||||
#define CONTEXTHELP_AVAIL_SERVICE "H8"
|
||||
#define CONTEXTHELP_AVAIL_SERVICEGROUP "H9"
|
||||
|
||||
#define CONTEXTHELP_EXT_HOST "I1"
|
||||
#define CONTEXTHELP_EXT_SERVICE "I2"
|
||||
#define CONTEXTHELP_EXT_HOSTGROUP "I3"
|
||||
#define CONTEXTHELP_EXT_PROCESS "I4"
|
||||
#define CONTEXTHELP_EXT_PERFORMANCE "I5"
|
||||
#define CONTEXTHELP_EXT_COMMENTS "I6"
|
||||
#define CONTEXTHELP_EXT_DOWNTIME "I7"
|
||||
#define CONTEXTHELP_EXT_QUEUE "I8"
|
||||
#define CONTEXTHELP_EXT_SERVICEGROUP "I9"
|
||||
|
||||
#define CONTEXTHELP_CMD_INPUT "J1"
|
||||
#define CONTEXTHELP_CMD_COMMIT "J2"
|
||||
|
||||
#define CONTEXTHELP_OUTAGES "K1"
|
||||
|
||||
#define CONTEXTHELP_CONFIG_MENU "L1"
|
||||
#define CONTEXTHELP_CONFIG_HOSTS "L2"
|
||||
#define CONTEXTHELP_CONFIG_HOSTDEPENDENCIES "L3"
|
||||
#define CONTEXTHELP_CONFIG_HOSTESCALATIONS "L4"
|
||||
#define CONTEXTHELP_CONFIG_HOSTGROUPS "L5"
|
||||
#define CONTEXTHELP_CONFIG_HOSTGROUPESCALATIONS "L6"
|
||||
#define CONTEXTHELP_CONFIG_SERVICES "L7"
|
||||
#define CONTEXTHELP_CONFIG_SERVICEDEPENDENCIES "L8"
|
||||
#define CONTEXTHELP_CONFIG_SERVICEESCALATIONS "L9"
|
||||
#define CONTEXTHELP_CONFIG_CONTACTS "L10"
|
||||
#define CONTEXTHELP_CONFIG_CONTACTGROUPS "L11"
|
||||
#define CONTEXTHELP_CONFIG_TIMEPERIODS "L12"
|
||||
#define CONTEXTHELP_CONFIG_COMMANDS "L13"
|
||||
#define CONTEXTHELP_CONFIG_HOSTEXTINFO "L14"
|
||||
#define CONTEXTHELP_CONFIG_SERVICEEXTINFO "L15"
|
||||
#define CONTEXTHELP_CONFIG_SERVICEGROUPS "L16"
|
||||
|
||||
#define CONTEXTHELP_HISTOGRAM_MENU1 "M1"
|
||||
#define CONTEXTHELP_HISTOGRAM_MENU2 "M2"
|
||||
#define CONTEXTHELP_HISTOGRAM_MENU3 "M3"
|
||||
#define CONTEXTHELP_HISTOGRAM_MENU4 "M4"
|
||||
#define CONTEXTHELP_HISTOGRAM_HOST "M5"
|
||||
#define CONTEXTHELP_HISTOGRAM_SERVICE "M6"
|
||||
|
||||
#define CONTEXTHELP_SUMMARY_MENU "N1"
|
||||
#define CONTEXTHELP_SUMMARY_RECENT_ALERTS "N2"
|
||||
#define CONTEXTHELP_SUMMARY_ALERT_TOTALS "N3"
|
||||
#define CONTEXTHELP_SUMMARY_HOSTGROUP_ALERT_TOTALS "N4"
|
||||
#define CONTEXTHELP_SUMMARY_HOST_ALERT_TOTALS "N5"
|
||||
#define CONTEXTHELP_SUMMARY_SERVICE_ALERT_TOTALS "N6"
|
||||
#define CONTEXTHELP_SUMMARY_ALERT_PRODUCERS "N7"
|
||||
#define CONTEXTHELP_SUMMARY_SERVICEGROUP_ALERT_TOTALS "N8"
|
||||
|
||||
|
||||
/************************** LIFO RETURN CODES ****************************/
|
||||
|
||||
#define LIFO_OK 0
|
||||
#define LIFO_ERROR_MEMORY 1
|
||||
#define LIFO_ERROR_FILE 2
|
||||
#define LIFO_ERROR_DATA 3
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*************************** DATA STRUCTURES *****************************/
|
||||
|
||||
/* LIFO data structure */
|
||||
typedef struct lifo_struct{
|
||||
char *data;
|
||||
struct lifo_struct *next;
|
||||
}lifo;
|
||||
|
||||
|
||||
/* MMAPFILE structure - used for reading files via mmap() */
|
||||
typedef struct mmapfile_struct{
|
||||
char *path;
|
||||
int mode;
|
||||
int fd;
|
||||
unsigned long file_size;
|
||||
unsigned long current_position;
|
||||
unsigned long current_line;
|
||||
void *mmap_buf;
|
||||
}mmapfile;
|
||||
|
||||
|
||||
|
||||
/******************************** FUNCTIONS *******************************/
|
||||
|
||||
void reset_cgi_vars(void);
|
||||
void free_cgi_vars(void);
|
||||
void free_memory(void);
|
||||
|
||||
char * get_cgi_config_location(void); /* gets location of the CGI config file to read */
|
||||
char * get_cmd_file_location(void); /* gets location of external command file to write to */
|
||||
|
||||
int read_cgi_config_file(char *);
|
||||
int read_main_config_file(char *);
|
||||
int read_all_object_configuration_data(char *,int);
|
||||
int read_all_status_data(char *,int);
|
||||
|
||||
int hashfunc(const char *name1, const char *name2, int hashslots);
|
||||
int compare_hashdata(const char *,const char *,const char *,const char *);
|
||||
|
||||
void strip(char *); /* strips newlines, carriage returns, and spaces from end of buffer */
|
||||
char *unescape_newlines(char *);
|
||||
void sanitize_plugin_output(char *); /* strips HTML and bad characters from plugin output */
|
||||
void strip_html_brackets(char *); /* strips > and < from string */
|
||||
int process_macros(char *,char **,int); /* processes macros in a string */
|
||||
|
||||
void get_time_string(time_t *,char *,int,int); /* gets a date/time string */
|
||||
void get_datetime_string(time_t *,char *,int,int);
|
||||
void get_interval_time_string(double,char *,int); /* gets a time string for an interval of time */
|
||||
void get_expire_time_string(time_t *,char *,int); /* gets a date/time string in the format used for Expire: tags*/
|
||||
|
||||
char * my_strtok(char *,char *); /* replacement for strtok() function - doesn't skip multiple tokens */
|
||||
char * my_strsep (char **, const char *);
|
||||
#ifdef REMOVED_10182007
|
||||
int my_free(void **); /* my wrapper for free() */
|
||||
#endif
|
||||
|
||||
char * url_encode(char *); /* encodes a string in proper URL format */
|
||||
char * html_encode(char *,int); /* encodes a string in HTML format (for what the user sees) */
|
||||
char * escape_string(char *); /* escape string for html form usage */
|
||||
|
||||
void get_time_breakdown(unsigned long,int *,int *,int *,int *); /* given total seconds, get days, hours, minutes, seconds */
|
||||
|
||||
void get_log_archive_to_use(int,char *,int); /* determines the name of the log archive to use */
|
||||
void determine_log_rotation_times(int);
|
||||
int determine_archive_to_use_from_time(time_t);
|
||||
|
||||
void print_extra_hostgroup_url(char *,char *);
|
||||
void print_extra_servicegroup_url(char *,char *);
|
||||
|
||||
void display_info_table(char *,int,authdata *);
|
||||
void display_nav_table(char *,int);
|
||||
|
||||
void display_splunk_host_url(host *);
|
||||
void display_splunk_service_url(service *);
|
||||
void display_splunk_generic_url(char *,int);
|
||||
void strip_splunk_query_terms(char *);
|
||||
|
||||
void include_ssi_files(char *,int); /* include user-defined SSI footers/headers */
|
||||
void include_ssi_file(char *); /* include user-defined SSI footer/header */
|
||||
|
||||
void cgi_config_file_error(char *);
|
||||
void main_config_file_error(char *);
|
||||
void object_data_error(void);
|
||||
void status_data_error(void);
|
||||
|
||||
void display_context_help(char *); /* displays context-sensitive help window */
|
||||
|
||||
int read_file_into_lifo(char *); /* LIFO functions */
|
||||
void free_lifo_memory(void);
|
||||
int push_lifo(char *);
|
||||
char *pop_lifo(void);
|
||||
|
||||
mmapfile *mmap_fopen(char *); /* open a file read-only using mmap() */
|
||||
int mmap_fclose(mmapfile *);
|
||||
char *mmap_fgets(mmapfile *);
|
||||
char *mmap_fgets_multiline(mmapfile *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
128
nagios/comments.h
Normal file
128
nagios/comments.h
Normal file
@@ -0,0 +1,128 @@
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* COMMENTS.H - Header file for comment functions
|
||||
*
|
||||
* Copyright (c) 1999-2006 Ethan Galstad (egalstad@nagios.org)
|
||||
* Last Modified: 12-26-2006
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#ifndef _COMMENTS_H
|
||||
#define _COMMENTS_H
|
||||
|
||||
#include "config.h"
|
||||
#include "common.h"
|
||||
#include "objects.h"
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**************************** COMMENT SOURCES ******************************/
|
||||
|
||||
#define COMMENTSOURCE_INTERNAL 0
|
||||
#define COMMENTSOURCE_EXTERNAL 1
|
||||
|
||||
|
||||
|
||||
/***************************** COMMENT TYPES *******************************/
|
||||
|
||||
#define HOST_COMMENT 1
|
||||
#define SERVICE_COMMENT 2
|
||||
|
||||
|
||||
/****************************** ENTRY TYPES ********************************/
|
||||
|
||||
#define USER_COMMENT 1
|
||||
#define DOWNTIME_COMMENT 2
|
||||
#define FLAPPING_COMMENT 3
|
||||
#define ACKNOWLEDGEMENT_COMMENT 4
|
||||
|
||||
|
||||
/*************************** CHAINED HASH LIMITS ***************************/
|
||||
|
||||
#define COMMENT_HASHSLOTS 1024
|
||||
|
||||
|
||||
|
||||
/**************************** DATA STRUCTURES ******************************/
|
||||
|
||||
|
||||
/* COMMENT structure */
|
||||
typedef struct comment_struct{
|
||||
int comment_type;
|
||||
int entry_type;
|
||||
unsigned long comment_id;
|
||||
int source;
|
||||
int persistent;
|
||||
time_t entry_time;
|
||||
int expires;
|
||||
time_t expire_time;
|
||||
char *host_name;
|
||||
char *service_description;
|
||||
char *author;
|
||||
char *comment_data;
|
||||
struct comment_struct *next;
|
||||
struct comment_struct *nexthash;
|
||||
}comment;
|
||||
|
||||
|
||||
#ifdef NSCORE
|
||||
int initialize_comment_data(char *); /* initializes comment data */
|
||||
int cleanup_comment_data(char *); /* cleans up comment data */
|
||||
int add_new_comment(int,int,char *,char *,time_t,char *,char *,int,int,int,time_t,unsigned long *); /* adds a new host or service comment */
|
||||
int add_new_host_comment(int,char *,time_t,char *,char *,int,int,int,time_t,unsigned long *); /* adds a new host comment */
|
||||
int add_new_service_comment(int,char *,char *,time_t,char *,char *,int,int,int,time_t,unsigned long *); /* adds a new service comment */
|
||||
int delete_comment(int,unsigned long); /* deletes a host or service comment */
|
||||
int delete_host_comment(unsigned long); /* deletes a host comment */
|
||||
int delete_service_comment(unsigned long); /* deletes a service comment */
|
||||
int delete_all_comments(int,char *,char *); /* deletes all comments for a particular host or service */
|
||||
int delete_all_host_comments(char *); /* deletes all comments for a specific host */
|
||||
int delete_host_acknowledgement_comments(host *); /* deletes all non-persistent ack comments for a specific host */
|
||||
int delete_all_service_comments(char *,char *); /* deletes all comments for a specific service */
|
||||
int delete_service_acknowledgement_comments(service *); /* deletes all non-persistent ack comments for a specific service */
|
||||
|
||||
int check_for_expired_comment(unsigned long); /* expires a comment */
|
||||
#endif
|
||||
|
||||
comment *find_comment(unsigned long,int); /* finds a specific comment */
|
||||
comment *find_service_comment(unsigned long); /* finds a specific service comment */
|
||||
comment *find_host_comment(unsigned long); /* finds a specific host comment */
|
||||
|
||||
comment *get_first_comment_by_host(char *);
|
||||
comment *get_next_comment_by_host(char *,comment *);
|
||||
|
||||
int number_of_host_comments(char *); /* returns the number of comments associated with a particular host */
|
||||
int number_of_service_comments(char *, char *); /* returns the number of comments associated with a particular service */
|
||||
|
||||
int add_comment(int,int,char *,char *,time_t,char *,char *,unsigned long,int,int,time_t,int); /* adds a comment (host or service) */
|
||||
int add_host_comment(int,char *,time_t,char *,char *,unsigned long,int,int,time_t,int); /* adds a host comment */
|
||||
int add_service_comment(int,char *,char *,time_t,char *,char *,unsigned long,int,int,time_t,int); /* adds a service comment */
|
||||
|
||||
int add_comment_to_hashlist(comment *);
|
||||
|
||||
void free_comment_data(void); /* frees memory allocated to the comment list */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
501
nagios/common.h
Normal file
501
nagios/common.h
Normal file
@@ -0,0 +1,501 @@
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
* Nagios Common Header File
|
||||
* Written By: Ethan Galstad (egalstad@nagios.org)
|
||||
* Last Modified: 10-22-2007
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
************************************************************************/
|
||||
|
||||
|
||||
#define PROGRAM_VERSION "3.2.0"
|
||||
#define PROGRAM_MODIFICATION_DATE "08-12-2009"
|
||||
|
||||
/*#define DEBUG_CHECK_IPC 1 */
|
||||
/*#define DEBUG_CHECK_IPC2 1*/
|
||||
|
||||
|
||||
|
||||
/* daemon is thread safe */
|
||||
#ifdef NSCORE
|
||||
#ifndef _REENTRANT
|
||||
#define _REENTRANT
|
||||
#endif
|
||||
#ifndef _THREAD_SAFE
|
||||
#define _THREAD_SAFE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Experimental performance tweaks - use with caution */
|
||||
#undef USE_MEMORY_PERFORMANCE_TWEAKS
|
||||
|
||||
/* my_free has been freed from bondage as a function */
|
||||
#define my_free(ptr) { if(ptr) { free(ptr); ptr = NULL; } }
|
||||
|
||||
|
||||
|
||||
/***************************** COMMANDS *********************************/
|
||||
|
||||
#define CMD_NONE 0
|
||||
|
||||
#define CMD_ADD_HOST_COMMENT 1
|
||||
#define CMD_DEL_HOST_COMMENT 2
|
||||
|
||||
#define CMD_ADD_SVC_COMMENT 3
|
||||
#define CMD_DEL_SVC_COMMENT 4
|
||||
|
||||
#define CMD_ENABLE_SVC_CHECK 5
|
||||
#define CMD_DISABLE_SVC_CHECK 6
|
||||
|
||||
#define CMD_SCHEDULE_SVC_CHECK 7
|
||||
|
||||
#define CMD_DELAY_SVC_NOTIFICATION 9
|
||||
|
||||
#define CMD_DELAY_HOST_NOTIFICATION 10
|
||||
|
||||
#define CMD_DISABLE_NOTIFICATIONS 11
|
||||
#define CMD_ENABLE_NOTIFICATIONS 12
|
||||
|
||||
#define CMD_RESTART_PROCESS 13
|
||||
#define CMD_SHUTDOWN_PROCESS 14
|
||||
|
||||
#define CMD_ENABLE_HOST_SVC_CHECKS 15
|
||||
#define CMD_DISABLE_HOST_SVC_CHECKS 16
|
||||
|
||||
#define CMD_SCHEDULE_HOST_SVC_CHECKS 17
|
||||
|
||||
#define CMD_DELAY_HOST_SVC_NOTIFICATIONS 19 /* currently unimplemented */
|
||||
|
||||
#define CMD_DEL_ALL_HOST_COMMENTS 20
|
||||
#define CMD_DEL_ALL_SVC_COMMENTS 21
|
||||
|
||||
#define CMD_ENABLE_SVC_NOTIFICATIONS 22
|
||||
#define CMD_DISABLE_SVC_NOTIFICATIONS 23
|
||||
#define CMD_ENABLE_HOST_NOTIFICATIONS 24
|
||||
#define CMD_DISABLE_HOST_NOTIFICATIONS 25
|
||||
#define CMD_ENABLE_ALL_NOTIFICATIONS_BEYOND_HOST 26
|
||||
#define CMD_DISABLE_ALL_NOTIFICATIONS_BEYOND_HOST 27
|
||||
#define CMD_ENABLE_HOST_SVC_NOTIFICATIONS 28
|
||||
#define CMD_DISABLE_HOST_SVC_NOTIFICATIONS 29
|
||||
|
||||
#define CMD_PROCESS_SERVICE_CHECK_RESULT 30
|
||||
|
||||
#define CMD_SAVE_STATE_INFORMATION 31
|
||||
#define CMD_READ_STATE_INFORMATION 32
|
||||
|
||||
#define CMD_ACKNOWLEDGE_HOST_PROBLEM 33
|
||||
#define CMD_ACKNOWLEDGE_SVC_PROBLEM 34
|
||||
|
||||
#define CMD_START_EXECUTING_SVC_CHECKS 35
|
||||
#define CMD_STOP_EXECUTING_SVC_CHECKS 36
|
||||
|
||||
#define CMD_START_ACCEPTING_PASSIVE_SVC_CHECKS 37
|
||||
#define CMD_STOP_ACCEPTING_PASSIVE_SVC_CHECKS 38
|
||||
|
||||
#define CMD_ENABLE_PASSIVE_SVC_CHECKS 39
|
||||
#define CMD_DISABLE_PASSIVE_SVC_CHECKS 40
|
||||
|
||||
#define CMD_ENABLE_EVENT_HANDLERS 41
|
||||
#define CMD_DISABLE_EVENT_HANDLERS 42
|
||||
|
||||
#define CMD_ENABLE_HOST_EVENT_HANDLER 43
|
||||
#define CMD_DISABLE_HOST_EVENT_HANDLER 44
|
||||
|
||||
#define CMD_ENABLE_SVC_EVENT_HANDLER 45
|
||||
#define CMD_DISABLE_SVC_EVENT_HANDLER 46
|
||||
|
||||
#define CMD_ENABLE_HOST_CHECK 47
|
||||
#define CMD_DISABLE_HOST_CHECK 48
|
||||
|
||||
#define CMD_START_OBSESSING_OVER_SVC_CHECKS 49
|
||||
#define CMD_STOP_OBSESSING_OVER_SVC_CHECKS 50
|
||||
|
||||
#define CMD_REMOVE_HOST_ACKNOWLEDGEMENT 51
|
||||
#define CMD_REMOVE_SVC_ACKNOWLEDGEMENT 52
|
||||
|
||||
#define CMD_SCHEDULE_FORCED_HOST_SVC_CHECKS 53
|
||||
#define CMD_SCHEDULE_FORCED_SVC_CHECK 54
|
||||
|
||||
#define CMD_SCHEDULE_HOST_DOWNTIME 55
|
||||
#define CMD_SCHEDULE_SVC_DOWNTIME 56
|
||||
|
||||
#define CMD_ENABLE_HOST_FLAP_DETECTION 57
|
||||
#define CMD_DISABLE_HOST_FLAP_DETECTION 58
|
||||
|
||||
#define CMD_ENABLE_SVC_FLAP_DETECTION 59
|
||||
#define CMD_DISABLE_SVC_FLAP_DETECTION 60
|
||||
|
||||
#define CMD_ENABLE_FLAP_DETECTION 61
|
||||
#define CMD_DISABLE_FLAP_DETECTION 62
|
||||
|
||||
#define CMD_ENABLE_HOSTGROUP_SVC_NOTIFICATIONS 63
|
||||
#define CMD_DISABLE_HOSTGROUP_SVC_NOTIFICATIONS 64
|
||||
|
||||
#define CMD_ENABLE_HOSTGROUP_HOST_NOTIFICATIONS 65
|
||||
#define CMD_DISABLE_HOSTGROUP_HOST_NOTIFICATIONS 66
|
||||
|
||||
#define CMD_ENABLE_HOSTGROUP_SVC_CHECKS 67
|
||||
#define CMD_DISABLE_HOSTGROUP_SVC_CHECKS 68
|
||||
|
||||
#define CMD_CANCEL_HOST_DOWNTIME 69 /* not internally implemented */
|
||||
#define CMD_CANCEL_SVC_DOWNTIME 70 /* not internally implemented */
|
||||
|
||||
#define CMD_CANCEL_ACTIVE_HOST_DOWNTIME 71 /* old - no longer used */
|
||||
#define CMD_CANCEL_PENDING_HOST_DOWNTIME 72 /* old - no longer used */
|
||||
|
||||
#define CMD_CANCEL_ACTIVE_SVC_DOWNTIME 73 /* old - no longer used */
|
||||
#define CMD_CANCEL_PENDING_SVC_DOWNTIME 74 /* old - no longer used */
|
||||
|
||||
#define CMD_CANCEL_ACTIVE_HOST_SVC_DOWNTIME 75 /* unimplemented */
|
||||
#define CMD_CANCEL_PENDING_HOST_SVC_DOWNTIME 76 /* unimplemented */
|
||||
|
||||
#define CMD_FLUSH_PENDING_COMMANDS 77
|
||||
|
||||
#define CMD_DEL_HOST_DOWNTIME 78
|
||||
#define CMD_DEL_SVC_DOWNTIME 79
|
||||
|
||||
#define CMD_ENABLE_FAILURE_PREDICTION 80
|
||||
#define CMD_DISABLE_FAILURE_PREDICTION 81
|
||||
|
||||
#define CMD_ENABLE_PERFORMANCE_DATA 82
|
||||
#define CMD_DISABLE_PERFORMANCE_DATA 83
|
||||
|
||||
#define CMD_SCHEDULE_HOSTGROUP_HOST_DOWNTIME 84
|
||||
#define CMD_SCHEDULE_HOSTGROUP_SVC_DOWNTIME 85
|
||||
#define CMD_SCHEDULE_HOST_SVC_DOWNTIME 86
|
||||
|
||||
/* new commands in Nagios 2.x found below... */
|
||||
#define CMD_PROCESS_HOST_CHECK_RESULT 87
|
||||
|
||||
#define CMD_START_EXECUTING_HOST_CHECKS 88
|
||||
#define CMD_STOP_EXECUTING_HOST_CHECKS 89
|
||||
|
||||
#define CMD_START_ACCEPTING_PASSIVE_HOST_CHECKS 90
|
||||
#define CMD_STOP_ACCEPTING_PASSIVE_HOST_CHECKS 91
|
||||
|
||||
#define CMD_ENABLE_PASSIVE_HOST_CHECKS 92
|
||||
#define CMD_DISABLE_PASSIVE_HOST_CHECKS 93
|
||||
|
||||
#define CMD_START_OBSESSING_OVER_HOST_CHECKS 94
|
||||
#define CMD_STOP_OBSESSING_OVER_HOST_CHECKS 95
|
||||
|
||||
#define CMD_SCHEDULE_HOST_CHECK 96
|
||||
#define CMD_SCHEDULE_FORCED_HOST_CHECK 98
|
||||
|
||||
#define CMD_START_OBSESSING_OVER_SVC 99
|
||||
#define CMD_STOP_OBSESSING_OVER_SVC 100
|
||||
|
||||
#define CMD_START_OBSESSING_OVER_HOST 101
|
||||
#define CMD_STOP_OBSESSING_OVER_HOST 102
|
||||
|
||||
#define CMD_ENABLE_HOSTGROUP_HOST_CHECKS 103
|
||||
#define CMD_DISABLE_HOSTGROUP_HOST_CHECKS 104
|
||||
|
||||
#define CMD_ENABLE_HOSTGROUP_PASSIVE_SVC_CHECKS 105
|
||||
#define CMD_DISABLE_HOSTGROUP_PASSIVE_SVC_CHECKS 106
|
||||
|
||||
#define CMD_ENABLE_HOSTGROUP_PASSIVE_HOST_CHECKS 107
|
||||
#define CMD_DISABLE_HOSTGROUP_PASSIVE_HOST_CHECKS 108
|
||||
|
||||
#define CMD_ENABLE_SERVICEGROUP_SVC_NOTIFICATIONS 109
|
||||
#define CMD_DISABLE_SERVICEGROUP_SVC_NOTIFICATIONS 110
|
||||
|
||||
#define CMD_ENABLE_SERVICEGROUP_HOST_NOTIFICATIONS 111
|
||||
#define CMD_DISABLE_SERVICEGROUP_HOST_NOTIFICATIONS 112
|
||||
|
||||
#define CMD_ENABLE_SERVICEGROUP_SVC_CHECKS 113
|
||||
#define CMD_DISABLE_SERVICEGROUP_SVC_CHECKS 114
|
||||
|
||||
#define CMD_ENABLE_SERVICEGROUP_HOST_CHECKS 115
|
||||
#define CMD_DISABLE_SERVICEGROUP_HOST_CHECKS 116
|
||||
|
||||
#define CMD_ENABLE_SERVICEGROUP_PASSIVE_SVC_CHECKS 117
|
||||
#define CMD_DISABLE_SERVICEGROUP_PASSIVE_SVC_CHECKS 118
|
||||
|
||||
#define CMD_ENABLE_SERVICEGROUP_PASSIVE_HOST_CHECKS 119
|
||||
#define CMD_DISABLE_SERVICEGROUP_PASSIVE_HOST_CHECKS 120
|
||||
|
||||
#define CMD_SCHEDULE_SERVICEGROUP_HOST_DOWNTIME 121
|
||||
#define CMD_SCHEDULE_SERVICEGROUP_SVC_DOWNTIME 122
|
||||
|
||||
#define CMD_CHANGE_GLOBAL_HOST_EVENT_HANDLER 123
|
||||
#define CMD_CHANGE_GLOBAL_SVC_EVENT_HANDLER 124
|
||||
|
||||
#define CMD_CHANGE_HOST_EVENT_HANDLER 125
|
||||
#define CMD_CHANGE_SVC_EVENT_HANDLER 126
|
||||
|
||||
#define CMD_CHANGE_HOST_CHECK_COMMAND 127
|
||||
#define CMD_CHANGE_SVC_CHECK_COMMAND 128
|
||||
|
||||
#define CMD_CHANGE_NORMAL_HOST_CHECK_INTERVAL 129
|
||||
#define CMD_CHANGE_NORMAL_SVC_CHECK_INTERVAL 130
|
||||
#define CMD_CHANGE_RETRY_SVC_CHECK_INTERVAL 131
|
||||
|
||||
#define CMD_CHANGE_MAX_HOST_CHECK_ATTEMPTS 132
|
||||
#define CMD_CHANGE_MAX_SVC_CHECK_ATTEMPTS 133
|
||||
|
||||
#define CMD_SCHEDULE_AND_PROPAGATE_TRIGGERED_HOST_DOWNTIME 134
|
||||
|
||||
#define CMD_ENABLE_HOST_AND_CHILD_NOTIFICATIONS 135
|
||||
#define CMD_DISABLE_HOST_AND_CHILD_NOTIFICATIONS 136
|
||||
|
||||
#define CMD_SCHEDULE_AND_PROPAGATE_HOST_DOWNTIME 137
|
||||
|
||||
#define CMD_ENABLE_SERVICE_FRESHNESS_CHECKS 138
|
||||
#define CMD_DISABLE_SERVICE_FRESHNESS_CHECKS 139
|
||||
|
||||
#define CMD_ENABLE_HOST_FRESHNESS_CHECKS 140
|
||||
#define CMD_DISABLE_HOST_FRESHNESS_CHECKS 141
|
||||
|
||||
#define CMD_SET_HOST_NOTIFICATION_NUMBER 142
|
||||
#define CMD_SET_SVC_NOTIFICATION_NUMBER 143
|
||||
|
||||
/* new commands in Nagios 3.x found below... */
|
||||
#define CMD_CHANGE_HOST_CHECK_TIMEPERIOD 144
|
||||
#define CMD_CHANGE_SVC_CHECK_TIMEPERIOD 145
|
||||
|
||||
#define CMD_PROCESS_FILE 146
|
||||
|
||||
#define CMD_CHANGE_CUSTOM_HOST_VAR 147
|
||||
#define CMD_CHANGE_CUSTOM_SVC_VAR 148
|
||||
#define CMD_CHANGE_CUSTOM_CONTACT_VAR 149
|
||||
|
||||
#define CMD_ENABLE_CONTACT_HOST_NOTIFICATIONS 150
|
||||
#define CMD_DISABLE_CONTACT_HOST_NOTIFICATIONS 151
|
||||
#define CMD_ENABLE_CONTACT_SVC_NOTIFICATIONS 152
|
||||
#define CMD_DISABLE_CONTACT_SVC_NOTIFICATIONS 153
|
||||
|
||||
#define CMD_ENABLE_CONTACTGROUP_HOST_NOTIFICATIONS 154
|
||||
#define CMD_DISABLE_CONTACTGROUP_HOST_NOTIFICATIONS 155
|
||||
#define CMD_ENABLE_CONTACTGROUP_SVC_NOTIFICATIONS 156
|
||||
#define CMD_DISABLE_CONTACTGROUP_SVC_NOTIFICATIONS 157
|
||||
|
||||
#define CMD_CHANGE_RETRY_HOST_CHECK_INTERVAL 158
|
||||
|
||||
#define CMD_SEND_CUSTOM_HOST_NOTIFICATION 159
|
||||
#define CMD_SEND_CUSTOM_SVC_NOTIFICATION 160
|
||||
|
||||
#define CMD_CHANGE_HOST_NOTIFICATION_TIMEPERIOD 161
|
||||
#define CMD_CHANGE_SVC_NOTIFICATION_TIMEPERIOD 162
|
||||
#define CMD_CHANGE_CONTACT_HOST_NOTIFICATION_TIMEPERIOD 163
|
||||
#define CMD_CHANGE_CONTACT_SVC_NOTIFICATION_TIMEPERIOD 164
|
||||
|
||||
#define CMD_CHANGE_HOST_MODATTR 165
|
||||
#define CMD_CHANGE_SVC_MODATTR 166
|
||||
#define CMD_CHANGE_CONTACT_MODATTR 167
|
||||
#define CMD_CHANGE_CONTACT_MODHATTR 168
|
||||
#define CMD_CHANGE_CONTACT_MODSATTR 169
|
||||
|
||||
/* custom command introduced in Nagios 3.x */
|
||||
#define CMD_CUSTOM_COMMAND 999
|
||||
|
||||
|
||||
|
||||
/************************ SERVICE CHECK TYPES ****************************/
|
||||
|
||||
#define SERVICE_CHECK_ACTIVE 0 /* Nagios performed the service check */
|
||||
#define SERVICE_CHECK_PASSIVE 1 /* the service check result was submitted by an external source */
|
||||
|
||||
|
||||
/************************** HOST CHECK TYPES *****************************/
|
||||
|
||||
#define HOST_CHECK_ACTIVE 0 /* Nagios performed the host check */
|
||||
#define HOST_CHECK_PASSIVE 1 /* the host check result was submitted by an external source */
|
||||
|
||||
|
||||
/************************ SERVICE STATE TYPES ****************************/
|
||||
|
||||
#define SOFT_STATE 0
|
||||
#define HARD_STATE 1
|
||||
|
||||
|
||||
/************************* SCHEDULED DOWNTIME TYPES **********************/
|
||||
|
||||
#define SERVICE_DOWNTIME 1 /* service downtime */
|
||||
#define HOST_DOWNTIME 2 /* host downtime */
|
||||
#define ANY_DOWNTIME 3 /* host or service downtime */
|
||||
|
||||
|
||||
/************************** NOTIFICATION OPTIONS *************************/
|
||||
|
||||
#define NOTIFICATION_OPTION_NONE 0
|
||||
#define NOTIFICATION_OPTION_BROADCAST 1
|
||||
#define NOTIFICATION_OPTION_FORCED 2
|
||||
#define NOTIFICATION_OPTION_INCREMENT 4
|
||||
|
||||
|
||||
/************************** ACKNOWLEDGEMENT TYPES ************************/
|
||||
|
||||
#define HOST_ACKNOWLEDGEMENT 0
|
||||
#define SERVICE_ACKNOWLEDGEMENT 1
|
||||
|
||||
#define ACKNOWLEDGEMENT_NONE 0
|
||||
#define ACKNOWLEDGEMENT_NORMAL 1
|
||||
#define ACKNOWLEDGEMENT_STICKY 2
|
||||
|
||||
|
||||
/**************************** DEPENDENCY TYPES ***************************/
|
||||
|
||||
#define NOTIFICATION_DEPENDENCY 1
|
||||
#define EXECUTION_DEPENDENCY 2
|
||||
|
||||
|
||||
|
||||
/********************** HOST/SERVICE CHECK OPTIONS ***********************/
|
||||
|
||||
#define CHECK_OPTION_NONE 0 /* no check options */
|
||||
#define CHECK_OPTION_FORCE_EXECUTION 1 /* force execution of a check (ignores disabled services/hosts, invalid timeperiods) */
|
||||
#define CHECK_OPTION_FRESHNESS_CHECK 2 /* this is a freshness check */
|
||||
#define CHECK_OPTION_ORPHAN_CHECK 4 /* this is an orphan check */
|
||||
|
||||
|
||||
/**************************** PROGRAM MODES ******************************/
|
||||
|
||||
#define STANDBY_MODE 0
|
||||
#define ACTIVE_MODE 1
|
||||
|
||||
|
||||
/************************** LOG ROTATION MODES ***************************/
|
||||
|
||||
#define LOG_ROTATION_NONE 0
|
||||
#define LOG_ROTATION_HOURLY 1
|
||||
#define LOG_ROTATION_DAILY 2
|
||||
#define LOG_ROTATION_WEEKLY 3
|
||||
#define LOG_ROTATION_MONTHLY 4
|
||||
|
||||
|
||||
/***************************** LOG VERSIONS ******************************/
|
||||
|
||||
#define LOG_VERSION_1 "1.0"
|
||||
#define LOG_VERSION_2 "2.0"
|
||||
|
||||
|
||||
|
||||
/*************************** CHECK STATISTICS ****************************/
|
||||
|
||||
#define ACTIVE_SCHEDULED_SERVICE_CHECK_STATS 0
|
||||
#define ACTIVE_ONDEMAND_SERVICE_CHECK_STATS 1
|
||||
#define PASSIVE_SERVICE_CHECK_STATS 2
|
||||
#define ACTIVE_SCHEDULED_HOST_CHECK_STATS 3
|
||||
#define ACTIVE_ONDEMAND_HOST_CHECK_STATS 4
|
||||
#define PASSIVE_HOST_CHECK_STATS 5
|
||||
#define ACTIVE_CACHED_HOST_CHECK_STATS 6
|
||||
#define ACTIVE_CACHED_SERVICE_CHECK_STATS 7
|
||||
#define EXTERNAL_COMMAND_STATS 8
|
||||
#define PARALLEL_HOST_CHECK_STATS 9
|
||||
#define SERIAL_HOST_CHECK_STATS 10
|
||||
#define MAX_CHECK_STATS_TYPES 11
|
||||
|
||||
|
||||
/************************* GENERAL DEFINITIONS **************************/
|
||||
|
||||
#define OK 0
|
||||
#define ERROR -2 /* value was changed from -1 so as to not interfere with STATUS_UNKNOWN plugin result */
|
||||
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#elif (TRUE!=1)
|
||||
#define TRUE 1
|
||||
#endif
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#elif (FALSE!=0)
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
|
||||
/****************** HOST CONFIG FILE READING OPTIONS ********************/
|
||||
|
||||
#define READ_HOSTS 1
|
||||
#define READ_HOSTGROUPS 2
|
||||
#define READ_CONTACTS 4
|
||||
#define READ_CONTACTGROUPS 8
|
||||
#define READ_SERVICES 16
|
||||
#define READ_COMMANDS 32
|
||||
#define READ_TIMEPERIODS 64
|
||||
#define READ_SERVICEESCALATIONS 128
|
||||
#define READ_HOSTGROUPESCALATIONS 256 /* no longer implemented */
|
||||
#define READ_SERVICEDEPENDENCIES 512
|
||||
#define READ_HOSTDEPENDENCIES 1024
|
||||
#define READ_HOSTESCALATIONS 2048
|
||||
#define READ_HOSTEXTINFO 4096
|
||||
#define READ_SERVICEEXTINFO 8192
|
||||
#define READ_SERVICEGROUPS 16384
|
||||
|
||||
#define READ_ALL_OBJECT_DATA READ_HOSTS | READ_HOSTGROUPS | READ_CONTACTS | READ_CONTACTGROUPS | READ_SERVICES | READ_COMMANDS | READ_TIMEPERIODS | READ_SERVICEESCALATIONS | READ_SERVICEDEPENDENCIES | READ_HOSTDEPENDENCIES | READ_HOSTESCALATIONS | READ_HOSTEXTINFO | READ_SERVICEEXTINFO | READ_SERVICEGROUPS
|
||||
|
||||
|
||||
/************************** DATE RANGE TYPES ****************************/
|
||||
|
||||
#define DATERANGE_CALENDAR_DATE 0 /* 2008-12-25 */
|
||||
#define DATERANGE_MONTH_DATE 1 /* july 4 (specific month) */
|
||||
#define DATERANGE_MONTH_DAY 2 /* day 21 (generic month) */
|
||||
#define DATERANGE_MONTH_WEEK_DAY 3 /* 3rd thursday (specific month) */
|
||||
#define DATERANGE_WEEK_DAY 4 /* 3rd thursday (generic month) */
|
||||
#define DATERANGE_TYPES 5
|
||||
|
||||
|
||||
/************************** DATE/TIME TYPES *****************************/
|
||||
|
||||
#define LONG_DATE_TIME 0
|
||||
#define SHORT_DATE_TIME 1
|
||||
#define SHORT_DATE 2
|
||||
#define SHORT_TIME 3
|
||||
#define HTTP_DATE_TIME 4 /* time formatted for use in HTTP headers */
|
||||
|
||||
|
||||
/**************************** DATE FORMATS ******************************/
|
||||
|
||||
#define DATE_FORMAT_US 0 /* U.S. (MM-DD-YYYY HH:MM:SS) */
|
||||
#define DATE_FORMAT_EURO 1 /* European (DD-MM-YYYY HH:MM:SS) */
|
||||
#define DATE_FORMAT_ISO8601 2 /* ISO8601 (YYYY-MM-DD HH:MM:SS) */
|
||||
#define DATE_FORMAT_STRICT_ISO8601 3 /* ISO8601 (YYYY-MM-DDTHH:MM:SS) */
|
||||
|
||||
|
||||
/************************** MISC DEFINITIONS ****************************/
|
||||
|
||||
#define MAX_FILENAME_LENGTH 256 /* max length of path/filename that Nagios will process */
|
||||
#define MAX_INPUT_BUFFER 1024 /* size in bytes of max. input buffer (for reading files, misc stuff) */
|
||||
#define MAX_COMMAND_BUFFER 8192 /* max length of raw or processed command line */
|
||||
#define MAX_EXTERNAL_COMMAND_LENGTH 8192 /* max length of an external command */
|
||||
|
||||
#define MAX_DATETIME_LENGTH 48
|
||||
|
||||
|
||||
/************************* MODIFIED ATTRIBUTES **************************/
|
||||
|
||||
#define MODATTR_NONE 0
|
||||
#define MODATTR_NOTIFICATIONS_ENABLED 1
|
||||
#define MODATTR_ACTIVE_CHECKS_ENABLED 2
|
||||
#define MODATTR_PASSIVE_CHECKS_ENABLED 4
|
||||
#define MODATTR_EVENT_HANDLER_ENABLED 8
|
||||
#define MODATTR_FLAP_DETECTION_ENABLED 16
|
||||
#define MODATTR_FAILURE_PREDICTION_ENABLED 32
|
||||
#define MODATTR_PERFORMANCE_DATA_ENABLED 64
|
||||
#define MODATTR_OBSESSIVE_HANDLER_ENABLED 128
|
||||
#define MODATTR_EVENT_HANDLER_COMMAND 256
|
||||
#define MODATTR_CHECK_COMMAND 512
|
||||
#define MODATTR_NORMAL_CHECK_INTERVAL 1024
|
||||
#define MODATTR_RETRY_CHECK_INTERVAL 2048
|
||||
#define MODATTR_MAX_CHECK_ATTEMPTS 4096
|
||||
#define MODATTR_FRESHNESS_CHECKS_ENABLED 8192
|
||||
#define MODATTR_CHECK_TIMEPERIOD 16384
|
||||
#define MODATTR_CUSTOM_VARIABLE 32768
|
||||
#define MODATTR_NOTIFICATION_TIMEPERIOD 65536
|
||||
|
||||
|
||||
336
nagios/config.h
Normal file
336
nagios/config.h
Normal file
@@ -0,0 +1,336 @@
|
||||
|
||||
/* include/config.h. Generated by configure. */
|
||||
/************************************************************************
|
||||
*
|
||||
* Nagios Config Header File
|
||||
* Written By: Ethan Galstad (egalstad@nagios.org)
|
||||
* Last Modified: 11-02-2008
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
************************************************************************/
|
||||
|
||||
|
||||
/***** NAGIOS STUFF *****/
|
||||
|
||||
#define DEFAULT_NAGIOS_USER "nagios"
|
||||
#define DEFAULT_NAGIOS_GROUP "nagios"
|
||||
|
||||
/* stop gcc from bitching about implicit asprintf declarations */
|
||||
#define _GNU_SOURCE 1
|
||||
|
||||
/* Event broker integration */
|
||||
#define USE_EVENT_BROKER 1
|
||||
|
||||
/* Embed a PERL interpreter into Nagios with optional cache for compiled code (contributed by Stephen Davies) */
|
||||
/* #undef EMBEDDEDPERL */
|
||||
/* #undef THREADEDPERL */
|
||||
/* 0 = cache, 1 = do not cache */
|
||||
#define DO_CLEAN "1"
|
||||
|
||||
/* commands used by CGIs */
|
||||
#define TRACEROUTE_COMMAND "/usr/bin/traceroute"
|
||||
/* #undef PING_COMMAND */
|
||||
/* #undef PING_PACKETS_FIRST */
|
||||
|
||||
/* Debugging options */
|
||||
/* function entry and exit */
|
||||
/* #undef DEBUG0 */
|
||||
/* general info messages */
|
||||
/* #undef DEBUG1 */
|
||||
/* warning messages */
|
||||
/* #undef DEBUG2 */
|
||||
/* service and host checks, other events */
|
||||
/* #undef DEBUG3 */
|
||||
/* service and host notifications */
|
||||
/* #undef DEBUG4 */
|
||||
/* SQL queries (defunct) */
|
||||
/* #undef DEBUG5 */
|
||||
|
||||
/* I/O implementations */
|
||||
#define USE_XSDDEFAULT 1
|
||||
#define USE_XCDDEFAULT 1
|
||||
#define USE_XRDDEFAULT 1
|
||||
#define USE_XODTEMPLATE 1
|
||||
#define USE_XPDDEFAULT 1
|
||||
#define USE_XDDDEFAULT 1
|
||||
|
||||
|
||||
|
||||
/***** FUNCTION DEFINITIONS *****/
|
||||
|
||||
#define HAVE_SETENV 1
|
||||
#define HAVE_UNSETENV 1
|
||||
/* #undef HAVE_SOCKET */
|
||||
#define HAVE_STRDUP 1
|
||||
#define HAVE_STRSTR 1
|
||||
#define HAVE_STRTOUL 1
|
||||
#define HAVE_INITGROUPS 1
|
||||
/* #undef HAVE_GETLOADAVG */
|
||||
#define HAVE_GDIMAGECREATETRUECOLOR 1
|
||||
|
||||
|
||||
|
||||
/***** ASPRINTF() AND FRIENDS *****/
|
||||
|
||||
/* #undef HAVE_VSNPRINTF */
|
||||
/* #undef HAVE_SNPRINTF */
|
||||
/* #undef HAVE_ASPRINTF */
|
||||
/* #undef HAVE_VASPRINTF */
|
||||
#define HAVE_C99_VSNPRINTF 1
|
||||
#define HAVE_VA_COPY 1
|
||||
/* #undef HAVE___VA_COPY */
|
||||
|
||||
|
||||
|
||||
/***** MISC DEFINITIONS *****/
|
||||
|
||||
#define USE_NANOSLEEP 1
|
||||
#define STDC_HEADERS 1
|
||||
#define HAVE_TM_ZONE 1
|
||||
/* #undef HAVE_TZNAME */
|
||||
/* #undef USE_PROC */
|
||||
#define SOCKET_SIZE_TYPE size_t
|
||||
#define GETGROUPS_T gid_t
|
||||
#define RETSIGTYPE void
|
||||
|
||||
|
||||
|
||||
/***** HEADER FILES *****/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/* needed for the time_t structures we use later... */
|
||||
/* this include must come before sys/resource.h or we can have problems on some OSes */
|
||||
#define TIME_WITH_SYS_TIME 1
|
||||
#define HAVE_SYS_TIME_H 1
|
||||
#if TIME_WITH_SYS_TIME
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#else
|
||||
#if HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#else
|
||||
#include <time.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define HAVE_SYS_RESOURCE_H 1
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
#include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_LIMITS_H 1
|
||||
#ifdef HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_PWD_H 1
|
||||
#ifdef HAVE_PWD_H
|
||||
#include <pwd.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_GRP_H 1
|
||||
#ifdef HAVE_GRP_H
|
||||
#include <grp.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_STRINGS_H 1
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_STRING_H 1
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_UNISTD_H 1
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_SYSLOG_H 1
|
||||
#ifdef HAVE_SYSLOG_H
|
||||
#include <syslog.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_SIGNAL_H 1
|
||||
#ifdef HAVE_SIGNAL_H
|
||||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
#ifdef HAVE_SYS_STAT_H
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_SYS_MMAN_H 1
|
||||
#ifdef HAVE_SYS_MMAN_H
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_FCNTL_H 1
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_STDARG_H 1
|
||||
#ifdef HAVE_STDARG_H
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_SYS_WAIT_H 1
|
||||
#ifdef HAVE_SYS_WAIT_H
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_ERRNO_H 1
|
||||
#ifdef HAVE_ERRNO_H
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_SYS_TIMEB_H 1
|
||||
#if HAVE_SYS_TIMEB_H
|
||||
#include <sys/timeb.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_SYS_IPC_H 1
|
||||
#ifdef HAVE_SYS_IPC_H
|
||||
#include <sys/ipc.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_SYS_MSG_H 1
|
||||
#ifdef HAVE_SYS_MSG_H
|
||||
#include <sys/msg.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_MATH_H 1
|
||||
#ifdef HAVE_MATH_H
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_CTYPE_H 1
|
||||
#ifdef HAVE_CTYPE_H
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_DIRENT_H 1
|
||||
#ifdef HAVE_DIRENT_H
|
||||
#include <dirent.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_PTHREAD_H 1
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_REGEX_H 1
|
||||
#ifdef HAVE_REGEX_H
|
||||
#include <regex.h>
|
||||
|
||||
#define HAVE_SYS_SOCKET_H 1
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
|
||||
/* #undef HAVE_SOCKET */
|
||||
#ifdef HAVE_SOCKET_H
|
||||
#include <socket.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_NETINET_IN_H 1
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_ARPA_INET_H 1
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_NETDB_H 1
|
||||
#ifdef HAVE_NETDB_H
|
||||
#include <netdb.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_LIBGEN_H 1
|
||||
#ifdef HAVE_LIBGEN_H
|
||||
#include <libgen.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_SYS_UN_H 1
|
||||
#ifdef HAVE_SYS_UN_H
|
||||
#include <sys/un.h>
|
||||
#endif
|
||||
|
||||
#define HAVE_SYS_POLL_H 1
|
||||
#ifdef HAVE_SYS_POLL_H
|
||||
#include <sys/poll.h>
|
||||
#endif
|
||||
|
||||
/* #define HAVE_GETOPT_H 1 */
|
||||
#ifdef HAVE_GETOPT_H
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
/* #undef HAVE_LINUX_MODULE_H */
|
||||
#ifdef HAVE_LINUX_MODULE_H
|
||||
#include <linux/module.h>
|
||||
#endif
|
||||
|
||||
/* configure script should allow user to override ltdl choice, but this will do for now... */
|
||||
/* #undef USE_LTDL */
|
||||
|
||||
#ifdef HAVE_LTDL_H
|
||||
#define USE_LTDL
|
||||
#endif
|
||||
|
||||
#ifdef USE_LTDL
|
||||
#include <ltdl.h>
|
||||
#else
|
||||
/* #undef HAVE_DLFCN_H */
|
||||
#ifdef HAVE_DLFCN_H
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* moved to end to prevent AIX compiler warnings */
|
||||
#ifndef RTLD_GLOBAL
|
||||
#define RTLD_GLOBAL 0
|
||||
#endif
|
||||
|
||||
#ifndef RTLD_NOW
|
||||
#define RTLD_NOW 0
|
||||
#endif
|
||||
|
||||
|
||||
/***** MARO DEFINITIONS *****/
|
||||
|
||||
/* this needs to come after all system include files, so we don't accidentally attempt to redefine it */
|
||||
#ifndef WEXITSTATUS
|
||||
# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
|
||||
#endif
|
||||
#ifndef WIFEXITED
|
||||
# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
101
nagios/downtime.h
Normal file
101
nagios/downtime.h
Normal file
@@ -0,0 +1,101 @@
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* DOWNTIME.H - Header file for scheduled downtime functions
|
||||
*
|
||||
* Copyright (c) 2001-2005 Ethan Galstad (egalstad@nagios.org)
|
||||
* Last Modified: 11-25-2005
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#ifndef _DOWNTIME_H
|
||||
#define _DOWNTIME_H
|
||||
|
||||
#include "config.h"
|
||||
#include "common.h"
|
||||
#include "objects.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* SCHEDULED_DOWNTIME_ENTRY structure */
|
||||
typedef struct scheduled_downtime_struct{
|
||||
int type;
|
||||
char *host_name;
|
||||
char *service_description;
|
||||
time_t entry_time;
|
||||
time_t start_time;
|
||||
time_t end_time;
|
||||
int fixed;
|
||||
unsigned long triggered_by;
|
||||
unsigned long duration;
|
||||
unsigned long downtime_id;
|
||||
char *author;
|
||||
char *comment;
|
||||
#ifdef NSCORE
|
||||
unsigned long comment_id;
|
||||
int is_in_effect;
|
||||
int start_flex_downtime;
|
||||
int incremented_pending_downtime;
|
||||
#endif
|
||||
struct scheduled_downtime_struct *next;
|
||||
}scheduled_downtime;
|
||||
|
||||
|
||||
#ifdef NSCORE
|
||||
int initialize_downtime_data(char *); /* initializes scheduled downtime data */
|
||||
int cleanup_downtime_data(char *); /* cleans up scheduled downtime data */
|
||||
|
||||
int add_new_downtime(int,char *,char *,time_t,char *,char *,time_t,time_t,int,unsigned long,unsigned long,unsigned long *);
|
||||
int add_new_host_downtime(char *,time_t,char *,char *,time_t,time_t,int,unsigned long,unsigned long,unsigned long *);
|
||||
int add_new_service_downtime(char *,char *,time_t,char *,char *,time_t,time_t,int,unsigned long,unsigned long,unsigned long *);
|
||||
|
||||
int delete_host_downtime(unsigned long);
|
||||
int delete_service_downtime(unsigned long);
|
||||
int delete_downtime(int,unsigned long);
|
||||
|
||||
int schedule_downtime(int,char *,char *,time_t,char *,char *,time_t,time_t,int,unsigned long,unsigned long,unsigned long *);
|
||||
int unschedule_downtime(int,unsigned long);
|
||||
|
||||
int register_downtime(int,unsigned long);
|
||||
int handle_scheduled_downtime(scheduled_downtime *);
|
||||
int handle_scheduled_downtime_by_id(unsigned long);
|
||||
|
||||
int check_pending_flex_host_downtime(host *);
|
||||
int check_pending_flex_service_downtime(service *);
|
||||
|
||||
int check_for_expired_downtime(void);
|
||||
#endif
|
||||
|
||||
int add_host_downtime(char *,time_t,char *,char *,time_t,time_t,int,unsigned long,unsigned long,unsigned long);
|
||||
int add_service_downtime(char *,char *,time_t,char *,char *,time_t,time_t,int,unsigned long,unsigned long,unsigned long);
|
||||
int add_downtime(int,char *,char *,time_t,char *,char *,time_t,time_t,int,unsigned long,unsigned long,unsigned long);
|
||||
|
||||
scheduled_downtime *find_downtime(int,unsigned long);
|
||||
scheduled_downtime *find_host_downtime(unsigned long);
|
||||
scheduled_downtime *find_service_downtime(unsigned long);
|
||||
|
||||
void free_downtime_data(void); /* frees memory allocated to scheduled downtime list */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
44
nagios/locations.h
Normal file
44
nagios/locations.h
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
* Nagios Locations Header File
|
||||
* Written By: Ethan Galstad (egalstad@nagios.org)
|
||||
* Last Modified: 04-30-2007
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
************************************************************************/
|
||||
|
||||
#define DEFAULT_TEMP_FILE "/usr/local/nagios/var/tempfile"
|
||||
#define DEFAULT_TEMP_PATH "/tmp"
|
||||
#define DEFAULT_CHECK_RESULT_PATH "/usr/local/nagios/var/spool/checkresults"
|
||||
#define DEFAULT_STATUS_FILE "/usr/local/nagios/var/status.dat"
|
||||
#define DEFAULT_LOG_FILE "/usr/local/nagios/var/nagios.log"
|
||||
#define DEFAULT_LOG_ARCHIVE_PATH "/usr/local/nagios/var/archives/"
|
||||
#define DEFAULT_DEBUG_FILE "/usr/local/nagios/var/nagios.debug"
|
||||
#define DEFAULT_COMMENT_FILE "/usr/local/nagios/var/comments.dat"
|
||||
#define DEFAULT_DOWNTIME_FILE "/usr/local/nagios/var/downtime.dat"
|
||||
#define DEFAULT_RETENTION_FILE "/usr/local/nagios/var/retention.dat"
|
||||
#define DEFAULT_COMMAND_FILE "/usr/local/nagios/var/rw/nagios.cmd"
|
||||
#define DEFAULT_CONFIG_FILE "/usr/local/nagios/etc/nagios.cfg"
|
||||
#define DEFAULT_PHYSICAL_HTML_PATH "/usr/local/nagios/share"
|
||||
#define DEFAULT_URL_HTML_PATH "/nagios"
|
||||
#define DEFAULT_PHYSICAL_CGIBIN_PATH "/usr/local/nagios/sbin"
|
||||
#define DEFAULT_URL_CGIBIN_PATH "/nagios/cgi-bin"
|
||||
#define DEFAULT_CGI_CONFIG_FILE "/usr/local/nagios/etc/cgi.cfg"
|
||||
#define DEFAULT_LOCK_FILE "/usr/local/nagios/var/nagios.lock"
|
||||
#define DEFAULT_OBJECT_CACHE_FILE "/usr/local/nagios/var/objects.cache"
|
||||
#define DEFAULT_PRECACHED_OBJECT_FILE "/usr/local/nagios/var/objects.precache"
|
||||
#define DEFAULT_EVENT_BROKER_FILE "/usr/local/nagios/var/broker.socket"
|
||||
#define DEFAULT_P1_FILE "/usr/local/nagios/bin/p1.pl" /**** EMBEDDED PERL ****/
|
||||
#define DEFAULT_AUTH_FILE "" /**** EMBEDDED PERL - IS THIS USED? ****/
|
||||
264
nagios/macros.h
Normal file
264
nagios/macros.h
Normal file
@@ -0,0 +1,264 @@
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
* MACROS.H - Common macro functions
|
||||
* Written By: Ethan Galstad (egalstad@nagios.org)
|
||||
* Last Modified: 10-28-2007
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
************************************************************************/
|
||||
|
||||
#ifndef _MACROS_H
|
||||
#define _MACROS_H
|
||||
|
||||
#include "config.h"
|
||||
#include "common.h"
|
||||
#include "objects.h"
|
||||
|
||||
|
||||
|
||||
/****************** LENGTH LIMITATIONS ****************/
|
||||
|
||||
#define MAX_COMMAND_ARGUMENTS 32 /* maximum number of $ARGx$ macros */
|
||||
|
||||
|
||||
/****************** MACRO DEFINITIONS *****************/
|
||||
|
||||
#define MACRO_ENV_VAR_PREFIX "NAGIOS_"
|
||||
|
||||
#define MAX_USER_MACROS 256 /* maximum number of $USERx$ macros */
|
||||
|
||||
#define MACRO_X_COUNT 153 /* size of macro_x[] array */
|
||||
|
||||
#define MACRO_HOSTNAME 0
|
||||
#define MACRO_HOSTALIAS 1
|
||||
#define MACRO_HOSTADDRESS 2
|
||||
#define MACRO_SERVICEDESC 3
|
||||
#define MACRO_SERVICESTATE 4
|
||||
#define MACRO_SERVICESTATEID 5
|
||||
#define MACRO_SERVICEATTEMPT 6
|
||||
#define MACRO_LONGDATETIME 7
|
||||
#define MACRO_SHORTDATETIME 8
|
||||
#define MACRO_DATE 9
|
||||
#define MACRO_TIME 10
|
||||
#define MACRO_TIMET 11
|
||||
#define MACRO_LASTHOSTCHECK 12
|
||||
#define MACRO_LASTSERVICECHECK 13
|
||||
#define MACRO_LASTHOSTSTATECHANGE 14
|
||||
#define MACRO_LASTSERVICESTATECHANGE 15
|
||||
#define MACRO_HOSTOUTPUT 16
|
||||
#define MACRO_SERVICEOUTPUT 17
|
||||
#define MACRO_HOSTPERFDATA 18
|
||||
#define MACRO_SERVICEPERFDATA 19
|
||||
#define MACRO_CONTACTNAME 20
|
||||
#define MACRO_CONTACTALIAS 21
|
||||
#define MACRO_CONTACTEMAIL 22
|
||||
#define MACRO_CONTACTPAGER 23
|
||||
#define MACRO_ADMINEMAIL 24
|
||||
#define MACRO_ADMINPAGER 25
|
||||
#define MACRO_HOSTSTATE 26
|
||||
#define MACRO_HOSTSTATEID 27
|
||||
#define MACRO_HOSTATTEMPT 28
|
||||
#define MACRO_NOTIFICATIONTYPE 29
|
||||
#define MACRO_NOTIFICATIONNUMBER 30 /* deprecated - see HOSTNOTIFICATIONNUMBER and SERVICENOTIFICATIONNUMBER macros */
|
||||
#define MACRO_HOSTEXECUTIONTIME 31
|
||||
#define MACRO_SERVICEEXECUTIONTIME 32
|
||||
#define MACRO_HOSTLATENCY 33
|
||||
#define MACRO_SERVICELATENCY 34
|
||||
#define MACRO_HOSTDURATION 35
|
||||
#define MACRO_SERVICEDURATION 36
|
||||
#define MACRO_HOSTDURATIONSEC 37
|
||||
#define MACRO_SERVICEDURATIONSEC 38
|
||||
#define MACRO_HOSTDOWNTIME 39
|
||||
#define MACRO_SERVICEDOWNTIME 40
|
||||
#define MACRO_HOSTSTATETYPE 41
|
||||
#define MACRO_SERVICESTATETYPE 42
|
||||
#define MACRO_HOSTPERCENTCHANGE 43
|
||||
#define MACRO_SERVICEPERCENTCHANGE 44
|
||||
#define MACRO_HOSTGROUPNAME 45
|
||||
#define MACRO_HOSTGROUPALIAS 46
|
||||
#define MACRO_SERVICEGROUPNAME 47
|
||||
#define MACRO_SERVICEGROUPALIAS 48
|
||||
#define MACRO_HOSTACKAUTHOR 49
|
||||
#define MACRO_HOSTACKCOMMENT 50
|
||||
#define MACRO_SERVICEACKAUTHOR 51
|
||||
#define MACRO_SERVICEACKCOMMENT 52
|
||||
#define MACRO_LASTSERVICEOK 53
|
||||
#define MACRO_LASTSERVICEWARNING 54
|
||||
#define MACRO_LASTSERVICEUNKNOWN 55
|
||||
#define MACRO_LASTSERVICECRITICAL 56
|
||||
#define MACRO_LASTHOSTUP 57
|
||||
#define MACRO_LASTHOSTDOWN 58
|
||||
#define MACRO_LASTHOSTUNREACHABLE 59
|
||||
#define MACRO_SERVICECHECKCOMMAND 60
|
||||
#define MACRO_HOSTCHECKCOMMAND 61
|
||||
#define MACRO_MAINCONFIGFILE 62
|
||||
#define MACRO_STATUSDATAFILE 63
|
||||
#define MACRO_HOSTDISPLAYNAME 64
|
||||
#define MACRO_SERVICEDISPLAYNAME 65
|
||||
#define MACRO_RETENTIONDATAFILE 66
|
||||
#define MACRO_OBJECTCACHEFILE 67
|
||||
#define MACRO_TEMPFILE 68
|
||||
#define MACRO_LOGFILE 69
|
||||
#define MACRO_RESOURCEFILE 70
|
||||
#define MACRO_COMMANDFILE 71
|
||||
#define MACRO_HOSTPERFDATAFILE 72
|
||||
#define MACRO_SERVICEPERFDATAFILE 73
|
||||
#define MACRO_HOSTACTIONURL 74
|
||||
#define MACRO_HOSTNOTESURL 75
|
||||
#define MACRO_HOSTNOTES 76
|
||||
#define MACRO_SERVICEACTIONURL 77
|
||||
#define MACRO_SERVICENOTESURL 78
|
||||
#define MACRO_SERVICENOTES 79
|
||||
#define MACRO_TOTALHOSTSUP 80
|
||||
#define MACRO_TOTALHOSTSDOWN 81
|
||||
#define MACRO_TOTALHOSTSUNREACHABLE 82
|
||||
#define MACRO_TOTALHOSTSDOWNUNHANDLED 83
|
||||
#define MACRO_TOTALHOSTSUNREACHABLEUNHANDLED 84
|
||||
#define MACRO_TOTALHOSTPROBLEMS 85
|
||||
#define MACRO_TOTALHOSTPROBLEMSUNHANDLED 86
|
||||
#define MACRO_TOTALSERVICESOK 87
|
||||
#define MACRO_TOTALSERVICESWARNING 88
|
||||
#define MACRO_TOTALSERVICESCRITICAL 89
|
||||
#define MACRO_TOTALSERVICESUNKNOWN 90
|
||||
#define MACRO_TOTALSERVICESWARNINGUNHANDLED 91
|
||||
#define MACRO_TOTALSERVICESCRITICALUNHANDLED 92
|
||||
#define MACRO_TOTALSERVICESUNKNOWNUNHANDLED 93
|
||||
#define MACRO_TOTALSERVICEPROBLEMS 94
|
||||
#define MACRO_TOTALSERVICEPROBLEMSUNHANDLED 95
|
||||
#define MACRO_PROCESSSTARTTIME 96
|
||||
#define MACRO_HOSTCHECKTYPE 97
|
||||
#define MACRO_SERVICECHECKTYPE 98
|
||||
#define MACRO_LONGHOSTOUTPUT 99
|
||||
#define MACRO_LONGSERVICEOUTPUT 100
|
||||
#define MACRO_TEMPPATH 101
|
||||
#define MACRO_HOSTNOTIFICATIONNUMBER 102
|
||||
#define MACRO_SERVICENOTIFICATIONNUMBER 103
|
||||
#define MACRO_HOSTNOTIFICATIONID 104
|
||||
#define MACRO_SERVICENOTIFICATIONID 105
|
||||
#define MACRO_HOSTEVENTID 106
|
||||
#define MACRO_LASTHOSTEVENTID 107
|
||||
#define MACRO_SERVICEEVENTID 108
|
||||
#define MACRO_LASTSERVICEEVENTID 109
|
||||
#define MACRO_HOSTGROUPNAMES 110
|
||||
#define MACRO_SERVICEGROUPNAMES 111
|
||||
#define MACRO_HOSTACKAUTHORNAME 112
|
||||
#define MACRO_HOSTACKAUTHORALIAS 113
|
||||
#define MACRO_SERVICEACKAUTHORNAME 114
|
||||
#define MACRO_SERVICEACKAUTHORALIAS 115
|
||||
#define MACRO_MAXHOSTATTEMPTS 116
|
||||
#define MACRO_MAXSERVICEATTEMPTS 117
|
||||
#define MACRO_SERVICEISVOLATILE 118
|
||||
#define MACRO_TOTALHOSTSERVICES 119
|
||||
#define MACRO_TOTALHOSTSERVICESOK 120
|
||||
#define MACRO_TOTALHOSTSERVICESWARNING 121
|
||||
#define MACRO_TOTALHOSTSERVICESUNKNOWN 122
|
||||
#define MACRO_TOTALHOSTSERVICESCRITICAL 123
|
||||
#define MACRO_HOSTGROUPNOTES 124
|
||||
#define MACRO_HOSTGROUPNOTESURL 125
|
||||
#define MACRO_HOSTGROUPACTIONURL 126
|
||||
#define MACRO_SERVICEGROUPNOTES 127
|
||||
#define MACRO_SERVICEGROUPNOTESURL 128
|
||||
#define MACRO_SERVICEGROUPACTIONURL 129
|
||||
#define MACRO_HOSTGROUPMEMBERS 130
|
||||
#define MACRO_SERVICEGROUPMEMBERS 131
|
||||
#define MACRO_CONTACTGROUPNAME 132
|
||||
#define MACRO_CONTACTGROUPALIAS 133
|
||||
#define MACRO_CONTACTGROUPMEMBERS 134
|
||||
#define MACRO_CONTACTGROUPNAMES 135
|
||||
#define MACRO_NOTIFICATIONRECIPIENTS 136
|
||||
#define MACRO_NOTIFICATIONISESCALATED 137
|
||||
#define MACRO_NOTIFICATIONAUTHOR 138
|
||||
#define MACRO_NOTIFICATIONAUTHORNAME 139
|
||||
#define MACRO_NOTIFICATIONAUTHORALIAS 140
|
||||
#define MACRO_NOTIFICATIONCOMMENT 141
|
||||
#define MACRO_EVENTSTARTTIME 142
|
||||
#define MACRO_HOSTPROBLEMID 143
|
||||
#define MACRO_LASTHOSTPROBLEMID 144
|
||||
#define MACRO_SERVICEPROBLEMID 145
|
||||
#define MACRO_LASTSERVICEPROBLEMID 146
|
||||
#define MACRO_ISVALIDTIME 147
|
||||
#define MACRO_NEXTVALIDTIME 148
|
||||
#define MACRO_LASTHOSTSTATE 149
|
||||
#define MACRO_LASTHOSTSTATEID 150
|
||||
#define MACRO_LASTSERVICESTATE 151
|
||||
#define MACRO_LASTSERVICESTATEID 152
|
||||
|
||||
|
||||
|
||||
/************* MACRO CLEANING OPTIONS *****************/
|
||||
|
||||
#define STRIP_ILLEGAL_MACRO_CHARS 1
|
||||
#define ESCAPE_MACRO_CHARS 2
|
||||
#define URL_ENCODE_MACRO_CHARS 4
|
||||
|
||||
|
||||
|
||||
/****************** MACRO FUNCTIONS ******************/
|
||||
|
||||
int process_macros(char *,char **,int); /* replace macros with their actual values */
|
||||
char *clean_macro_chars(char *,int); /* cleans macros characters before insertion into output string */
|
||||
|
||||
int grab_service_macros(service *); /* updates the service macro data */
|
||||
int grab_host_macros(host *); /* updates the host macro data */
|
||||
int grab_servicegroup_macros(servicegroup *); /* updates servicegroup macros */
|
||||
int grab_hostgroup_macros(hostgroup *); /* updates hostgroup macros */
|
||||
int grab_contact_macros(contact *); /* updates the contact macro data */
|
||||
int grab_contactgroup_macros(contactgroup *); /* updates contactgroup macros */
|
||||
int grab_datetime_macros(void); /* updates date/time macros */
|
||||
int grab_on_demand_macro(char *); /* fetches an on-demand macro */
|
||||
|
||||
char *get_url_encoded_string(char *); /* URL encode a string */
|
||||
|
||||
int init_macros(void);
|
||||
int init_macrox_names(void);
|
||||
int add_macrox_name(int,char *);
|
||||
int free_macrox_names(void);
|
||||
|
||||
int clear_argv_macros(void);
|
||||
int clear_volatile_macros(void);
|
||||
int clear_host_macros(void);
|
||||
int clear_service_macros(void);
|
||||
int clear_hostgroup_macros(void);
|
||||
int clear_servicegroup_macros(void);
|
||||
int clear_contact_macros(void);
|
||||
int clear_contactgroup_macros(void);
|
||||
int clear_summary_macros(void);
|
||||
|
||||
int grab_macro_value(char *,char **,int *,int *);
|
||||
int grab_macrox_value(int,char *,char *,char **,int *);
|
||||
int grab_custom_macro_value(char *,char *,char *,char **);
|
||||
int grab_datetime_macro(int,char *,char *,char **);
|
||||
int grab_standard_host_macro(int,host *,char **,int *);
|
||||
int grab_standard_hostgroup_macro(int,hostgroup *,char **);
|
||||
int grab_standard_service_macro(int,service *,char **,int *);
|
||||
int grab_standard_servicegroup_macro(int,servicegroup *,char **);
|
||||
int grab_standard_contact_macro(int,contact *,char **);
|
||||
int grab_contact_address_macro(int,contact *,char **);
|
||||
int grab_standard_contactgroup_macro(int,contactgroup *,char **);
|
||||
int grab_custom_object_macro(char *,customvariablesmember *,char **);
|
||||
|
||||
|
||||
#ifdef NSCORE
|
||||
int set_all_macro_environment_vars(int);
|
||||
int set_macrox_environment_vars(int);
|
||||
int set_argv_macro_environment_vars(int);
|
||||
int set_custom_macro_environment_vars(int);
|
||||
int set_contact_address_environment_vars(int);
|
||||
int set_macro_environment_var(char *,char *,int);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
822
nagios/nagios.h
Normal file
822
nagios/nagios.h
Normal file
@@ -0,0 +1,822 @@
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
* Nagios Main Header File
|
||||
* Written By: Ethan Galstad (egalstad@nagios.org)
|
||||
* Last Modified: 12-14-2008
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
************************************************************************/
|
||||
|
||||
#ifndef _NAGIOS_H
|
||||
#define _NAGIOS_H
|
||||
|
||||
#ifndef __GNUC__
|
||||
# define __attribute__(x) /* nothing */
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
#include "common.h"
|
||||
#include "locations.h"
|
||||
#include "objects.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/************* MISC LENGTH/SIZE DEFINITIONS ***********/
|
||||
|
||||
/*
|
||||
NOTE: Plugin length is artificially capped at 8k to prevent runaway plugins from returning MBs/GBs of data
|
||||
back to Nagios. If you increase the 8k cap by modifying this value, make sure you also increase the value
|
||||
of MAX_EXTERNAL_COMMAND_LENGTH in common.h to allow for passive checks results received through the external
|
||||
command file. EG 10/19/07
|
||||
*/
|
||||
#define MAX_PLUGIN_OUTPUT_LENGTH 8192 /* max length of plugin output (including perf data) */
|
||||
|
||||
|
||||
|
||||
/******************* DEFAULT VALUES *******************/
|
||||
|
||||
#define DEFAULT_LOG_LEVEL 1 /* log all events to main log file */
|
||||
#define DEFAULT_USE_SYSLOG 1 /* log events to syslog? 1=yes, 0=no */
|
||||
#define DEFAULT_SYSLOG_LEVEL 2 /* log only severe events to syslog */
|
||||
|
||||
#define DEFAULT_NOTIFICATION_LOGGING 1 /* log notification events? 1=yes, 0=no */
|
||||
|
||||
#define DEFAULT_INTER_CHECK_DELAY 5.0 /* seconds between initial service check scheduling */
|
||||
#define DEFAULT_INTERLEAVE_FACTOR 1 /* default interleave to use when scheduling checks */
|
||||
#define DEFAULT_SLEEP_TIME 0.5 /* seconds between event run checks */
|
||||
#define DEFAULT_INTERVAL_LENGTH 60 /* seconds per interval unit for check scheduling */
|
||||
#define DEFAULT_RETRY_INTERVAL 30 /* services are retried in 30 seconds if they're not OK */
|
||||
#define DEFAULT_COMMAND_CHECK_INTERVAL -1 /* interval to check for external commands (default = as often as possible) */
|
||||
#define DEFAULT_CHECK_REAPER_INTERVAL 10 /* interval in seconds to reap host and service check results */
|
||||
#define DEFAULT_MAX_REAPER_TIME 30 /* maximum number of seconds to spend reaping service checks before we break out for a while */
|
||||
#define DEFAULT_MAX_CHECK_RESULT_AGE 3600 /* maximum number of seconds that a check result file is considered to be valid */
|
||||
#define DEFAULT_MAX_PARALLEL_SERVICE_CHECKS 0 /* maximum number of service checks we can have running at any given time (0=unlimited) */
|
||||
#define DEFAULT_RETENTION_UPDATE_INTERVAL 60 /* minutes between auto-save of retention data */
|
||||
#define DEFAULT_RETENTION_SCHEDULING_HORIZON 900 /* max seconds between program restarts that we will preserve scheduling information */
|
||||
#define DEFAULT_STATUS_UPDATE_INTERVAL 60 /* seconds between aggregated status data updates */
|
||||
#define DEFAULT_FRESHNESS_CHECK_INTERVAL 60 /* seconds between service result freshness checks */
|
||||
#define DEFAULT_AUTO_RESCHEDULING_INTERVAL 30 /* seconds between host and service check rescheduling events */
|
||||
#define DEFAULT_AUTO_RESCHEDULING_WINDOW 180 /* window of time (in seconds) for which we should reschedule host and service checks */
|
||||
#define DEFAULT_ORPHAN_CHECK_INTERVAL 60 /* seconds between checks for orphaned hosts and services */
|
||||
|
||||
#define DEFAULT_NOTIFICATION_TIMEOUT 30 /* max time in seconds to wait for notification commands to complete */
|
||||
#define DEFAULT_EVENT_HANDLER_TIMEOUT 30 /* max time in seconds to wait for event handler commands to complete */
|
||||
#define DEFAULT_HOST_CHECK_TIMEOUT 30 /* max time in seconds to wait for host check commands to complete */
|
||||
#define DEFAULT_SERVICE_CHECK_TIMEOUT 60 /* max time in seconds to wait for service check commands to complete */
|
||||
#define DEFAULT_OCSP_TIMEOUT 15 /* max time in seconds to wait for obsessive compulsive processing commands to complete */
|
||||
#define DEFAULT_OCHP_TIMEOUT 15 /* max time in seconds to wait for obsessive compulsive processing commands to complete */
|
||||
#define DEFAULT_PERFDATA_TIMEOUT 5 /* max time in seconds to wait for performance data commands to complete */
|
||||
#define DEFAULT_TIME_CHANGE_THRESHOLD 900 /* compensate for time changes of more than 15 minutes */
|
||||
|
||||
#define DEFAULT_LOG_HOST_RETRIES 0 /* don't log host retries */
|
||||
#define DEFAULT_LOG_SERVICE_RETRIES 0 /* don't log service retries */
|
||||
#define DEFAULT_LOG_EVENT_HANDLERS 1 /* log event handlers */
|
||||
#define DEFAULT_LOG_INITIAL_STATES 0 /* don't log initial service and host states */
|
||||
#define DEFAULT_LOG_EXTERNAL_COMMANDS 1 /* log external commands */
|
||||
#define DEFAULT_LOG_PASSIVE_CHECKS 1 /* log passive service checks */
|
||||
|
||||
#define DEFAULT_DEBUG_LEVEL 0 /* don't log any debugging information */
|
||||
#define DEFAULT_DEBUG_VERBOSITY 1
|
||||
#define DEFAULT_MAX_DEBUG_FILE_SIZE 1000000 /* max size of debug log */
|
||||
|
||||
#define DEFAULT_AGGRESSIVE_HOST_CHECKING 0 /* don't use "aggressive" host checking */
|
||||
#define DEFAULT_CHECK_EXTERNAL_COMMANDS 1 /* check for external commands */
|
||||
#define DEFAULT_CHECK_ORPHANED_SERVICES 1 /* check for orphaned services */
|
||||
#define DEFAULT_CHECK_ORPHANED_HOSTS 1 /* check for orphaned hosts */
|
||||
#define DEFAULT_ENABLE_FLAP_DETECTION 0 /* don't enable flap detection */
|
||||
#define DEFAULT_PROCESS_PERFORMANCE_DATA 0 /* don't process performance data */
|
||||
#define DEFAULT_CHECK_SERVICE_FRESHNESS 1 /* check service result freshness */
|
||||
#define DEFAULT_CHECK_HOST_FRESHNESS 0 /* don't check host result freshness */
|
||||
#define DEFAULT_AUTO_RESCHEDULE_CHECKS 0 /* don't auto-reschedule host and service checks */
|
||||
#define DEFAULT_TRANSLATE_PASSIVE_HOST_CHECKS 0 /* should we translate DOWN/UNREACHABLE passive host checks? */
|
||||
#define DEFAULT_PASSIVE_HOST_CHECKS_SOFT 0 /* passive host checks are treated as HARD by default */
|
||||
|
||||
#define DEFAULT_LOW_SERVICE_FLAP_THRESHOLD 20.0 /* low threshold for detection of service flapping */
|
||||
#define DEFAULT_HIGH_SERVICE_FLAP_THRESHOLD 30.0 /* high threshold for detection of service flapping */
|
||||
#define DEFAULT_LOW_HOST_FLAP_THRESHOLD 20.0 /* low threshold for detection of host flapping */
|
||||
#define DEFAULT_HIGH_HOST_FLAP_THRESHOLD 30.0 /* high threshold for detection of host flapping */
|
||||
|
||||
#define DEFAULT_HOST_CHECK_SPREAD 30 /* max minutes to schedule all initial host checks */
|
||||
#define DEFAULT_SERVICE_CHECK_SPREAD 30 /* max minutes to schedule all initial service checks */
|
||||
|
||||
#define DEFAULT_CACHED_HOST_CHECK_HORIZON 15 /* max age in seconds that cached host checks can be used */
|
||||
#define DEFAULT_CACHED_SERVICE_CHECK_HORIZON 15 /* max age in seconds that cached service checks can be used */
|
||||
#define DEFAULT_ENABLE_PREDICTIVE_HOST_DEPENDENCY_CHECKS 1 /* should we use predictive host dependency checks? */
|
||||
#define DEFAULT_ENABLE_PREDICTIVE_SERVICE_DEPENDENCY_CHECKS 1 /* should we use predictive service dependency checks? */
|
||||
|
||||
#define DEFAULT_USE_LARGE_INSTALLATION_TWEAKS 0 /* don't use tweaks for large Nagios installations */
|
||||
|
||||
#define DEFAULT_ENABLE_EMBEDDED_PERL 0 /* enable embedded Perl interpreter (if compiled in) */
|
||||
#define DEFAULT_USE_EMBEDDED_PERL_IMPLICITLY 1 /* by default, embedded Perl is used for Perl plugins that don't explicitly disable it */
|
||||
|
||||
#define DEFAULT_ADDITIONAL_FRESHNESS_LATENCY 15 /* seconds to be added to freshness thresholds when automatically calculated by Nagios */
|
||||
|
||||
#define DEFAULT_CHECK_FOR_UPDATES 1 /* should we check for new Nagios releases? */
|
||||
#define DEFAULT_BARE_UPDATE_CHECK 0 /* report current version and new installs */
|
||||
#define MINIMUM_UPDATE_CHECK_INTERVAL 60*60*22 /* 22 hours minimum between checks - please be kind to our servers! */
|
||||
#define BASE_UPDATE_CHECK_INTERVAL 60*60*22 /* 22 hours base interval */
|
||||
#define UPDATE_CHECK_INTERVAL_WOBBLE 60*60*4 /* 4 hour wobble on top of base interval */
|
||||
#define BASE_UPDATE_CHECK_RETRY_INTERVAL 60*60*1 /* 1 hour base retry interval */
|
||||
#define UPDATE_CHECK_RETRY_INTERVAL_WOBBLE 60*60*3 /* 3 hour wobble on top of base retry interval */
|
||||
|
||||
|
||||
/******************* LOGGING TYPES ********************/
|
||||
|
||||
#define NSLOG_RUNTIME_ERROR 1
|
||||
#define NSLOG_RUNTIME_WARNING 2
|
||||
|
||||
#define NSLOG_VERIFICATION_ERROR 4
|
||||
#define NSLOG_VERIFICATION_WARNING 8
|
||||
|
||||
#define NSLOG_CONFIG_ERROR 16
|
||||
#define NSLOG_CONFIG_WARNING 32
|
||||
|
||||
#define NSLOG_PROCESS_INFO 64
|
||||
#define NSLOG_EVENT_HANDLER 128
|
||||
/*#define NSLOG_NOTIFICATION 256*/ /* NOT USED ANYMORE - CAN BE REUSED */
|
||||
#define NSLOG_EXTERNAL_COMMAND 512
|
||||
|
||||
#define NSLOG_HOST_UP 1024
|
||||
#define NSLOG_HOST_DOWN 2048
|
||||
#define NSLOG_HOST_UNREACHABLE 4096
|
||||
|
||||
#define NSLOG_SERVICE_OK 8192
|
||||
#define NSLOG_SERVICE_UNKNOWN 16384
|
||||
#define NSLOG_SERVICE_WARNING 32768
|
||||
#define NSLOG_SERVICE_CRITICAL 65536
|
||||
|
||||
#define NSLOG_PASSIVE_CHECK 131072
|
||||
|
||||
#define NSLOG_INFO_MESSAGE 262144
|
||||
|
||||
#define NSLOG_HOST_NOTIFICATION 524288
|
||||
#define NSLOG_SERVICE_NOTIFICATION 1048576
|
||||
|
||||
|
||||
/***************** DEBUGGING LEVELS *******************/
|
||||
|
||||
#define DEBUGL_ALL -1
|
||||
#define DEBUGL_NONE 0
|
||||
#define DEBUGL_FUNCTIONS 1
|
||||
#define DEBUGL_CONFIG 2
|
||||
#define DEBUGL_PROCESS 4
|
||||
#define DEBUGL_STATUSDATA 4
|
||||
#define DEBUGL_RETENTIONDATA 4
|
||||
#define DEBUGL_EVENTS 8
|
||||
#define DEBUGL_CHECKS 16
|
||||
#define DEBUGL_IPC 16
|
||||
#define DEBUGL_FLAPPING 16
|
||||
#define DEBUGL_EVENTHANDLERS 16
|
||||
#define DEBUGL_PERFDATA 16
|
||||
#define DEBUGL_NOTIFICATIONS 32
|
||||
#define DEBUGL_EVENTBROKER 64
|
||||
#define DEBUGL_EXTERNALCOMMANDS 128
|
||||
#define DEBUGL_COMMANDS 256
|
||||
#define DEBUGL_DOWNTIME 512
|
||||
#define DEBUGL_COMMENTS 1024
|
||||
#define DEBUGL_MACROS 2048
|
||||
|
||||
#define DEBUGV_BASIC 0
|
||||
#define DEBUGV_MORE 1
|
||||
#define DEBUGV_MOST 2
|
||||
|
||||
|
||||
/******************** HOST STATUS *********************/
|
||||
|
||||
#define HOST_UP 0
|
||||
#define HOST_DOWN 1
|
||||
#define HOST_UNREACHABLE 2
|
||||
|
||||
|
||||
|
||||
/******************* STATE LOGGING TYPES **************/
|
||||
|
||||
#define INITIAL_STATES 1
|
||||
#define CURRENT_STATES 2
|
||||
|
||||
|
||||
|
||||
/************ SERVICE DEPENDENCY VALUES ***************/
|
||||
|
||||
#define DEPENDENCIES_OK 0
|
||||
#define DEPENDENCIES_FAILED 1
|
||||
|
||||
|
||||
|
||||
/*********** ROUTE CHECK PROPAGATION TYPES ************/
|
||||
|
||||
#define PROPAGATE_TO_PARENT_HOSTS 1
|
||||
#define PROPAGATE_TO_CHILD_HOSTS 2
|
||||
|
||||
|
||||
|
||||
/****************** SERVICE STATES ********************/
|
||||
|
||||
#define STATE_OK 0
|
||||
#define STATE_WARNING 1
|
||||
#define STATE_CRITICAL 2
|
||||
#define STATE_UNKNOWN 3 /* changed from -1 on 02/24/2001 */
|
||||
|
||||
|
||||
|
||||
/****************** FLAPPING TYPES ********************/
|
||||
|
||||
#define HOST_FLAPPING 0
|
||||
#define SERVICE_FLAPPING 1
|
||||
|
||||
|
||||
|
||||
/**************** NOTIFICATION TYPES ******************/
|
||||
|
||||
#define HOST_NOTIFICATION 0
|
||||
#define SERVICE_NOTIFICATION 1
|
||||
|
||||
|
||||
|
||||
/************* NOTIFICATION REASON TYPES ***************/
|
||||
|
||||
#define NOTIFICATION_NORMAL 0
|
||||
#define NOTIFICATION_ACKNOWLEDGEMENT 1
|
||||
#define NOTIFICATION_FLAPPINGSTART 2
|
||||
#define NOTIFICATION_FLAPPINGSTOP 3
|
||||
#define NOTIFICATION_FLAPPINGDISABLED 4
|
||||
#define NOTIFICATION_DOWNTIMESTART 5
|
||||
#define NOTIFICATION_DOWNTIMEEND 6
|
||||
#define NOTIFICATION_DOWNTIMECANCELLED 7
|
||||
#define NOTIFICATION_CUSTOM 99
|
||||
|
||||
|
||||
|
||||
/**************** EVENT HANDLER TYPES *****************/
|
||||
|
||||
#define HOST_EVENTHANDLER 0
|
||||
#define SERVICE_EVENTHANDLER 1
|
||||
#define GLOBAL_HOST_EVENTHANDLER 2
|
||||
#define GLOBAL_SERVICE_EVENTHANDLER 3
|
||||
|
||||
|
||||
|
||||
/***************** STATE CHANGE TYPES *****************/
|
||||
|
||||
#define HOST_STATECHANGE 0
|
||||
#define SERVICE_STATECHANGE 1
|
||||
|
||||
|
||||
|
||||
/***************** OBJECT CHECK TYPES *****************/
|
||||
#define SERVICE_CHECK 0
|
||||
#define HOST_CHECK 1
|
||||
|
||||
|
||||
|
||||
/******************* EVENT TYPES **********************/
|
||||
|
||||
#define EVENT_SERVICE_CHECK 0 /* active service check */
|
||||
#define EVENT_COMMAND_CHECK 1 /* external command check */
|
||||
#define EVENT_LOG_ROTATION 2 /* log file rotation */
|
||||
#define EVENT_PROGRAM_SHUTDOWN 3 /* program shutdown */
|
||||
#define EVENT_PROGRAM_RESTART 4 /* program restart */
|
||||
#define EVENT_CHECK_REAPER 5 /* reaps results from host and service checks */
|
||||
#define EVENT_ORPHAN_CHECK 6 /* checks for orphaned hosts and services */
|
||||
#define EVENT_RETENTION_SAVE 7 /* save (dump) retention data */
|
||||
#define EVENT_STATUS_SAVE 8 /* save (dump) status data */
|
||||
#define EVENT_SCHEDULED_DOWNTIME 9 /* scheduled host or service downtime */
|
||||
#define EVENT_SFRESHNESS_CHECK 10 /* checks service result "freshness" */
|
||||
#define EVENT_EXPIRE_DOWNTIME 11 /* checks for (and removes) expired scheduled downtime */
|
||||
#define EVENT_HOST_CHECK 12 /* active host check */
|
||||
#define EVENT_HFRESHNESS_CHECK 13 /* checks host result "freshness" */
|
||||
#define EVENT_RESCHEDULE_CHECKS 14 /* adjust scheduling of host and service checks */
|
||||
#define EVENT_EXPIRE_COMMENT 15 /* removes expired comments */
|
||||
#define EVENT_CHECK_PROGRAM_UPDATE 16 /* checks for new version of Nagios */
|
||||
#define EVENT_SLEEP 98 /* asynchronous sleep event that occurs when event queues are empty */
|
||||
#define EVENT_USER_FUNCTION 99 /* USER-defined function (modules) */
|
||||
|
||||
|
||||
|
||||
/******* INTER-CHECK DELAY CALCULATION TYPES **********/
|
||||
|
||||
#define ICD_NONE 0 /* no inter-check delay */
|
||||
#define ICD_DUMB 1 /* dumb delay of 1 second */
|
||||
#define ICD_SMART 2 /* smart delay */
|
||||
#define ICD_USER 3 /* user-specified delay */
|
||||
|
||||
|
||||
|
||||
/******* INTERLEAVE FACTOR CALCULATION TYPES **********/
|
||||
|
||||
#define ILF_USER 0 /* user-specified interleave factor */
|
||||
#define ILF_SMART 1 /* smart interleave */
|
||||
|
||||
|
||||
|
||||
/************ SCHEDULED DOWNTIME TYPES ****************/
|
||||
|
||||
#define ACTIVE_DOWNTIME 0 /* active downtime - currently in effect */
|
||||
#define PENDING_DOWNTIME 1 /* pending downtime - scheduled for the future */
|
||||
|
||||
|
||||
|
||||
/****************** DATA STRUCTURES *******************/
|
||||
|
||||
/* TIMED_EVENT structure */
|
||||
typedef struct timed_event_struct{
|
||||
int event_type;
|
||||
time_t run_time;
|
||||
int recurring;
|
||||
unsigned long event_interval;
|
||||
int compensate_for_time_change;
|
||||
void *timing_func;
|
||||
void *event_data;
|
||||
void *event_args;
|
||||
int event_options;
|
||||
struct timed_event_struct *next;
|
||||
struct timed_event_struct *prev;
|
||||
}timed_event;
|
||||
|
||||
|
||||
/* NOTIFY_LIST structure */
|
||||
typedef struct notify_list_struct{
|
||||
contact *this_should_be_named_other_than_contact;
|
||||
struct notify_list_struct *next;
|
||||
}notification;
|
||||
|
||||
|
||||
/* CHECK_RESULT structure */
|
||||
typedef struct check_result_struct{
|
||||
int object_check_type; /* is this a service or a host check? */
|
||||
char *host_name; /* host name */
|
||||
char *service_description; /* service description */
|
||||
int check_type; /* was this an active or passive service check? */
|
||||
int check_options;
|
||||
int scheduled_check; /* was this a scheduled or an on-demand check? */
|
||||
int reschedule_check; /* should we reschedule the next check */
|
||||
char *output_file; /* what file is the output stored in? */
|
||||
FILE *output_file_fp;
|
||||
int output_file_fd;
|
||||
double latency;
|
||||
struct timeval start_time; /* time the service check was initiated */
|
||||
struct timeval finish_time; /* time the service check was completed */
|
||||
int early_timeout; /* did the service check timeout? */
|
||||
int exited_ok; /* did the plugin check return okay? */
|
||||
int return_code; /* plugin return code */
|
||||
char *output; /* plugin output */
|
||||
struct check_result_struct *next;
|
||||
}check_result;
|
||||
|
||||
|
||||
/* SCHED_INFO structure */
|
||||
typedef struct sched_info_struct{
|
||||
int total_services;
|
||||
int total_scheduled_services;
|
||||
int total_hosts;
|
||||
int total_scheduled_hosts;
|
||||
double average_services_per_host;
|
||||
double average_scheduled_services_per_host;
|
||||
unsigned long service_check_interval_total;
|
||||
unsigned long host_check_interval_total;
|
||||
double average_service_execution_time;
|
||||
double average_service_check_interval;
|
||||
double average_host_check_interval;
|
||||
double average_service_inter_check_delay;
|
||||
double average_host_inter_check_delay;
|
||||
double service_inter_check_delay;
|
||||
double host_inter_check_delay;
|
||||
int service_interleave_factor;
|
||||
int max_service_check_spread;
|
||||
int max_host_check_spread;
|
||||
time_t first_service_check;
|
||||
time_t last_service_check;
|
||||
time_t first_host_check;
|
||||
time_t last_host_check;
|
||||
}sched_info;
|
||||
|
||||
|
||||
/* PASSIVE_CHECK_RESULT structure */
|
||||
typedef struct passive_check_result_struct{
|
||||
int object_check_type;
|
||||
char *host_name;
|
||||
char *service_description;
|
||||
int return_code;
|
||||
char *output;
|
||||
time_t check_time;
|
||||
double latency;
|
||||
struct passive_check_result_struct *next;
|
||||
}passive_check_result;
|
||||
|
||||
|
||||
/* CIRCULAR_BUFFER structure - used by worker threads */
|
||||
typedef struct circular_buffer_struct{
|
||||
void **buffer;
|
||||
int tail;
|
||||
int head;
|
||||
int items;
|
||||
int high; /* highest number of items that has ever been stored in buffer */
|
||||
unsigned long overflow;
|
||||
pthread_mutex_t buffer_lock;
|
||||
}circular_buffer;
|
||||
|
||||
|
||||
/* MMAPFILE structure - used for reading files via mmap() */
|
||||
typedef struct mmapfile_struct{
|
||||
char *path;
|
||||
int mode;
|
||||
int fd;
|
||||
unsigned long file_size;
|
||||
unsigned long current_position;
|
||||
unsigned long current_line;
|
||||
void *mmap_buf;
|
||||
}mmapfile;
|
||||
|
||||
|
||||
/* DBUF structure - dynamic string storage */
|
||||
typedef struct dbuf_struct{
|
||||
char *buf;
|
||||
unsigned long used_size;
|
||||
unsigned long allocated_size;
|
||||
unsigned long chunk_size;
|
||||
}dbuf;
|
||||
|
||||
|
||||
#define CHECK_STATS_BUCKETS 15
|
||||
|
||||
/* used for tracking host and service check statistics */
|
||||
typedef struct check_stats_struct{
|
||||
int current_bucket;
|
||||
int bucket[CHECK_STATS_BUCKETS];
|
||||
int overflow_bucket;
|
||||
int minute_stats[3];
|
||||
time_t last_update;
|
||||
}check_stats;
|
||||
|
||||
|
||||
/******************* THREAD STUFF ********************/
|
||||
|
||||
/* slots in circular buffers */
|
||||
#define DEFAULT_EXTERNAL_COMMAND_BUFFER_SLOTS 4096
|
||||
|
||||
/* worker threads */
|
||||
#define TOTAL_WORKER_THREADS 1
|
||||
|
||||
#define COMMAND_WORKER_THREAD 0
|
||||
|
||||
|
||||
|
||||
/******************** FUNCTIONS **********************/
|
||||
|
||||
/**** Configuration Functions ****/
|
||||
int read_main_config_file(char *); /* reads the main config file (nagios.cfg) */
|
||||
int read_resource_file(char *); /* processes macros in resource file */
|
||||
int read_all_object_data(char *); /* reads all object config data */
|
||||
|
||||
|
||||
/**** Setup Functions ****/
|
||||
int pre_flight_check(void); /* try and verify the configuration data */
|
||||
int pre_flight_object_check(int *,int *); /* verify object relationships and settings */
|
||||
int pre_flight_circular_check(int *,int *); /* detects circular dependencies and paths */
|
||||
void init_timing_loop(void); /* setup the initial scheduling queue */
|
||||
void setup_sighandler(void); /* trap signals */
|
||||
void reset_sighandler(void); /* reset signals to default action */
|
||||
int daemon_init(void); /* switches to daemon mode */
|
||||
int drop_privileges(char *,char *); /* drops privileges before startup */
|
||||
void display_scheduling_info(void); /* displays service check scheduling information */
|
||||
|
||||
|
||||
/**** Event Queue Functions ****/
|
||||
int schedule_new_event(int,int,time_t,int,unsigned long,void *,int,void *,void *,int); /* schedules a new timed event */
|
||||
void reschedule_event(timed_event *,timed_event **,timed_event **); /* reschedules an event */
|
||||
void add_event(timed_event *,timed_event **,timed_event **); /* adds an event to the execution queue */
|
||||
void remove_event(timed_event *,timed_event **,timed_event **); /* remove an event from the execution queue */
|
||||
int event_execution_loop(void); /* main monitoring/event handler loop */
|
||||
int handle_timed_event(timed_event *); /* top level handler for timed events */
|
||||
void adjust_check_scheduling(void); /* auto-adjusts scheduling of host and service checks */
|
||||
void compensate_for_system_time_change(unsigned long,unsigned long); /* attempts to compensate for a change in the system time */
|
||||
void adjust_timestamp_for_time_change(time_t,time_t,unsigned long,time_t *); /* adjusts a timestamp variable for a system time change */
|
||||
void resort_event_list(timed_event **,timed_event **); /* resorts event list by event run time for system time changes */
|
||||
|
||||
|
||||
/**** IPC Functions ****/
|
||||
int move_check_result_to_queue(char *);
|
||||
int process_check_result_queue(char *);
|
||||
int process_check_result_file(char *);
|
||||
int add_check_result_to_list(check_result *);
|
||||
check_result *read_check_result(void); /* reads a host/service check result from the list in memory */
|
||||
int delete_check_result_file(char *);
|
||||
int free_check_result_list(void);
|
||||
int init_check_result(check_result *);
|
||||
int free_check_result(check_result *); /* frees memory associated with a host/service check result */
|
||||
int parse_check_output(char *,char **,char **,char **,int,int);
|
||||
int open_command_file(void); /* creates the external command file as a named pipe (FIFO) and opens it for reading */
|
||||
int close_command_file(void); /* closes and deletes the external command file (FIFO) */
|
||||
|
||||
|
||||
/**** Monitoring/Event Handler Functions ****/
|
||||
int check_service_dependencies(service *,int); /* checks service dependencies */
|
||||
int check_host_dependencies(host *,int); /* checks host dependencies */
|
||||
void check_for_orphaned_services(void); /* checks for orphaned services */
|
||||
void check_for_orphaned_hosts(void); /* checks for orphaned hosts */
|
||||
void check_service_result_freshness(void); /* checks the "freshness" of service check results */
|
||||
int is_service_result_fresh(service *,time_t,int); /* determines if a service's check results are fresh */
|
||||
void check_host_result_freshness(void); /* checks the "freshness" of host check results */
|
||||
int is_host_result_fresh(host *,time_t,int); /* determines if a host's check results are fresh */
|
||||
int my_system(char *,int,int *,double *,char **,int); /* executes a command via popen(), but also protects against timeouts */
|
||||
|
||||
|
||||
/**** Flap Detection Functions ****/
|
||||
void check_for_service_flapping(service *,int,int); /* determines whether or not a service is "flapping" between states */
|
||||
void check_for_host_flapping(host *,int,int,int); /* determines whether or not a host is "flapping" between states */
|
||||
void set_service_flap(service *,double,double,double,int); /* handles a service that is flapping */
|
||||
void clear_service_flap(service *,double,double,double); /* handles a service that has stopped flapping */
|
||||
void set_host_flap(host *,double,double,double,int); /* handles a host that is flapping */
|
||||
void clear_host_flap(host *,double,double,double); /* handles a host that has stopped flapping */
|
||||
void enable_flap_detection_routines(void); /* enables flap detection on a program-wide basis */
|
||||
void disable_flap_detection_routines(void); /* disables flap detection on a program-wide basis */
|
||||
void enable_host_flap_detection(host *); /* enables flap detection for a particular host */
|
||||
void disable_host_flap_detection(host *); /* disables flap detection for a particular host */
|
||||
void enable_service_flap_detection(service *); /* enables flap detection for a particular service */
|
||||
void disable_service_flap_detection(service *); /* disables flap detection for a particular service */
|
||||
void handle_host_flap_detection_disabled(host *); /* handles the details when flap detection is disabled globally or on a per-host basis */
|
||||
void handle_service_flap_detection_disabled(service *); /* handles the details when flap detection is disabled globally or on a per-service basis */
|
||||
|
||||
|
||||
/**** Route/Host Check Functions ****/
|
||||
int perform_on_demand_host_check(host *,int *,int,int,unsigned long);
|
||||
int perform_scheduled_host_check(host *,int,double);
|
||||
int check_host_check_viability_3x(host *,int,int *,time_t *);
|
||||
int adjust_host_check_attempt_3x(host *,int);
|
||||
int determine_host_reachability(host *);
|
||||
int process_host_check_result_3x(host *,int,char *,int,int,int,unsigned long);
|
||||
int perform_on_demand_host_check_3x(host *,int *,int,int,unsigned long);
|
||||
int run_sync_host_check_3x(host *,int *,int,int,unsigned long);
|
||||
int execute_sync_host_check_3x(host *);
|
||||
int run_scheduled_host_check_3x(host *,int,double);
|
||||
int run_async_host_check_3x(host *,int,double,int,int,int *,time_t *);
|
||||
int handle_async_host_check_result_3x(host *,check_result *);
|
||||
|
||||
|
||||
/**** Service Check Functions ****/
|
||||
int check_service_check_viability(service *,int,int *,time_t *);
|
||||
int run_scheduled_service_check(service *,int,double);
|
||||
int run_async_service_check(service *,int,double,int,int,int *,time_t *);
|
||||
int handle_async_service_check_result(service *,check_result *);
|
||||
|
||||
|
||||
/**** Event Handler Functions ****/
|
||||
int handle_host_state(host *); /* top level host state handler */
|
||||
|
||||
|
||||
|
||||
/**** Common Check Fucntions *****/
|
||||
int reap_check_results(void);
|
||||
|
||||
|
||||
/**** Check Statistics Functions ****/
|
||||
int init_check_stats(void);
|
||||
int update_check_stats(int,time_t);
|
||||
int generate_check_stats(void);
|
||||
|
||||
|
||||
|
||||
/**** Event Handler Functions ****/
|
||||
int obsessive_compulsive_service_check_processor(service *); /* distributed monitoring craziness... */
|
||||
int obsessive_compulsive_host_check_processor(host *); /* distributed monitoring craziness... */
|
||||
int handle_service_event(service *); /* top level service event logic */
|
||||
int run_service_event_handler(service *); /* runs the event handler for a specific service */
|
||||
int run_global_service_event_handler(service *); /* runs the global service event handler */
|
||||
int handle_host_event(host *); /* top level host event logic */
|
||||
int run_host_event_handler(host *); /* runs the event handler for a specific host */
|
||||
int run_global_host_event_handler(host *); /* runs the global host event handler */
|
||||
|
||||
|
||||
/**** Notification Functions ****/
|
||||
int check_service_notification_viability(service *,int,int); /* checks viability of notifying all contacts about a service */
|
||||
int is_valid_escalation_for_service_notification(service *,serviceescalation *,int); /* checks if an escalation entry is valid for a particular service notification */
|
||||
int should_service_notification_be_escalated(service *); /* checks if a service notification should be escalated */
|
||||
int service_notification(service *,int,char *,char *,int); /* notify all contacts about a service (problem or recovery) */
|
||||
int check_contact_service_notification_viability(contact *,service *,int,int); /* checks viability of notifying a contact about a service */
|
||||
int notify_contact_of_service(contact *,service *,int,char *,char *,int,int); /* notify a single contact about a service */
|
||||
int check_host_notification_viability(host *,int,int); /* checks viability of notifying all contacts about a host */
|
||||
int is_valid_escalation_for_host_notification(host *,hostescalation *,int); /* checks if an escalation entry is valid for a particular host notification */
|
||||
int should_host_notification_be_escalated(host *); /* checks if a host notification should be escalated */
|
||||
int host_notification(host *,int,char *,char *,int); /* notify all contacts about a host (problem or recovery) */
|
||||
int check_contact_host_notification_viability(contact *,host *,int,int); /* checks viability of notifying a contact about a host */
|
||||
int notify_contact_of_host(contact *,host *,int,char *,char *,int,int); /* notify a single contact about a host */
|
||||
int create_notification_list_from_host(host *,int,int *); /* given a host, create list of contacts to be notified (remove duplicates) */
|
||||
int create_notification_list_from_service(service *,int,int *); /* given a service, create list of contacts to be notified (remove duplicates) */
|
||||
int add_notification(contact *); /* adds a notification instance */
|
||||
notification *find_notification(contact *); /* finds a notification object */
|
||||
time_t get_next_host_notification_time(host *,time_t); /* calculates nex acceptable re-notification time for a host */
|
||||
time_t get_next_service_notification_time(service *,time_t); /* calculates nex acceptable re-notification time for a service */
|
||||
|
||||
|
||||
/**** Logging Functions ****/
|
||||
void logit(int,int,const char *, ...)
|
||||
__attribute__((__format__(__printf__, 3, 4)));
|
||||
int write_to_logs_and_console(char *,unsigned long,int); /* writes a string to screen and logs */
|
||||
int write_to_console(char *); /* writes a string to screen */
|
||||
int write_to_all_logs(char *,unsigned long); /* writes a string to main log file and syslog facility */
|
||||
int write_to_all_logs_with_timestamp(char *,unsigned long,time_t *); /* writes a string to main log file and syslog facility */
|
||||
int write_to_log(char *,unsigned long,time_t *); /* write a string to the main log file */
|
||||
int write_to_syslog(char *,unsigned long); /* write a string to the syslog facility */
|
||||
int log_service_event(service *); /* logs a service event */
|
||||
int log_host_event(host *); /* logs a host event */
|
||||
int log_host_states(int,time_t *); /* logs initial/current host states */
|
||||
int log_service_states(int,time_t *); /* logs initial/current service states */
|
||||
int rotate_log_file(time_t); /* rotates the main log file */
|
||||
int write_log_file_info(time_t *); /* records log file/version info */
|
||||
int open_debug_log(void);
|
||||
int log_debug_info(int,int,const char *,...)
|
||||
__attribute__((__format__(__printf__, 3, 4)));
|
||||
int close_debug_log(void);
|
||||
|
||||
|
||||
/**** Cleanup Functions ****/
|
||||
void cleanup(void); /* cleanup after ourselves (before quitting or restarting) */
|
||||
void free_memory(void); /* free memory allocated to all linked lists in memory */
|
||||
int reset_variables(void); /* reset all global variables */
|
||||
void free_notification_list(void); /* frees all memory allocated to the notification list */
|
||||
|
||||
|
||||
/**** Hash Functions ****/
|
||||
int hashfunc(const char *name1, const char *name2, int hashslots);
|
||||
int compare_hashdata(const char *,const char *,const char *,const char *);
|
||||
|
||||
|
||||
/**** Miscellaneous Functions ****/
|
||||
void sighandler(int); /* handles signals */
|
||||
void service_check_sighandler(int); /* handles timeouts when executing service checks */
|
||||
void host_check_sighandler(int); /* handles timeouts when executing host checks */
|
||||
void my_system_sighandler(int); /* handles timeouts when executing commands via my_system() */
|
||||
void file_lock_sighandler(int); /* handles timeouts while waiting for file locks */
|
||||
void strip(char *); /* strips whitespace from string */
|
||||
char *my_strtok(char *,char *); /* my replacement for strtok() function (doesn't skip consecutive tokens) */
|
||||
char *my_strsep(char **,const char *); /* Solaris doesn't have strsep(), so I took this from the glibc source code */
|
||||
#ifdef REMOVED_10182007
|
||||
int my_free(void **); /* my wrapper for free() */
|
||||
#endif
|
||||
char *get_next_string_from_buf(char *buf, int *start_index, int bufsize);
|
||||
int compare_strings(char *,char *); /* compares two strings for equality */
|
||||
char *escape_newlines(char *);
|
||||
int contains_illegal_object_chars(char *); /* tests whether or not an object name (host, service, etc.) contains illegal characters */
|
||||
int my_rename(char *,char *); /* renames a file - works across filesystems */
|
||||
int my_fcopy(char *,char *); /* copies a file - works across filesystems */
|
||||
int get_raw_command_line(command *,char *,char **,int); /* given a raw command line, determine the actual command to run */
|
||||
int check_time_against_period(time_t,timeperiod *); /* check to see if a specific time is covered by a time period */
|
||||
int is_daterange_single_day(daterange *);
|
||||
time_t calculate_time_from_weekday_of_month(int,int,int,int); /* calculates midnight time of specific (3rd, last, etc.) weekday of a particular month */
|
||||
time_t calculate_time_from_day_of_month(int,int,int); /* calculates midnight time of specific (1st, last, etc.) day of a particular month */
|
||||
void get_next_valid_time(time_t, time_t *,timeperiod *); /* get the next valid time in a time period */
|
||||
void get_datetime_string(time_t *,char *,int,int); /* get a date/time string for use in output */
|
||||
void get_time_breakdown(unsigned long,int *,int *,int *, int *);
|
||||
time_t get_next_log_rotation_time(void); /* determine the next time to schedule a log rotation */
|
||||
int init_embedded_perl(char **); /* initialized embedded perl interpreter */
|
||||
int deinit_embedded_perl(void); /* cleans up embedded perl */
|
||||
int file_uses_embedded_perl(char *); /* tests whether or not the embedded perl interpreter should be used on a file */
|
||||
int dbuf_init(dbuf *,int);
|
||||
int dbuf_free(dbuf *);
|
||||
int dbuf_strcat(dbuf *,char *);
|
||||
int set_environment_var(char *,char *,int); /* sets/clears and environment variable */
|
||||
int check_for_nagios_updates(int,int); /* checks to see if new version of Nagios are available */
|
||||
int query_update_api(void); /* checks to see if new version of Nagios are available */
|
||||
|
||||
|
||||
/**** External Command Functions ****/
|
||||
int check_for_external_commands(void); /* checks for any external commands */
|
||||
int process_external_command1(char *); /* top-level external command processor */
|
||||
int process_external_command2(int,time_t,char *); /* process an external command */
|
||||
int process_external_commands_from_file(char *,int); /* process external commands in a file */
|
||||
int process_host_command(int,time_t,char *); /* process an external host command */
|
||||
int process_hostgroup_command(int,time_t,char *); /* process an external hostgroup command */
|
||||
int process_service_command(int,time_t,char *); /* process an external service command */
|
||||
int process_servicegroup_command(int,time_t,char *); /* process an external servicegroup command */
|
||||
int process_contact_command(int,time_t,char *); /* process an external contact command */
|
||||
int process_contactgroup_command(int,time_t,char *); /* process an external contactgroup command */
|
||||
|
||||
|
||||
/**** External Command Implementations ****/
|
||||
int cmd_add_comment(int,time_t,char *); /* add a service or host comment */
|
||||
int cmd_delete_comment(int,char *); /* delete a service or host comment */
|
||||
int cmd_delete_all_comments(int,char *); /* delete all comments associated with a host or service */
|
||||
int cmd_delay_notification(int,char *); /* delay a service or host notification */
|
||||
int cmd_schedule_service_check(int,char *,int); /* schedule an immediate or delayed service check */
|
||||
int cmd_schedule_check(int,char *); /* schedule an immediate or delayed host check */
|
||||
int cmd_schedule_host_service_checks(int,char *,int); /* schedule an immediate or delayed checks of all services on a host */
|
||||
int cmd_signal_process(int,char *); /* schedules a program shutdown or restart */
|
||||
int cmd_process_service_check_result(int,time_t,char *); /* processes a passive service check */
|
||||
int cmd_process_host_check_result(int,time_t,char *); /* processes a passive host check */
|
||||
int cmd_acknowledge_problem(int,char *); /* acknowledges a host or service problem */
|
||||
int cmd_remove_acknowledgement(int,char *); /* removes a host or service acknowledgement */
|
||||
int cmd_schedule_downtime(int,time_t,char *); /* schedules host or service downtime */
|
||||
int cmd_delete_downtime(int,char *); /* cancels active/pending host or service scheduled downtime */
|
||||
int cmd_change_object_int_var(int,char *); /* changes host/svc (int) variable */
|
||||
int cmd_change_object_char_var(int,char *); /* changes host/svc (char) variable */
|
||||
int cmd_change_object_custom_var(int,char *); /* changes host/svc custom variable */
|
||||
int cmd_process_external_commands_from_file(int,char *); /* process external commands from a file */
|
||||
|
||||
int process_passive_service_check(time_t,char *,char *,int,char *);
|
||||
int process_passive_host_check(time_t,char *,int,char *);
|
||||
|
||||
|
||||
/**** Internal Command Implementations ****/
|
||||
void disable_service_checks(service *); /* disables a service check */
|
||||
void enable_service_checks(service *); /* enables a service check */
|
||||
void schedule_service_check(service *,time_t,int); /* schedules an immediate or delayed service check */
|
||||
void schedule_host_check(host *,time_t,int); /* schedules an immediate or delayed host check */
|
||||
void enable_all_notifications(void); /* enables notifications on a program-wide basis */
|
||||
void disable_all_notifications(void); /* disables notifications on a program-wide basis */
|
||||
void enable_service_notifications(service *); /* enables service notifications */
|
||||
void disable_service_notifications(service *); /* disables service notifications */
|
||||
void enable_host_notifications(host *); /* enables host notifications */
|
||||
void disable_host_notifications(host *); /* disables host notifications */
|
||||
void enable_and_propagate_notifications(host *,int,int,int,int); /* enables notifications for all hosts and services beyond a given host */
|
||||
void disable_and_propagate_notifications(host *,int,int,int,int); /* disables notifications for all hosts and services beyond a given host */
|
||||
void schedule_and_propagate_downtime(host *,time_t,char *,char *,time_t,time_t,int,unsigned long,unsigned long); /* schedules downtime for all hosts beyond a given host */
|
||||
void acknowledge_host_problem(host *,char *,char *,int,int,int); /* acknowledges a host problem */
|
||||
void acknowledge_service_problem(service *,char *,char *,int,int,int); /* acknowledges a service problem */
|
||||
void remove_host_acknowledgement(host *); /* removes a host acknowledgement */
|
||||
void remove_service_acknowledgement(service *); /* removes a service acknowledgement */
|
||||
void start_executing_service_checks(void); /* starts executing service checks */
|
||||
void stop_executing_service_checks(void); /* stops executing service checks */
|
||||
void start_accepting_passive_service_checks(void); /* starts accepting passive service check results */
|
||||
void stop_accepting_passive_service_checks(void); /* stops accepting passive service check results */
|
||||
void enable_passive_service_checks(service *); /* enables passive service checks for a particular service */
|
||||
void disable_passive_service_checks(service *); /* disables passive service checks for a particular service */
|
||||
void start_using_event_handlers(void); /* enables event handlers on a program-wide basis */
|
||||
void stop_using_event_handlers(void); /* disables event handlers on a program-wide basis */
|
||||
void enable_service_event_handler(service *); /* enables the event handler for a particular service */
|
||||
void disable_service_event_handler(service *); /* disables the event handler for a particular service */
|
||||
void enable_host_event_handler(host *); /* enables the event handler for a particular host */
|
||||
void disable_host_event_handler(host *); /* disables the event handler for a particular host */
|
||||
void enable_host_checks(host *); /* enables checks of a particular host */
|
||||
void disable_host_checks(host *); /* disables checks of a particular host */
|
||||
void start_obsessing_over_service_checks(void); /* start obsessing about service check results */
|
||||
void stop_obsessing_over_service_checks(void); /* stop obsessing about service check results */
|
||||
void start_obsessing_over_host_checks(void); /* start obsessing about host check results */
|
||||
void stop_obsessing_over_host_checks(void); /* stop obsessing about host check results */
|
||||
void enable_service_freshness_checks(void); /* enable service freshness checks */
|
||||
void disable_service_freshness_checks(void); /* disable service freshness checks */
|
||||
void enable_host_freshness_checks(void); /* enable host freshness checks */
|
||||
void disable_host_freshness_checks(void); /* disable host freshness checks */
|
||||
void process_passive_checks(void); /* processes passive host and service check results */
|
||||
void enable_all_failure_prediction(void); /* enables failure prediction on a program-wide basis */
|
||||
void disable_all_failure_prediction(void); /* disables failure prediction on a program-wide basis */
|
||||
void enable_performance_data(void); /* enables processing of performance data on a program-wide basis */
|
||||
void disable_performance_data(void); /* disables processing of performance data on a program-wide basis */
|
||||
void start_executing_host_checks(void); /* starts executing host checks */
|
||||
void stop_executing_host_checks(void); /* stops executing host checks */
|
||||
void start_accepting_passive_host_checks(void); /* starts accepting passive host check results */
|
||||
void stop_accepting_passive_host_checks(void); /* stops accepting passive host check results */
|
||||
void enable_passive_host_checks(host *); /* enables passive host checks for a particular host */
|
||||
void disable_passive_host_checks(host *); /* disables passive host checks for a particular host */
|
||||
void start_obsessing_over_service(service *); /* start obsessing about specific service check results */
|
||||
void stop_obsessing_over_service(service *); /* stop obsessing about specific service check results */
|
||||
void start_obsessing_over_host(host *); /* start obsessing about specific host check results */
|
||||
void stop_obsessing_over_host(host *); /* stop obsessing about specific host check results */
|
||||
void set_host_notification_number(host *,int); /* sets current notification number for a specific host */
|
||||
void set_service_notification_number(service *,int); /* sets current notification number for a specific service */
|
||||
void enable_contact_host_notifications(contact *); /* enables host notifications for a specific contact */
|
||||
void disable_contact_host_notifications(contact *); /* disables host notifications for a specific contact */
|
||||
void enable_contact_service_notifications(contact *); /* enables service notifications for a specific contact */
|
||||
void disable_contact_service_notifications(contact *); /* disables service notifications for a specific contact */
|
||||
|
||||
int init_check_result_worker_thread(void);
|
||||
int shutdown_check_result_worker_thread(void);
|
||||
void * check_result_worker_thread(void *);
|
||||
void cleanup_check_result_worker_thread(void *);
|
||||
|
||||
int init_command_file_worker_thread(void);
|
||||
int shutdown_command_file_worker_thread(void);
|
||||
void * command_file_worker_thread(void *);
|
||||
void cleanup_command_file_worker_thread(void *);
|
||||
|
||||
int submit_external_command(char *,int *);
|
||||
int submit_raw_external_command(char *,time_t *,int *);
|
||||
|
||||
char *get_program_version(void);
|
||||
char *get_program_modification_date(void);
|
||||
|
||||
mmapfile *mmap_fopen(char *); /* open a file read-only via mmap() */
|
||||
int mmap_fclose(mmapfile *);
|
||||
char *mmap_fgets(mmapfile *);
|
||||
char *mmap_fgets_multiline(mmapfile *);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
89
nagios/nebcallbacks.h
Normal file
89
nagios/nebcallbacks.h
Normal file
@@ -0,0 +1,89 @@
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* NEBCALLBACKS.H - Include file for event broker modules
|
||||
*
|
||||
* Copyright (c) 2002-2007 Ethan Galstad (egalstad@nagios.org)
|
||||
* Last Modified: 01-06-2007
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _NEBCALLBACKS_H
|
||||
#define _NEBCALLBACKS_H
|
||||
|
||||
#include "config.h"
|
||||
#include "nebmodules.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/***** CALLBACK TYPES *****/
|
||||
|
||||
#define NEBCALLBACK_NUMITEMS 33 /* total number of callback types we have */
|
||||
|
||||
#define NEBCALLBACK_RESERVED0 0 /* reserved for future use */
|
||||
#define NEBCALLBACK_RESERVED1 1
|
||||
#define NEBCALLBACK_RESERVED2 2
|
||||
#define NEBCALLBACK_RESERVED3 3
|
||||
#define NEBCALLBACK_RESERVED4 4
|
||||
|
||||
#define NEBCALLBACK_RAW_DATA 5
|
||||
#define NEBCALLBACK_NEB_DATA 6
|
||||
|
||||
#define NEBCALLBACK_PROCESS_DATA 7
|
||||
#define NEBCALLBACK_TIMED_EVENT_DATA 8
|
||||
#define NEBCALLBACK_LOG_DATA 9
|
||||
#define NEBCALLBACK_SYSTEM_COMMAND_DATA 10
|
||||
#define NEBCALLBACK_EVENT_HANDLER_DATA 11
|
||||
#define NEBCALLBACK_NOTIFICATION_DATA 12
|
||||
#define NEBCALLBACK_SERVICE_CHECK_DATA 13
|
||||
#define NEBCALLBACK_HOST_CHECK_DATA 14
|
||||
#define NEBCALLBACK_COMMENT_DATA 15
|
||||
#define NEBCALLBACK_DOWNTIME_DATA 16
|
||||
#define NEBCALLBACK_FLAPPING_DATA 17
|
||||
#define NEBCALLBACK_PROGRAM_STATUS_DATA 18
|
||||
#define NEBCALLBACK_HOST_STATUS_DATA 19
|
||||
#define NEBCALLBACK_SERVICE_STATUS_DATA 20
|
||||
#define NEBCALLBACK_ADAPTIVE_PROGRAM_DATA 21
|
||||
#define NEBCALLBACK_ADAPTIVE_HOST_DATA 22
|
||||
#define NEBCALLBACK_ADAPTIVE_SERVICE_DATA 23
|
||||
#define NEBCALLBACK_EXTERNAL_COMMAND_DATA 24
|
||||
#define NEBCALLBACK_AGGREGATED_STATUS_DATA 25
|
||||
#define NEBCALLBACK_RETENTION_DATA 26
|
||||
#define NEBCALLBACK_CONTACT_NOTIFICATION_DATA 27
|
||||
#define NEBCALLBACK_CONTACT_NOTIFICATION_METHOD_DATA 28
|
||||
#define NEBCALLBACK_ACKNOWLEDGEMENT_DATA 29
|
||||
#define NEBCALLBACK_STATE_CHANGE_DATA 30
|
||||
#define NEBCALLBACK_CONTACT_STATUS_DATA 31
|
||||
#define NEBCALLBACK_ADAPTIVE_CONTACT_DATA 32
|
||||
|
||||
|
||||
/***** CALLBACK FUNCTIONS *****/
|
||||
|
||||
int neb_register_callback(int callback_type, void *mod_handle, int priority, int (*callback_func)(int,void *));
|
||||
int neb_deregister_callback(int callback_type, int (*callback_func)(int,void *));
|
||||
int neb_deregister_module_callbacks(nebmodule *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
70
nagios/neberrors.h
Normal file
70
nagios/neberrors.h
Normal file
@@ -0,0 +1,70 @@
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* NEBERRORS.H - Event broker errors
|
||||
*
|
||||
* Copyright (c) 2003-2006 Ethan Galstad (egalstad@nagios.org)
|
||||
* Last Modified: 12-12-2006
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _NEBERRORS_H
|
||||
#define _NEBERRORS_H
|
||||
|
||||
|
||||
/***** GENERIC DEFINES *****/
|
||||
|
||||
#define NEB_OK 0
|
||||
#define NEB_ERROR -1
|
||||
|
||||
#define NEB_TRUE 1
|
||||
#define NEB_FALSE 0
|
||||
|
||||
|
||||
|
||||
/***** GENERIC ERRORS *****/
|
||||
|
||||
#define NEBERROR_NOMEM 100 /* memory could not be allocated */
|
||||
|
||||
|
||||
|
||||
/***** CALLBACK ERRORS *****/
|
||||
|
||||
#define NEBERROR_NOCALLBACKFUNC 200 /* no callback function was specified */
|
||||
#define NEBERROR_NOCALLBACKLIST 201 /* callback list not initialized */
|
||||
#define NEBERROR_CALLBACKBOUNDS 202 /* callback type was out of bounds */
|
||||
#define NEBERROR_CALLBACKNOTFOUND 203 /* the callback could not be found */
|
||||
#define NEBERROR_NOMODULEHANDLE 204 /* no module handle specified */
|
||||
#define NEBERROR_BADMODULEHANDLE 205 /* bad module handle */
|
||||
#define NEBERROR_CALLBACKOVERRIDE 206 /* module wants to override default Nagios handling of event */
|
||||
#define NEBERROR_CALLBACKCANCEL 207 /* module wants to cancel callbacks to other modules */
|
||||
|
||||
|
||||
|
||||
/***** MODULE ERRORS *****/
|
||||
|
||||
#define NEBERROR_NOMODULE 300 /* no module was specified */
|
||||
|
||||
|
||||
|
||||
/***** MODULE INFO ERRORS *****/
|
||||
|
||||
#define NEBERROR_MODINFOBOUNDS 400 /* module info index was out of bounds */
|
||||
|
||||
|
||||
#endif
|
||||
71
nagios/nebmods.h
Normal file
71
nagios/nebmods.h
Normal file
@@ -0,0 +1,71 @@
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* NEBMODS.H - Include file for event broker modules
|
||||
*
|
||||
* Copyright (c) 2002-2005 Ethan Galstad (egalstad@nagios.org)
|
||||
* Last Modified: 11-25-2005
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _NEBMODS_H
|
||||
#define _NEBMODS_H
|
||||
|
||||
#include "config.h"
|
||||
#include "nebcallbacks.h"
|
||||
#include "nebmodules.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/***** MODULE STRUCTURES *****/
|
||||
|
||||
/* NEB module callback list struct */
|
||||
typedef struct nebcallback_struct{
|
||||
void *callback_func;
|
||||
void *module_handle;
|
||||
int priority;
|
||||
struct nebcallback_struct *next;
|
||||
}nebcallback;
|
||||
|
||||
|
||||
|
||||
/***** MODULE FUNCTIONS *****/
|
||||
|
||||
int neb_init_modules(void);
|
||||
int neb_deinit_modules(void);
|
||||
int neb_load_all_modules(void);
|
||||
int neb_load_module(nebmodule *);
|
||||
int neb_free_module_list(void);
|
||||
int neb_unload_all_modules(int,int);
|
||||
int neb_unload_module(nebmodule *,int,int);
|
||||
int neb_add_module(char *,char *,int);
|
||||
|
||||
|
||||
/***** CALLBACK FUNCTIONS *****/
|
||||
int neb_init_callback_list(void);
|
||||
int neb_free_callback_list(void);
|
||||
int neb_make_callbacks(int,void *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
103
nagios/nebmodules.h
Normal file
103
nagios/nebmodules.h
Normal file
@@ -0,0 +1,103 @@
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* NEBMODULES.H - Include file for event broker modules
|
||||
*
|
||||
* Copyright (c) 2002-2006 Ethan Galstad (egalstad@nagios.org)
|
||||
* Last Modified: 02-27-2006
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _NEBMODULES_H
|
||||
#define _NEBMODULES_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/***** MODULE VERSION INFORMATION *****/
|
||||
|
||||
#define NEB_API_VERSION(x) int __neb_api_version = x;
|
||||
#define CURRENT_NEB_API_VERSION 3
|
||||
|
||||
|
||||
|
||||
/***** MODULE INFORMATION *****/
|
||||
|
||||
#define NEBMODULE_MODINFO_NUMITEMS 6
|
||||
#define NEBMODULE_MODINFO_TITLE 0
|
||||
#define NEBMODULE_MODINFO_AUTHOR 1
|
||||
#define NEBMODULE_MODINFO_COPYRIGHT 2
|
||||
#define NEBMODULE_MODINFO_VERSION 3
|
||||
#define NEBMODULE_MODINFO_LICENSE 4
|
||||
#define NEBMODULE_MODINFO_DESC 5
|
||||
|
||||
|
||||
|
||||
/***** MODULE LOAD/UNLOAD OPTIONS *****/
|
||||
|
||||
#define NEBMODULE_NORMAL_LOAD 0 /* module is being loaded normally */
|
||||
#define NEBMODULE_REQUEST_UNLOAD 0 /* request module to unload (but don't force it) */
|
||||
#define NEBMODULE_FORCE_UNLOAD 1 /* force module to unload */
|
||||
|
||||
|
||||
|
||||
/***** MODULES UNLOAD REASONS *****/
|
||||
|
||||
#define NEBMODULE_NEB_SHUTDOWN 1 /* event broker is shutting down */
|
||||
#define NEBMODULE_NEB_RESTART 2 /* event broker is restarting */
|
||||
#define NEBMODULE_ERROR_NO_INIT 3 /* _module_init() function was not found in module */
|
||||
#define NEBMODULE_ERROR_BAD_INIT 4 /* _module_init() function returned a bad code */
|
||||
#define NEBMODULE_ERROR_API_VERSION 5 /* module version is incompatible with current api */
|
||||
|
||||
|
||||
|
||||
/***** MODULE STRUCTURES *****/
|
||||
|
||||
/* NEB module structure */
|
||||
typedef struct nebmodule_struct{
|
||||
char *filename;
|
||||
char *args;
|
||||
char *info[NEBMODULE_MODINFO_NUMITEMS];
|
||||
int should_be_loaded;
|
||||
int is_currently_loaded;
|
||||
#ifdef USE_LTDL
|
||||
lt_dlhandle module_handle;
|
||||
lt_ptr init_func;
|
||||
lt_ptr deinit_func;
|
||||
#else
|
||||
void *module_handle;
|
||||
void *init_func;
|
||||
void *deinit_func;
|
||||
#endif
|
||||
#ifdef HAVE_PTHREAD_H
|
||||
pthread_t thread_id;
|
||||
#endif
|
||||
struct nebmodule_struct *next;
|
||||
}nebmodule;
|
||||
|
||||
|
||||
|
||||
/***** MODULE FUNCTIONS *****/
|
||||
int neb_set_module_info(void *,int,char *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
533
nagios/nebstructs.h
Normal file
533
nagios/nebstructs.h
Normal file
@@ -0,0 +1,533 @@
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* NEBSTRUCTS.H - Event broker includes for Nagios
|
||||
*
|
||||
* Copyright (c) 2003-2007 Ethan Galstad (egalstad@nagios.org)
|
||||
* Last Modified: 10-28-2007
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _NEBSTRUCTS_H
|
||||
#define _NEBSTRUCTS_H
|
||||
|
||||
#include "config.h"
|
||||
#include "objects.h"
|
||||
#include "nagios.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/****** STRUCTURES *************************/
|
||||
|
||||
/* process data structure */
|
||||
typedef struct nebstruct_process_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
}nebstruct_process_data;
|
||||
|
||||
|
||||
/* timed event data structure */
|
||||
typedef struct nebstruct_timed_event_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
|
||||
int event_type;
|
||||
int recurring;
|
||||
time_t run_time;
|
||||
void *event_data;
|
||||
|
||||
void *event_ptr;
|
||||
}nebstruct_timed_event_data;
|
||||
|
||||
|
||||
/* log data structure */
|
||||
typedef struct nebstruct_log_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
|
||||
time_t entry_time;
|
||||
int data_type;
|
||||
char *data;
|
||||
}nebstruct_log_data;
|
||||
|
||||
|
||||
/* system command structure */
|
||||
typedef struct nebstruct_system_command_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
|
||||
struct timeval start_time;
|
||||
struct timeval end_time;
|
||||
int timeout;
|
||||
char *command_line;
|
||||
int early_timeout;
|
||||
double execution_time;
|
||||
int return_code;
|
||||
char *output;
|
||||
}nebstruct_system_command_data;
|
||||
|
||||
|
||||
/* event handler structure */
|
||||
typedef struct nebstruct_event_handler_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
|
||||
int eventhandler_type;
|
||||
char *host_name;
|
||||
char *service_description;
|
||||
int state_type;
|
||||
int state;
|
||||
int timeout;
|
||||
char *command_name;
|
||||
char *command_args;
|
||||
char *command_line;
|
||||
struct timeval start_time;
|
||||
struct timeval end_time;
|
||||
int early_timeout;
|
||||
double execution_time;
|
||||
int return_code;
|
||||
char *output;
|
||||
|
||||
void *object_ptr;
|
||||
}nebstruct_event_handler_data;
|
||||
|
||||
|
||||
/* host check structure */
|
||||
typedef struct nebstruct_host_check_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
|
||||
char *host_name;
|
||||
int current_attempt;
|
||||
int check_type;
|
||||
int max_attempts;
|
||||
int state_type;
|
||||
int state;
|
||||
int timeout;
|
||||
char *command_name;
|
||||
char *command_args;
|
||||
char *command_line;
|
||||
struct timeval start_time;
|
||||
struct timeval end_time;
|
||||
int early_timeout;
|
||||
double execution_time;
|
||||
double latency;
|
||||
int return_code;
|
||||
char *output;
|
||||
char *long_output;
|
||||
char *perf_data;
|
||||
|
||||
void *object_ptr;
|
||||
}nebstruct_host_check_data;
|
||||
|
||||
|
||||
/* service check structure */
|
||||
typedef struct nebstruct_service_check_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
|
||||
char *host_name;
|
||||
char *service_description;
|
||||
int check_type;
|
||||
int current_attempt;
|
||||
int max_attempts;
|
||||
int state_type;
|
||||
int state;
|
||||
int timeout;
|
||||
char *command_name;
|
||||
char *command_args;
|
||||
char *command_line;
|
||||
struct timeval start_time;
|
||||
struct timeval end_time;
|
||||
int early_timeout;
|
||||
double execution_time;
|
||||
double latency;
|
||||
int return_code;
|
||||
char *output;
|
||||
char *long_output;
|
||||
char *perf_data;
|
||||
|
||||
void *object_ptr;
|
||||
}nebstruct_service_check_data;
|
||||
|
||||
|
||||
/* comment data structure */
|
||||
typedef struct nebstruct_comment_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
|
||||
int comment_type;
|
||||
char *host_name;
|
||||
char *service_description;
|
||||
time_t entry_time;
|
||||
char *author_name;
|
||||
char *comment_data;
|
||||
int persistent;
|
||||
int source;
|
||||
int entry_type;
|
||||
int expires;
|
||||
time_t expire_time;
|
||||
unsigned long comment_id;
|
||||
|
||||
void *object_ptr; /* not implemented yet */
|
||||
}nebstruct_comment_data;
|
||||
|
||||
|
||||
/* downtime data structure */
|
||||
typedef struct nebstruct_downtime_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
|
||||
int downtime_type;
|
||||
char *host_name;
|
||||
char *service_description;
|
||||
time_t entry_time;
|
||||
char *author_name;
|
||||
char *comment_data;
|
||||
time_t start_time;
|
||||
time_t end_time;
|
||||
int fixed;
|
||||
unsigned long duration;
|
||||
unsigned long triggered_by;
|
||||
unsigned long downtime_id;
|
||||
|
||||
void *object_ptr; /* not implemented yet */
|
||||
}nebstruct_downtime_data;
|
||||
|
||||
|
||||
/* flapping data structure */
|
||||
typedef struct nebstruct_flapping_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
|
||||
int flapping_type;
|
||||
char *host_name;
|
||||
char *service_description;
|
||||
double percent_change;
|
||||
double high_threshold;
|
||||
double low_threshold;
|
||||
unsigned long comment_id;
|
||||
|
||||
void *object_ptr;
|
||||
}nebstruct_flapping_data;
|
||||
|
||||
|
||||
/* program status structure */
|
||||
typedef struct nebstruct_program_status_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
|
||||
time_t program_start;
|
||||
int pid;
|
||||
int daemon_mode;
|
||||
time_t last_command_check;
|
||||
time_t last_log_rotation;
|
||||
int notifications_enabled;
|
||||
int active_service_checks_enabled;
|
||||
int passive_service_checks_enabled;
|
||||
int active_host_checks_enabled;
|
||||
int passive_host_checks_enabled;
|
||||
int event_handlers_enabled;
|
||||
int flap_detection_enabled;
|
||||
int failure_prediction_enabled;
|
||||
int process_performance_data;
|
||||
int obsess_over_hosts;
|
||||
int obsess_over_services;
|
||||
unsigned long modified_host_attributes;
|
||||
unsigned long modified_service_attributes;
|
||||
char *global_host_event_handler;
|
||||
char *global_service_event_handler;
|
||||
}nebstruct_program_status_data;
|
||||
|
||||
|
||||
/* host status structure */
|
||||
typedef struct nebstruct_host_status_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
|
||||
void *object_ptr;
|
||||
}nebstruct_host_status_data;
|
||||
|
||||
|
||||
/* service status structure */
|
||||
typedef struct nebstruct_service_status_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
|
||||
void *object_ptr;
|
||||
}nebstruct_service_status_data;
|
||||
|
||||
|
||||
/* contact status structure */
|
||||
typedef struct nebstruct_contact_status_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
|
||||
void *object_ptr;
|
||||
}nebstruct_contact_status_data;
|
||||
|
||||
|
||||
/* notification data structure */
|
||||
typedef struct nebstruct_notification_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
|
||||
int notification_type;
|
||||
struct timeval start_time;
|
||||
struct timeval end_time;
|
||||
char *host_name;
|
||||
char *service_description;
|
||||
int reason_type;
|
||||
int state;
|
||||
char *output;
|
||||
char *ack_author;
|
||||
char *ack_data;
|
||||
int escalated;
|
||||
int contacts_notified;
|
||||
|
||||
void *object_ptr;
|
||||
}nebstruct_notification_data;
|
||||
|
||||
|
||||
/* contact notification data structure */
|
||||
typedef struct nebstruct_contact_notification_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
|
||||
int notification_type;
|
||||
struct timeval start_time;
|
||||
struct timeval end_time;
|
||||
char *host_name;
|
||||
char *service_description;
|
||||
char *contact_name;
|
||||
int reason_type;
|
||||
int state;
|
||||
char *output;
|
||||
char *ack_author;
|
||||
char *ack_data;
|
||||
int escalated;
|
||||
|
||||
void *object_ptr;
|
||||
void *contact_ptr;
|
||||
}nebstruct_contact_notification_data;
|
||||
|
||||
|
||||
/* contact notification method data structure */
|
||||
typedef struct nebstruct_contact_notification_method_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
|
||||
int notification_type;
|
||||
struct timeval start_time;
|
||||
struct timeval end_time;
|
||||
char *host_name;
|
||||
char *service_description;
|
||||
char *contact_name;
|
||||
char *command_name;
|
||||
char *command_args;
|
||||
int reason_type;
|
||||
int state;
|
||||
char *output;
|
||||
char *ack_author;
|
||||
char *ack_data;
|
||||
int escalated;
|
||||
|
||||
void *object_ptr;
|
||||
void *contact_ptr;
|
||||
}nebstruct_contact_notification_method_data;
|
||||
|
||||
|
||||
/* adaptive program data structure */
|
||||
typedef struct nebstruct_adaptive_program_data_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
|
||||
int command_type;
|
||||
unsigned long modified_host_attribute;
|
||||
unsigned long modified_host_attributes;
|
||||
unsigned long modified_service_attribute;
|
||||
unsigned long modified_service_attributes;
|
||||
}nebstruct_adaptive_program_data;
|
||||
|
||||
|
||||
/* adaptive host data structure */
|
||||
typedef struct nebstruct_adaptive_host_data_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
|
||||
int command_type;
|
||||
unsigned long modified_attribute;
|
||||
unsigned long modified_attributes;
|
||||
|
||||
void *object_ptr;
|
||||
}nebstruct_adaptive_host_data;
|
||||
|
||||
|
||||
/* adaptive service data structure */
|
||||
typedef struct nebstruct_adaptive_service_data_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
|
||||
int command_type;
|
||||
unsigned long modified_attribute;
|
||||
unsigned long modified_attributes;
|
||||
|
||||
void *object_ptr;
|
||||
}nebstruct_adaptive_service_data;
|
||||
|
||||
|
||||
/* adaptive contact data structure */
|
||||
typedef struct nebstruct_adaptive_contact_data_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
|
||||
int command_type;
|
||||
unsigned long modified_attribute;
|
||||
unsigned long modified_attributes;
|
||||
unsigned long modified_host_attribute;
|
||||
unsigned long modified_host_attributes;
|
||||
unsigned long modified_service_attribute;
|
||||
unsigned long modified_service_attributes;
|
||||
|
||||
void *object_ptr;
|
||||
}nebstruct_adaptive_contact_data;
|
||||
|
||||
|
||||
/* external command data structure */
|
||||
typedef struct nebstruct_external_command_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
|
||||
int command_type;
|
||||
time_t entry_time;
|
||||
char *command_string;
|
||||
char *command_args;
|
||||
}nebstruct_external_command_data;
|
||||
|
||||
|
||||
/* aggregated status data structure */
|
||||
typedef struct nebstruct_aggregated_status_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
|
||||
}nebstruct_aggregated_status_data;
|
||||
|
||||
|
||||
/* retention data structure */
|
||||
typedef struct nebstruct_retention_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
|
||||
}nebstruct_retention_data;
|
||||
|
||||
|
||||
/* acknowledgement structure */
|
||||
typedef struct nebstruct_acknowledgement_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
|
||||
int acknowledgement_type;
|
||||
char *host_name;
|
||||
char *service_description;
|
||||
int state;
|
||||
char *author_name;
|
||||
char *comment_data;
|
||||
int is_sticky;
|
||||
int persistent_comment;
|
||||
int notify_contacts;
|
||||
|
||||
void *object_ptr;
|
||||
}nebstruct_acknowledgement_data;
|
||||
|
||||
|
||||
/* state change structure */
|
||||
typedef struct nebstruct_statechange_struct{
|
||||
int type;
|
||||
int flags;
|
||||
int attr;
|
||||
struct timeval timestamp;
|
||||
|
||||
int statechange_type;
|
||||
char *host_name;
|
||||
char *service_description;
|
||||
int state;
|
||||
int state_type;
|
||||
int current_attempt;
|
||||
int max_attempts;
|
||||
char *output;
|
||||
|
||||
void *object_ptr;
|
||||
}nebstruct_statechange_data;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
771
nagios/objects.h
Normal file
771
nagios/objects.h
Normal file
@@ -0,0 +1,771 @@
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* OBJECTS.H - Header file for object addition/search functions
|
||||
*
|
||||
* Copyright (c) 1999-2007 Ethan Galstad (egalstad@nagios.org)
|
||||
* Last Modified: 11-10-2007
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#ifndef _OBJECTS_H
|
||||
#define _OBJECTS_H
|
||||
|
||||
#include "config.h"
|
||||
#include "common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*************** CURRENT OBJECT REVISION **************/
|
||||
|
||||
#define CURRENT_OBJECT_STRUCTURE_VERSION 307 /* increment when changes are made to data structures... */
|
||||
/* Nagios 3 starts at 300, Nagios 4 at 400, etc. */
|
||||
|
||||
|
||||
|
||||
/***************** OBJECT SIZE LIMITS *****************/
|
||||
|
||||
#define MAX_STATE_HISTORY_ENTRIES 21 /* max number of old states to keep track of for flap detection */
|
||||
#define MAX_CONTACT_ADDRESSES 6 /* max number of custom addresses a contact can have */
|
||||
|
||||
|
||||
|
||||
/***************** SKIP LISTS ****************/
|
||||
|
||||
#define NUM_OBJECT_SKIPLISTS 12
|
||||
|
||||
#define HOST_SKIPLIST 0
|
||||
#define SERVICE_SKIPLIST 1
|
||||
#define COMMAND_SKIPLIST 2
|
||||
#define TIMEPERIOD_SKIPLIST 3
|
||||
#define CONTACT_SKIPLIST 4
|
||||
#define CONTACTGROUP_SKIPLIST 5
|
||||
#define HOSTGROUP_SKIPLIST 6
|
||||
#define SERVICEGROUP_SKIPLIST 7
|
||||
#define HOSTDEPENDENCY_SKIPLIST 8
|
||||
#define SERVICEDEPENDENCY_SKIPLIST 9
|
||||
#define HOSTESCALATION_SKIPLIST 10
|
||||
#define SERVICEESCALATION_SKIPLIST 11
|
||||
|
||||
|
||||
/****************** DATA STRUCTURES *******************/
|
||||
|
||||
typedef struct host_struct host;
|
||||
typedef struct service_struct service;
|
||||
typedef struct contact_struct contact;
|
||||
|
||||
/* OBJECT LIST STRUCTURE */
|
||||
typedef struct objectlist_struct{
|
||||
void *object_ptr;
|
||||
struct objectlist_struct *next;
|
||||
}objectlist;
|
||||
|
||||
|
||||
/* TIMERANGE structure */
|
||||
typedef struct timerange_struct{
|
||||
unsigned long range_start;
|
||||
unsigned long range_end;
|
||||
struct timerange_struct *next;
|
||||
}timerange;
|
||||
|
||||
|
||||
/* DATERANGE structure */
|
||||
typedef struct daterange_struct{
|
||||
int type;
|
||||
int syear; /* start year */
|
||||
int smon; /* start month */
|
||||
int smday; /* start day of month (may 3rd, last day in feb) */
|
||||
int swday; /* start day of week (thursday) */
|
||||
int swday_offset; /* start weekday offset (3rd thursday, last monday in jan) */
|
||||
int eyear;
|
||||
int emon;
|
||||
int emday;
|
||||
int ewday;
|
||||
int ewday_offset;
|
||||
int skip_interval;
|
||||
timerange *times;
|
||||
struct daterange_struct *next;
|
||||
}daterange;
|
||||
|
||||
|
||||
/* TIMEPERIODEXCLUSION structure */
|
||||
typedef struct timeperiodexclusion_struct{
|
||||
char *timeperiod_name;
|
||||
struct timeperiod_struct *timeperiod_ptr;
|
||||
struct timeperiodexclusion_struct *next;
|
||||
}timeperiodexclusion;
|
||||
|
||||
|
||||
/* TIMEPERIOD structure */
|
||||
typedef struct timeperiod_struct{
|
||||
char *name;
|
||||
char *alias;
|
||||
timerange *days[7];
|
||||
daterange *exceptions[DATERANGE_TYPES];
|
||||
timeperiodexclusion *exclusions;
|
||||
struct timeperiod_struct *next;
|
||||
struct timeperiod_struct *nexthash;
|
||||
}timeperiod;
|
||||
|
||||
|
||||
/* CONTACTSMEMBER structure */
|
||||
typedef struct contactsmember_struct{
|
||||
char *contact_name;
|
||||
#ifdef NSCORE
|
||||
contact *contact_ptr;
|
||||
#endif
|
||||
struct contactsmember_struct *next;
|
||||
}contactsmember;
|
||||
|
||||
|
||||
/* CONTACTGROUP structure */
|
||||
typedef struct contactgroup_struct{
|
||||
char *group_name;
|
||||
char *alias;
|
||||
contactsmember *members;
|
||||
struct contactgroup_struct *next;
|
||||
struct contactgroup_struct *nexthash;
|
||||
}contactgroup;
|
||||
|
||||
|
||||
/* CONTACTGROUPSMEMBER structure */
|
||||
typedef struct contactgroupsmember_struct{
|
||||
char *group_name;
|
||||
#ifdef NSCORE
|
||||
contactgroup *group_ptr;
|
||||
#endif
|
||||
struct contactgroupsmember_struct *next;
|
||||
}contactgroupsmember;
|
||||
|
||||
|
||||
/* CUSTOMVARIABLESMEMBER structure */
|
||||
typedef struct customvariablesmember_struct{
|
||||
char *variable_name;
|
||||
char *variable_value;
|
||||
int has_been_modified;
|
||||
struct customvariablesmember_struct *next;
|
||||
}customvariablesmember;
|
||||
|
||||
|
||||
/* COMMAND structure */
|
||||
typedef struct command_struct{
|
||||
char *name;
|
||||
char *command_line;
|
||||
struct command_struct *next;
|
||||
struct command_struct *nexthash;
|
||||
}command;
|
||||
|
||||
|
||||
/* COMMANDSMEMBER structure */
|
||||
typedef struct commandsmember_struct{
|
||||
char *command_dummy;
|
||||
#ifdef NSCORE
|
||||
command *command_ptr;
|
||||
#endif
|
||||
struct commandsmember_struct *next;
|
||||
}commandsmember;
|
||||
|
||||
|
||||
/* CONTACT structure */
|
||||
struct contact_struct{
|
||||
char *name;
|
||||
char *alias;
|
||||
char *email;
|
||||
char *pager;
|
||||
char *address[MAX_CONTACT_ADDRESSES];
|
||||
commandsmember *host_notification_commands;
|
||||
commandsmember *service_notification_commands;
|
||||
int notify_on_service_unknown;
|
||||
int notify_on_service_warning;
|
||||
int notify_on_service_critical;
|
||||
int notify_on_service_recovery;
|
||||
int notify_on_service_flapping;
|
||||
int notify_on_service_downtime;
|
||||
int notify_on_host_down;
|
||||
int notify_on_host_unreachable;
|
||||
int notify_on_host_recovery;
|
||||
int notify_on_host_flapping;
|
||||
int notify_on_host_downtime;
|
||||
char *host_notification_period;
|
||||
char *service_notification_period;
|
||||
int host_notifications_enabled;
|
||||
int service_notifications_enabled;
|
||||
int can_submit_commands;
|
||||
int retain_status_information;
|
||||
int retain_nonstatus_information;
|
||||
customvariablesmember *custom_variables;
|
||||
#ifdef NSCORE
|
||||
time_t last_host_notification;
|
||||
time_t last_service_notification;
|
||||
unsigned long modified_attributes;
|
||||
unsigned long modified_host_attributes;
|
||||
unsigned long modified_service_attributes;
|
||||
|
||||
timeperiod *host_notification_period_ptr;
|
||||
timeperiod *service_notification_period_ptr;
|
||||
objectlist *contactgroups_ptr;
|
||||
#endif
|
||||
struct contact_struct *next;
|
||||
struct contact_struct *nexthash;
|
||||
};
|
||||
|
||||
|
||||
/* SERVICESMEMBER structure */
|
||||
typedef struct servicesmember_struct{
|
||||
char *host_name;
|
||||
char *service_description;
|
||||
#ifdef NSCORE
|
||||
service *service_ptr;
|
||||
#endif
|
||||
struct servicesmember_struct *next;
|
||||
}servicesmember;
|
||||
|
||||
|
||||
/* HOSTSMEMBER structure */
|
||||
typedef struct hostsmember_struct{
|
||||
char *host_name;
|
||||
#ifdef NSCORE
|
||||
host *host_ptr;
|
||||
#endif
|
||||
struct hostsmember_struct *next;
|
||||
}hostsmember;
|
||||
|
||||
|
||||
/* HOSTGROUP structure */
|
||||
typedef struct hostgroup_struct{
|
||||
char *group_name;
|
||||
char *alias;
|
||||
hostsmember *members;
|
||||
char *notes;
|
||||
char *notes_url;
|
||||
char *action_url;
|
||||
struct hostgroup_struct *next;
|
||||
struct hostgroup_struct *nexthash;
|
||||
}hostgroup;
|
||||
|
||||
|
||||
/* HOST structure */
|
||||
struct host_struct{
|
||||
char *name;
|
||||
char *display_name;
|
||||
char *alias;
|
||||
char *address;
|
||||
hostsmember *parent_hosts;
|
||||
hostsmember *child_hosts;
|
||||
servicesmember *services;
|
||||
char *host_check_command;
|
||||
int initial_state;
|
||||
double check_interval;
|
||||
double retry_interval;
|
||||
int max_attempts;
|
||||
char *event_handler;
|
||||
contactgroupsmember *contact_groups;
|
||||
contactsmember *contacts;
|
||||
double notification_interval;
|
||||
double first_notification_delay;
|
||||
int notify_on_down;
|
||||
int notify_on_unreachable;
|
||||
int notify_on_recovery;
|
||||
int notify_on_flapping;
|
||||
int notify_on_downtime;
|
||||
char *notification_period;
|
||||
char *check_period;
|
||||
int flap_detection_enabled;
|
||||
double low_flap_threshold;
|
||||
double high_flap_threshold;
|
||||
int flap_detection_on_up;
|
||||
int flap_detection_on_down;
|
||||
int flap_detection_on_unreachable;
|
||||
int stalk_on_up;
|
||||
int stalk_on_down;
|
||||
int stalk_on_unreachable;
|
||||
int check_freshness;
|
||||
int freshness_threshold;
|
||||
int process_performance_data;
|
||||
int checks_enabled;
|
||||
int accept_passive_host_checks;
|
||||
int event_handler_enabled;
|
||||
int retain_status_information;
|
||||
int retain_nonstatus_information;
|
||||
int failure_prediction_enabled;
|
||||
char *failure_prediction_options;
|
||||
int obsess_over_host;
|
||||
char *notes;
|
||||
char *notes_url;
|
||||
char *action_url;
|
||||
char *icon_image;
|
||||
char *icon_image_alt;
|
||||
char *vrml_image;
|
||||
char *statusmap_image;
|
||||
int have_2d_coords;
|
||||
int x_2d;
|
||||
int y_2d;
|
||||
int have_3d_coords;
|
||||
double x_3d;
|
||||
double y_3d;
|
||||
double z_3d;
|
||||
int should_be_drawn;
|
||||
customvariablesmember *custom_variables;
|
||||
#ifdef NSCORE
|
||||
int problem_has_been_acknowledged;
|
||||
int acknowledgement_type;
|
||||
int check_type;
|
||||
int current_state;
|
||||
int last_state;
|
||||
int last_hard_state;
|
||||
char *plugin_output;
|
||||
char *long_plugin_output;
|
||||
char *perf_data;
|
||||
int state_type;
|
||||
int current_attempt;
|
||||
unsigned long current_event_id;
|
||||
unsigned long last_event_id;
|
||||
unsigned long current_problem_id;
|
||||
unsigned long last_problem_id;
|
||||
double latency;
|
||||
double execution_time;
|
||||
int is_executing;
|
||||
int check_options;
|
||||
int notifications_enabled;
|
||||
time_t last_host_notification;
|
||||
time_t next_host_notification;
|
||||
time_t next_check;
|
||||
int should_be_scheduled;
|
||||
time_t last_check;
|
||||
time_t last_state_change;
|
||||
time_t last_hard_state_change;
|
||||
time_t last_time_up;
|
||||
time_t last_time_down;
|
||||
time_t last_time_unreachable;
|
||||
int has_been_checked;
|
||||
int is_being_freshened;
|
||||
int notified_on_down;
|
||||
int notified_on_unreachable;
|
||||
int current_notification_number;
|
||||
int no_more_notifications;
|
||||
unsigned long current_notification_id;
|
||||
int check_flapping_recovery_notification;
|
||||
int scheduled_downtime_depth;
|
||||
int pending_flex_downtime;
|
||||
int state_history[MAX_STATE_HISTORY_ENTRIES]; /* flap detection */
|
||||
int state_history_index;
|
||||
time_t last_state_history_update;
|
||||
int is_flapping;
|
||||
unsigned long flapping_comment_id;
|
||||
double percent_state_change;
|
||||
int total_services;
|
||||
unsigned long total_service_check_interval;
|
||||
unsigned long modified_attributes;
|
||||
int circular_path_checked;
|
||||
int contains_circular_path;
|
||||
|
||||
command *event_handler_ptr;
|
||||
command *check_command_ptr;
|
||||
timeperiod *check_period_ptr;
|
||||
timeperiod *notification_period_ptr;
|
||||
objectlist *hostgroups_ptr;
|
||||
#endif
|
||||
struct host_struct *next;
|
||||
struct host_struct *nexthash;
|
||||
};
|
||||
|
||||
|
||||
/* SERVICEGROUP structure */
|
||||
typedef struct servicegroup_struct{
|
||||
char *group_name;
|
||||
char *alias;
|
||||
servicesmember *members;
|
||||
char *notes;
|
||||
char *notes_url;
|
||||
char *action_url;
|
||||
struct servicegroup_struct *next;
|
||||
struct servicegroup_struct *nexthash;
|
||||
}servicegroup;
|
||||
|
||||
|
||||
/* SERVICE structure */
|
||||
struct service_struct{
|
||||
char *host_name;
|
||||
char *description;
|
||||
char *display_name;
|
||||
char *service_check_command;
|
||||
char *event_handler;
|
||||
int initial_state;
|
||||
double check_interval;
|
||||
double retry_interval;
|
||||
int max_attempts;
|
||||
int parallelize;
|
||||
contactgroupsmember *contact_groups;
|
||||
contactsmember *contacts;
|
||||
double notification_interval;
|
||||
double first_notification_delay;
|
||||
int notify_on_unknown;
|
||||
int notify_on_warning;
|
||||
int notify_on_critical;
|
||||
int notify_on_recovery;
|
||||
int notify_on_flapping;
|
||||
int notify_on_downtime;
|
||||
int stalk_on_ok;
|
||||
int stalk_on_warning;
|
||||
int stalk_on_unknown;
|
||||
int stalk_on_critical;
|
||||
int is_volatile;
|
||||
char *notification_period;
|
||||
char *check_period;
|
||||
int flap_detection_enabled;
|
||||
double low_flap_threshold;
|
||||
double high_flap_threshold;
|
||||
int flap_detection_on_ok;
|
||||
int flap_detection_on_warning;
|
||||
int flap_detection_on_unknown;
|
||||
int flap_detection_on_critical;
|
||||
int process_performance_data;
|
||||
int check_freshness;
|
||||
int freshness_threshold;
|
||||
int accept_passive_service_checks;
|
||||
int event_handler_enabled;
|
||||
int checks_enabled;
|
||||
int retain_status_information;
|
||||
int retain_nonstatus_information;
|
||||
int notifications_enabled;
|
||||
int obsess_over_service;
|
||||
int failure_prediction_enabled;
|
||||
char *failure_prediction_options;
|
||||
char *notes;
|
||||
char *notes_url;
|
||||
char *action_url;
|
||||
char *icon_image;
|
||||
char *icon_image_alt;
|
||||
customvariablesmember *custom_variables;
|
||||
#ifdef NSCORE
|
||||
int problem_has_been_acknowledged;
|
||||
int acknowledgement_type;
|
||||
int host_problem_at_last_check;
|
||||
int check_type;
|
||||
int current_state;
|
||||
int last_state;
|
||||
int last_hard_state;
|
||||
char *plugin_output;
|
||||
char *long_plugin_output;
|
||||
char *perf_data;
|
||||
int state_type;
|
||||
time_t next_check;
|
||||
int should_be_scheduled;
|
||||
time_t last_check;
|
||||
int current_attempt;
|
||||
unsigned long current_event_id;
|
||||
unsigned long last_event_id;
|
||||
unsigned long current_problem_id;
|
||||
unsigned long last_problem_id;
|
||||
time_t last_notification;
|
||||
time_t next_notification;
|
||||
int no_more_notifications;
|
||||
int check_flapping_recovery_notification;
|
||||
time_t last_state_change;
|
||||
time_t last_hard_state_change;
|
||||
time_t last_time_ok;
|
||||
time_t last_time_warning;
|
||||
time_t last_time_unknown;
|
||||
time_t last_time_critical;
|
||||
int has_been_checked;
|
||||
int is_being_freshened;
|
||||
int notified_on_unknown;
|
||||
int notified_on_warning;
|
||||
int notified_on_critical;
|
||||
int current_notification_number;
|
||||
unsigned long current_notification_id;
|
||||
double latency;
|
||||
double execution_time;
|
||||
int is_executing;
|
||||
int check_options;
|
||||
int scheduled_downtime_depth;
|
||||
int pending_flex_downtime;
|
||||
int state_history[MAX_STATE_HISTORY_ENTRIES]; /* flap detection */
|
||||
int state_history_index;
|
||||
int is_flapping;
|
||||
unsigned long flapping_comment_id;
|
||||
double percent_state_change;
|
||||
unsigned long modified_attributes;
|
||||
|
||||
host *host_ptr;
|
||||
command *event_handler_ptr;
|
||||
char *event_handler_args;
|
||||
command *check_command_ptr;
|
||||
char *check_command_args;
|
||||
timeperiod *check_period_ptr;
|
||||
timeperiod *notification_period_ptr;
|
||||
objectlist *servicegroups_ptr;
|
||||
#endif
|
||||
struct service_struct *next;
|
||||
struct service_struct *nexthash;
|
||||
};
|
||||
|
||||
|
||||
/* SERVICE ESCALATION structure */
|
||||
typedef struct serviceescalation_struct{
|
||||
char *host_name;
|
||||
char *description;
|
||||
int first_notification;
|
||||
int last_notification;
|
||||
double notification_interval;
|
||||
char *escalation_period;
|
||||
int escalate_on_recovery;
|
||||
int escalate_on_warning;
|
||||
int escalate_on_unknown;
|
||||
int escalate_on_critical;
|
||||
contactgroupsmember *contact_groups;
|
||||
contactsmember *contacts;
|
||||
#ifdef NSCORE
|
||||
service *service_ptr;
|
||||
timeperiod *escalation_period_ptr;
|
||||
#endif
|
||||
struct serviceescalation_struct *next;
|
||||
struct serviceescalation_struct *nexthash;
|
||||
}serviceescalation;
|
||||
|
||||
|
||||
/* SERVICE DEPENDENCY structure */
|
||||
typedef struct servicedependency_struct{
|
||||
int dependency_type;
|
||||
char *dependent_host_name;
|
||||
char *dependent_service_description;
|
||||
char *host_name;
|
||||
char *service_description;
|
||||
char *dependency_period;
|
||||
int inherits_parent;
|
||||
int fail_on_ok;
|
||||
int fail_on_warning;
|
||||
int fail_on_unknown;
|
||||
int fail_on_critical;
|
||||
int fail_on_pending;
|
||||
#ifdef NSCORE
|
||||
int circular_path_checked;
|
||||
int contains_circular_path;
|
||||
|
||||
service *master_service_ptr;
|
||||
service *dependent_service_ptr;
|
||||
timeperiod *dependency_period_ptr;
|
||||
#endif
|
||||
struct servicedependency_struct *next;
|
||||
struct servicedependency_struct *nexthash;
|
||||
}servicedependency;
|
||||
|
||||
|
||||
/* HOST ESCALATION structure */
|
||||
typedef struct hostescalation_struct{
|
||||
char *host_name;
|
||||
int first_notification;
|
||||
int last_notification;
|
||||
double notification_interval;
|
||||
char *escalation_period;
|
||||
int escalate_on_recovery;
|
||||
int escalate_on_down;
|
||||
int escalate_on_unreachable;
|
||||
contactgroupsmember *contact_groups;
|
||||
contactsmember *contacts;
|
||||
#ifdef NSCORE
|
||||
host *host_ptr;
|
||||
timeperiod *escalation_period_ptr;
|
||||
#endif
|
||||
struct hostescalation_struct *next;
|
||||
struct hostescalation_struct *nexthash;
|
||||
}hostescalation;
|
||||
|
||||
|
||||
/* HOST DEPENDENCY structure */
|
||||
typedef struct hostdependency_struct{
|
||||
int dependency_type;
|
||||
char *dependent_host_name;
|
||||
char *host_name;
|
||||
char *dependency_period;
|
||||
int inherits_parent;
|
||||
int fail_on_up;
|
||||
int fail_on_down;
|
||||
int fail_on_unreachable;
|
||||
int fail_on_pending;
|
||||
#ifdef NSCORE
|
||||
int circular_path_checked;
|
||||
int contains_circular_path;
|
||||
|
||||
host *master_host_ptr;
|
||||
host *dependent_host_ptr;
|
||||
timeperiod *dependency_period_ptr;
|
||||
#endif
|
||||
struct hostdependency_struct *next;
|
||||
struct hostdependency_struct *nexthash;
|
||||
}hostdependency;
|
||||
|
||||
|
||||
|
||||
|
||||
/****************** HASH STRUCTURES ********************/
|
||||
|
||||
typedef struct host_cursor_struct{
|
||||
int host_hashchain_iterator;
|
||||
host *current_host_pointer;
|
||||
}host_cursor;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/********************* FUNCTIONS **********************/
|
||||
|
||||
/**** Top-level input functions ****/
|
||||
int read_object_config_data(char *,int,int,int); /* reads all external configuration data of specific types */
|
||||
|
||||
|
||||
/**** Object Creation Functions ****/
|
||||
contact *add_contact(char *,char *,char *,char *,char **,char *,char *,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int); /* adds a contact definition */
|
||||
commandsmember *add_service_notification_command_to_contact(contact *,char *); /* adds a service notification command to a contact definition */
|
||||
commandsmember *add_host_notification_command_to_contact(contact *,char *); /* adds a host notification command to a contact definition */
|
||||
customvariablesmember *add_custom_variable_to_contact(contact *,char *,char *); /* adds a custom variable to a service definition */
|
||||
host *add_host(char *,char *,char *,char *,char *,int,double,double,int,int,int,int,int,int,double,double,char *,int,char *,int,int,char *,int,int,double,double,int,int,int,int,int,int,int,int,char *,int,int,char *,char *,char *,char *,char *,char *,char *,int,int,int,double,double,double,int,int,int,int,int); /* adds a host definition */
|
||||
hostsmember *add_parent_host_to_host(host *,char *); /* adds a parent host to a host definition */
|
||||
hostsmember *add_child_link_to_host(host *,host *); /* adds a child host to a host definition */
|
||||
contactgroupsmember *add_contactgroup_to_host(host *,char *); /* adds a contactgroup to a host definition */
|
||||
contactsmember *add_contact_to_host(host *,char *); /* adds a contact to a host definition */
|
||||
customvariablesmember *add_custom_variable_to_host(host *,char *,char *); /* adds a custom variable to a host definition */
|
||||
timeperiod *add_timeperiod(char *,char *); /* adds a timeperiod definition */
|
||||
timeperiodexclusion *add_exclusion_to_timeperiod(timeperiod *,char *); /* adds an exclusion to a timeperiod */
|
||||
timerange *add_timerange_to_timeperiod(timeperiod *,int,unsigned long,unsigned long); /* adds a timerange to a timeperiod definition */
|
||||
daterange *add_exception_to_timeperiod(timeperiod *,int,int,int,int,int,int,int,int,int,int,int,int);
|
||||
timerange *add_timerange_to_daterange(daterange *,unsigned long,unsigned long);
|
||||
hostgroup *add_hostgroup(char *,char *,char *,char *,char *); /* adds a hostgroup definition */
|
||||
hostsmember *add_host_to_hostgroup(hostgroup *, char *); /* adds a host to a hostgroup definition */
|
||||
servicegroup *add_servicegroup(char *,char *,char *,char *,char *); /* adds a servicegroup definition */
|
||||
servicesmember *add_service_to_servicegroup(servicegroup *,char *,char *); /* adds a service to a servicegroup definition */
|
||||
contactgroup *add_contactgroup(char *,char *); /* adds a contactgroup definition */
|
||||
contactsmember *add_contact_to_contactgroup(contactgroup *,char *); /* adds a contact to a contact group definition */
|
||||
command *add_command(char *,char *); /* adds a command definition */
|
||||
service *add_service(char *,char *,char *,char *,int,int,int,int,double,double,double,double,char *,int,int,int,int,int,int,int,int,char *,int,char *,int,int,double,double,int,int,int,int,int,int,int,int,int,int,char *,int,int,char *,char *,char *,char *,char *,int,int,int); /* adds a service definition */
|
||||
contactgroupsmember *add_contactgroup_to_service(service *,char *); /* adds a contact group to a service definition */
|
||||
contactsmember *add_contact_to_service(service *,char *); /* adds a contact to a host definition */
|
||||
serviceescalation *add_serviceescalation(char *,char *,int,int,double,char *,int,int,int,int); /* adds a service escalation definition */
|
||||
contactgroupsmember *add_contactgroup_to_serviceescalation(serviceescalation *,char *); /* adds a contact group to a service escalation definition */
|
||||
contactsmember *add_contact_to_serviceescalation(serviceescalation *,char *); /* adds a contact to a service escalation definition */
|
||||
customvariablesmember *add_custom_variable_to_service(service *,char *,char *); /* adds a custom variable to a service definition */
|
||||
servicedependency *add_service_dependency(char *,char *,char *,char *,int,int,int,int,int,int,int,char *); /* adds a service dependency definition */
|
||||
hostdependency *add_host_dependency(char *,char *,int,int,int,int,int,int,char *); /* adds a host dependency definition */
|
||||
hostescalation *add_hostescalation(char *,int,int,double,char *,int,int,int); /* adds a host escalation definition */
|
||||
contactsmember *add_contact_to_hostescalation(hostescalation *,char *); /* adds a contact to a host escalation definition */
|
||||
contactgroupsmember *add_contactgroup_to_hostescalation(hostescalation *,char *); /* adds a contact group to a host escalation definition */
|
||||
|
||||
contactsmember *add_contact_to_object(contactsmember **,char *); /* adds a contact to an object */
|
||||
customvariablesmember *add_custom_variable_to_object(customvariablesmember **,char *,char *); /* adds a custom variable to an object */
|
||||
|
||||
|
||||
servicesmember *add_service_link_to_host(host *,service *);
|
||||
|
||||
|
||||
/*** Object Skiplist Functions ****/
|
||||
int init_object_skiplists(void);
|
||||
int free_object_skiplists(void);
|
||||
int skiplist_compare_text(const char *val1a, const char *val1b, const char *val2a, const char *val2b);
|
||||
int skiplist_compare_host(void *a, void *b);
|
||||
int skiplist_compare_service(void *a, void *b);
|
||||
int skiplist_compare_command(void *a, void *b);
|
||||
int skiplist_compare_timeperiod(void *a, void *b);
|
||||
int skiplist_compare_contact(void *a, void *b);
|
||||
int skiplist_compare_contactgroup(void *a, void *b);
|
||||
int skiplist_compare_hostgroup(void *a, void *b);
|
||||
int skiplist_compare_servicegroup(void *a, void *b);
|
||||
int skiplist_compare_hostescalation(void *a, void *b);
|
||||
int skiplist_compare_serviceescalation(void *a, void *b);
|
||||
int skiplist_compare_hostdependency(void *a, void *b);
|
||||
int skiplist_compare_servicedependency(void *a, void *b);
|
||||
|
||||
int get_host_count(void);
|
||||
int get_service_count(void);
|
||||
|
||||
|
||||
|
||||
/**** Object Hash Functions ****/
|
||||
int add_servicedependency_to_hashlist(servicedependency *);
|
||||
|
||||
|
||||
/**** Object Search Functions ****/
|
||||
timeperiod * find_timeperiod(char *); /* finds a timeperiod object */
|
||||
host * find_host(char *); /* finds a host object */
|
||||
hostgroup * find_hostgroup(char *); /* finds a hostgroup object */
|
||||
servicegroup * find_servicegroup(char *); /* finds a servicegroup object */
|
||||
contact * find_contact(char *); /* finds a contact object */
|
||||
contactgroup * find_contactgroup(char *); /* finds a contactgroup object */
|
||||
command * find_command(char *); /* finds a command object */
|
||||
service * find_service(char *,char *); /* finds a service object */
|
||||
|
||||
|
||||
/**** Object Traversal Functions ****/
|
||||
hostescalation *get_first_hostescalation_by_host(char *, void **);
|
||||
hostescalation *get_next_hostescalation_by_host(char *,void **);
|
||||
serviceescalation *get_first_serviceescalation_by_service(char *,char *, void **);
|
||||
serviceescalation *get_next_serviceescalation_by_service(char *,char *,void **);
|
||||
hostdependency *get_first_hostdependency_by_dependent_host(char *, void **);
|
||||
hostdependency *get_next_hostdependency_by_dependent_host(char *, void **);
|
||||
servicedependency *get_first_servicedependency_by_dependent_service(char *,char *, void **);
|
||||
servicedependency *get_next_servicedependency_by_dependent_service(char *,char *,void **);
|
||||
|
||||
#ifdef NSCORE
|
||||
int add_object_to_objectlist(objectlist **,void *);
|
||||
int free_objectlist(objectlist **);
|
||||
#endif
|
||||
|
||||
|
||||
/**** Object Query Functions ****/
|
||||
int is_host_immediate_child_of_host(host *,host *); /* checks if a host is an immediate child of another host */
|
||||
int is_host_primary_immediate_child_of_host(host *,host *); /* checks if a host is an immediate child (and primary child) of another host */
|
||||
int is_host_immediate_parent_of_host(host *,host *); /* checks if a host is an immediate child of another host */
|
||||
int is_host_member_of_hostgroup(hostgroup *,host *); /* tests whether or not a host is a member of a specific hostgroup */
|
||||
int is_host_member_of_servicegroup(servicegroup *,host *); /* tests whether or not a service is a member of a specific servicegroup */
|
||||
int is_service_member_of_servicegroup(servicegroup *,service *); /* tests whether or not a service is a member of a specific servicegroup */
|
||||
int is_contact_member_of_contactgroup(contactgroup *, contact *); /* tests whether or not a contact is a member of a specific contact group */
|
||||
int is_contact_for_hostgroup(hostgroup *,contact *); /* tests whether or not a contact is a member of a specific hostgroup */
|
||||
int is_contact_for_servicegroup(servicegroup *,contact *); /* tests whether or not a contact is a member of a specific servicegroup */
|
||||
int is_contact_for_host(host *,contact *); /* tests whether or not a contact is a contact member for a specific host */
|
||||
int is_escalated_contact_for_host(host *,contact *); /* checks whether or not a contact is an escalated contact for a specific host */
|
||||
int is_contact_for_service(service *,contact *); /* tests whether or not a contact is a contact member for a specific service */
|
||||
int is_escalated_contact_for_service(service *,contact *); /* checks whether or not a contact is an escalated contact for a specific service */
|
||||
int is_host_immediate_parent_of_host(host *,host *); /* tests whether or not a host is an immediate parent of another host */
|
||||
|
||||
int number_of_immediate_child_hosts(host *); /* counts the number of immediate child hosts for a particular host */
|
||||
int number_of_total_child_hosts(host *); /* counts the number of total child hosts for a particular host */
|
||||
int number_of_immediate_parent_hosts(host *); /* counts the number of immediate parents hosts for a particular host */
|
||||
int number_of_total_parent_hosts(host *); /* counts the number of total parents hosts for a particular host */
|
||||
|
||||
#ifdef NSCORE
|
||||
int check_for_circular_servicedependency_path(servicedependency *,servicedependency *,int); /* checks if a circular dependency exists for a given service */
|
||||
int check_for_circular_hostdependency_path(hostdependency *,hostdependency *,int); /* checks if a circular dependency exists for a given host */
|
||||
#endif
|
||||
|
||||
|
||||
/**** Object Cleanup Functions ****/
|
||||
int free_object_data(void); /* frees all allocated memory for the object definitions */
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
45
nagios/perfdata.h
Normal file
45
nagios/perfdata.h
Normal file
@@ -0,0 +1,45 @@
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* PERFDATA.H - Include file for performance data routines
|
||||
*
|
||||
* Copyright (c) 2001-2005 Ethan Galstad (egalstad@nagios.org)
|
||||
* Last Modified: 11-25-2005
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _PERFDATA_H
|
||||
#define _PERFDATA_H
|
||||
|
||||
#include "objects.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int initialize_performance_data(char *); /* initializes performance data */
|
||||
int cleanup_performance_data(char *); /* cleans up performance data */
|
||||
|
||||
int update_host_performance_data(host *); /* updates host performance data */
|
||||
int update_service_performance_data(service *); /* updates service performance data */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
68
nagios/skiplist.h
Normal file
68
nagios/skiplist.h
Normal file
@@ -0,0 +1,68 @@
|
||||
|
||||
/************************************************************************
|
||||
*
|
||||
* SKIPLIST.H - Skiplist data structures and functions
|
||||
*
|
||||
* Copyright (c) 2008 Ethan Galstad
|
||||
* Last Modified: 02-24-2008
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
************************************************************************/
|
||||
|
||||
#ifndef _SKIPLIST_H
|
||||
#define _SKIPLIST_H
|
||||
|
||||
#define SKIPLIST_OK 0
|
||||
#define SKIPLIST_ERROR_ARGS 1
|
||||
#define SKIPLIST_ERROR_MEMORY 2
|
||||
#define SKIPLIST_ERROR_DUPLICATE 3
|
||||
|
||||
|
||||
typedef struct skiplistnode_struct{
|
||||
void *data;
|
||||
struct skiplistnode_struct *forward[1]; /* this must be the last element of the struct, as we allocate # of elements during runtime*/
|
||||
}skiplistnode;
|
||||
|
||||
typedef struct skiplist_struct{
|
||||
int current_level;
|
||||
int max_levels;
|
||||
float level_probability;
|
||||
unsigned long items;
|
||||
int allow_duplicates;
|
||||
int append_duplicates;
|
||||
int (*compare_function)(void *,void *);
|
||||
skiplistnode *head;
|
||||
}skiplist;
|
||||
|
||||
|
||||
skiplist *skiplist_new(int max_levels, float level_probability, int allow_duplicates, int append_duplicates, int (*compare_function)(void *,void *));
|
||||
skiplistnode *skiplist_new_node(skiplist *list,int node_levels);
|
||||
int skiplist_insert(skiplist *list, void *data);
|
||||
int skiplist_random_level(skiplist *list);
|
||||
int skiplist_empty(skiplist *list);
|
||||
int skiplist_free(skiplist **list);
|
||||
void *skiplist_peek(skiplist *);
|
||||
void *skiplist_pop(skiplist *);
|
||||
void *skiplist_get_first(skiplist *list, void **node_ptr);
|
||||
void *skiplist_get_next(void **node_ptr);
|
||||
void *skiplist_find_first(skiplist *list, void *data, void **node_ptr);
|
||||
void *skiplist_find_next(skiplist *list, void *data, void **node_ptr);
|
||||
int skiplist_delete(skiplist *list, void *data);
|
||||
int skiplist_delete_first(skiplist *list, void *data);
|
||||
int skiplist_delete_all(skiplist *list, void *data);
|
||||
int skiplist_delete_node(skiplist *list, void *node_ptr);
|
||||
|
||||
#endif
|
||||
37
nagios/sretention.h
Normal file
37
nagios/sretention.h
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* SRETENTION.H - Header for state retention routines
|
||||
*
|
||||
* Copyright (c) 1999-2006 Ethan Galstad (egalstad@nagios.org)
|
||||
* Last Modified: 02-28-2006
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int initialize_retention_data(char *);
|
||||
int cleanup_retention_data(char *);
|
||||
int save_state_information(int); /* saves all host and state information */
|
||||
int read_initial_state_information(void); /* reads in initial host and state information */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
202
nagios/statusdata.h
Normal file
202
nagios/statusdata.h
Normal file
@@ -0,0 +1,202 @@
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
* STATUSDATA.H - Header for external status data routines
|
||||
*
|
||||
* Copyright (c) 2000-2007 Ethan Galstad (egalstad@nagios.org)
|
||||
* Last Modified: 10-19-2007
|
||||
*
|
||||
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef _STATUSDATA_H
|
||||
#define _STATUSDATA_H
|
||||
|
||||
#ifdef NSCORE
|
||||
#include "objects.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef NSCGI
|
||||
|
||||
#define READ_PROGRAM_STATUS 1
|
||||
#define READ_HOST_STATUS 2
|
||||
#define READ_SERVICE_STATUS 4
|
||||
#define READ_CONTACT_STATUS 8
|
||||
|
||||
#define READ_ALL_STATUS_DATA READ_PROGRAM_STATUS | READ_HOST_STATUS | READ_SERVICE_STATUS | READ_CONTACT_STATUS
|
||||
|
||||
|
||||
|
||||
/*************************** CHAINED HASH LIMITS ***************************/
|
||||
|
||||
#define SERVICESTATUS_HASHSLOTS 1024
|
||||
#define HOSTSTATUS_HASHSLOTS 1024
|
||||
|
||||
|
||||
/**************************** DATA STRUCTURES ******************************/
|
||||
|
||||
|
||||
/* HOST STATUS structure */
|
||||
typedef struct hoststatus_struct{
|
||||
char *host_name;
|
||||
char *plugin_output;
|
||||
char *long_plugin_output;
|
||||
char *perf_data;
|
||||
int status;
|
||||
time_t last_update;
|
||||
int has_been_checked;
|
||||
int should_be_scheduled;
|
||||
int current_attempt;
|
||||
int max_attempts;
|
||||
time_t last_check;
|
||||
time_t next_check;
|
||||
int check_options;
|
||||
int check_type;
|
||||
time_t last_state_change;
|
||||
time_t last_hard_state_change;
|
||||
int last_hard_state;
|
||||
time_t last_time_up;
|
||||
time_t last_time_down;
|
||||
time_t last_time_unreachable;
|
||||
int state_type;
|
||||
time_t last_notification;
|
||||
time_t next_notification;
|
||||
int no_more_notifications;
|
||||
int notifications_enabled;
|
||||
int problem_has_been_acknowledged;
|
||||
int acknowledgement_type;
|
||||
int current_notification_number;
|
||||
int accept_passive_host_checks;
|
||||
int event_handler_enabled;
|
||||
int checks_enabled;
|
||||
int flap_detection_enabled;
|
||||
int is_flapping;
|
||||
double percent_state_change;
|
||||
double latency;
|
||||
double execution_time;
|
||||
int scheduled_downtime_depth;
|
||||
int failure_prediction_enabled;
|
||||
int process_performance_data;
|
||||
int obsess_over_host;
|
||||
struct hoststatus_struct *next;
|
||||
struct hoststatus_struct *nexthash;
|
||||
}hoststatus;
|
||||
|
||||
|
||||
/* SERVICE STATUS structure */
|
||||
typedef struct servicestatus_struct{
|
||||
char *host_name;
|
||||
char *description;
|
||||
char *plugin_output;
|
||||
char *long_plugin_output;
|
||||
char *perf_data;
|
||||
int max_attempts;
|
||||
int current_attempt;
|
||||
int status;
|
||||
time_t last_update;
|
||||
int has_been_checked;
|
||||
int should_be_scheduled;
|
||||
time_t last_check;
|
||||
time_t next_check;
|
||||
int check_options;
|
||||
int check_type;
|
||||
int checks_enabled;
|
||||
time_t last_state_change;
|
||||
time_t last_hard_state_change;
|
||||
int last_hard_state;
|
||||
time_t last_time_ok;
|
||||
time_t last_time_warning;
|
||||
time_t last_time_unknown;
|
||||
time_t last_time_critical;
|
||||
int state_type;
|
||||
time_t last_notification;
|
||||
time_t next_notification;
|
||||
int no_more_notifications;
|
||||
int notifications_enabled;
|
||||
int problem_has_been_acknowledged;
|
||||
int acknowledgement_type;
|
||||
int current_notification_number;
|
||||
int accept_passive_service_checks;
|
||||
int event_handler_enabled;
|
||||
int flap_detection_enabled;
|
||||
int is_flapping;
|
||||
double percent_state_change;
|
||||
double latency;
|
||||
double execution_time;
|
||||
int scheduled_downtime_depth;
|
||||
int failure_prediction_enabled;
|
||||
int process_performance_data;
|
||||
int obsess_over_service;
|
||||
struct servicestatus_struct *next;
|
||||
struct servicestatus_struct *nexthash;
|
||||
}servicestatus;
|
||||
|
||||
|
||||
/*************************** SERVICE STATES ***************************/
|
||||
|
||||
#define SERVICE_PENDING 1
|
||||
#define SERVICE_OK 2
|
||||
#define SERVICE_WARNING 4
|
||||
#define SERVICE_UNKNOWN 8
|
||||
#define SERVICE_CRITICAL 16
|
||||
|
||||
|
||||
|
||||
/**************************** HOST STATES ****************************/
|
||||
|
||||
#define HOST_PENDING 1
|
||||
#define HOST_UP 2
|
||||
#define HOST_DOWN 4
|
||||
#define HOST_UNREACHABLE 8
|
||||
|
||||
|
||||
|
||||
/**************************** FUNCTIONS ******************************/
|
||||
|
||||
int read_status_data(char *,int); /* reads all status data */
|
||||
int add_host_status(hoststatus *); /* adds a host status entry to the list in memory */
|
||||
int add_service_status(servicestatus *); /* adds a service status entry to the list in memory */
|
||||
|
||||
int add_hoststatus_to_hashlist(hoststatus *);
|
||||
int add_servicestatus_to_hashlist(servicestatus *);
|
||||
|
||||
servicestatus *find_servicestatus(char *,char *); /* finds status information for a specific service */
|
||||
hoststatus *find_hoststatus(char *); /* finds status information for a specific host */
|
||||
int get_servicestatus_count(char *,int); /* gets total number of services of a certain type for a specific host */
|
||||
|
||||
void free_status_data(void); /* free all memory allocated to status data */
|
||||
#endif
|
||||
|
||||
#ifdef NSCORE
|
||||
int initialize_status_data(char *); /* initializes status data at program start */
|
||||
int update_all_status_data(void); /* updates all status data */
|
||||
int cleanup_status_data(char *,int); /* cleans up status data at program termination */
|
||||
int update_program_status(int); /* updates program status data */
|
||||
int update_host_status(host *,int); /* updates host status data */
|
||||
int update_service_status(service *,int); /* updates service status data */
|
||||
int update_contact_status(contact *,int); /* updates contact status data */
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user