nagios4/include/comments.h

119 lines
5.0 KiB
C
Raw Permalink Normal View History

2017-05-19 22:22:40 +02:00
/*****************************************************************************
*
* COMMENTS.H - Header file for comment functions
*
*
* 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.
*
*****************************************************************************/
2017-05-19 23:37:19 +02:00
#ifndef NAGIOS_COMMENTS_H_INCLUDED
#define NAGIOS_COMMENTS_H_INCLUDED
2017-05-19 22:22:40 +02:00
#include "common.h"
#include "objects.h"
/**************************** 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 ******************************/
NAGIOS_BEGIN_DECL
/* COMMENT structure */
2017-05-19 23:37:19 +02:00
typedef struct nagios_comment {
2017-05-19 22:22:40 +02:00
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;
2017-05-19 23:37:19 +02:00
struct nagios_comment *next;
struct nagios_comment *nexthash;
} nagios_comment;
2017-05-19 22:22:40 +02:00
2017-05-19 23:37:19 +02:00
extern struct nagios_comment *comment_list;
2017-05-19 22:22:40 +02:00
2017-05-19 23:37:19 +02:00
#ifndef NSCGI
int initialize_comment_data(void); /* initializes comment data */
2017-05-19 22:22:40 +02:00
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 */
2017-05-19 23:37:19 +02:00
int delete_host_acknowledgement_comments(struct host *); /* deletes all non-persistent ack comments for a specific host */
2017-05-19 22:22:40 +02:00
int delete_all_service_comments(char *, char *); /* deletes all comments for a specific service */
2017-05-19 23:37:19 +02:00
int delete_service_acknowledgement_comments(struct service *); /* deletes all non-persistent ack comments for a specific service */
2017-05-19 22:22:40 +02:00
int check_for_expired_comment(unsigned long); /* expires a comment */
#endif
2017-05-19 23:37:19 +02:00
struct nagios_comment *find_comment(unsigned long, int); /* finds a specific comment */
struct nagios_comment *find_service_comment(unsigned long); /* finds a specific service comment */
struct nagios_comment *find_host_comment(unsigned long); /* finds a specific host comment */
2017-05-19 22:22:40 +02:00
2017-05-19 23:37:19 +02:00
struct nagios_comment *get_first_comment_by_host(char *);
struct nagios_comment *get_next_comment_by_host(char *, struct nagios_comment *);
2017-05-19 22:22:40 +02:00
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 sort_comments(void);
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 */
2017-05-19 23:37:19 +02:00
int add_comment_to_hashlist(struct nagios_comment *);
2017-05-19 22:22:40 +02:00
void free_comment_data(void); /* frees memory allocated to the comment list */
2019-04-18 17:09:18 +02:00
NAGIOS_END_DECL
2017-05-19 22:22:40 +02:00
#endif