Update of /cvsroot/nagios/nagios/common
In directory sc8-pr-cvs1:/tmp/cvs-serv6804/common
Modified Files:
comments.c
Log Message:
Event broker work
Index: comments.c
===================================================================
RCS file: /cvsroot/nagios/nagios/common/comments.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** comments.c 10 Apr 2003 03:46:01 -0000 1.5
--- comments.c 10 Jun 2003 04:31:23 -0000 1.6
***************
*** 4,8 ****
*
* Copyright (c) 1999-2003 Ethan Galstad (nagios@...)
! * Last Modified: 04-09-2003
*
* License:
--- 4,8 ----
*
* Copyright (c) 1999-2003 Ethan Galstad (nagios@...)
! * Last Modified: 06-09-2003
*
* License:
***************
*** 40,43 ****
--- 40,44 ----
#ifdef NSCORE
#include "../base/nagios.h"
+ #include "../base/broker.h"
#endif
***************
*** 113,123 ****
int add_new_host_comment(char *host_name, time_t entry_time, char *author_name, char *comment_data, int persistent, int source, unsigned long *comment_id){
int result;
/**** IMPLEMENTATION-SPECIFIC CALLS ****/
#ifdef USE_XCDDEFAULT
! result=xcddefault_add_new_host_comment(host_name,entry_time,author_name,comment_data,persistent,source,comment_id);
#endif
#ifdef USE_XCDDB
! result=xcddb_add_new_host_comment(host_name,entry_time,author_name,comment_data,persistent,source,comment_id);
#endif
--- 114,134 ----
int add_new_host_comment(char *host_name, time_t entry_time, char *author_name, char *comment_data, int persistent, int source, unsigned long *comment_id){
int result;
+ unsigned long new_comment_id;
/**** IMPLEMENTATION-SPECIFIC CALLS ****/
#ifdef USE_XCDDEFAULT
! result=xcddefault_add_new_host_comment(host_name,entry_time,author_name,comment_data,persistent,source,&new_comment_id);
#endif
#ifdef USE_XCDDB
! result=xcddb_add_new_host_comment(host_name,entry_time,author_name,comment_data,persistent,source,&new_comment_id);
! #endif
!
! /* save comment id */
! if(comment_id!=NULL)
! *comment_id=new_comment_id;
!
! #ifdef USE_EVENT_BROKER
! /* send data to event broker */
! broker_comment_data(NEBTYPE_COMMENT_ADD,NEBFLAG_NONE,NEBATTR_HOST_COMMENT,host_name,NULL,entry_time,author_name,comment_data,persistent,source,new_comment_id,NULL);
#endif
***************
*** 129,139 ****
int add_new_service_comment(char *host_name, char *svc_description, time_t entry_time, char *author_name, char *comment_data, int persistent, int source, unsigned long *comment_id){
int result;
/**** IMPLEMENTATION-SPECIFIC CALLS ****/
#ifdef USE_XCDDEFAULT
! result=xcddefault_add_new_service_comment(host_name,svc_description,entry_time,author_name,comment_data,persistent,source,comment_id);
#endif
#ifdef USE_XCDDB
! result=xcddb_add_new_service_comment(host_name,svc_description,entry_time,author_name,comment_data,persistent,source,comment_id);
#endif
--- 140,160 ----
int add_new_service_comment(char *host_name, char *svc_description, time_t entry_time, char *author_name, char *comment_data, int persistent, int source, unsigned long *comment_id){
int result;
+ unsigned long new_comment_id;
/**** IMPLEMENTATION-SPECIFIC CALLS ****/
#ifdef USE_XCDDEFAULT
! result=xcddefault_add_new_service_comment(host_name,svc_description,entry_time,author_name,comment_data,persistent,source,&new_comment_id);
#endif
#ifdef USE_XCDDB
! result=xcddb_add_new_service_comment(host_name,svc_description,entry_time,author_name,comment_data,persistent,source,&new_comment_id);
! #endif
!
! /* save comment id */
! if(comment_id!=NULL)
! *comment_id=new_comment_id;
!
! #ifdef USE_EVENT_BROKER
! /* send data to event broker */
! broker_comment_data(NEBTYPE_COMMENT_ADD,NEBFLAG_NONE,NEBATTR_SERVICE_COMMENT,host_name,svc_description,entry_time,author_name,comment_data,persistent,source,new_comment_id,NULL);
#endif
***************
*** 169,172 ****
--- 190,198 ----
if(this_comment!=NULL){
+ #ifdef USE_EVENT_BROKER
+ /* send data to event broker */
+ broker_comment_data(NEBTYPE_COMMENT_DELETE,NEBFLAG_NONE,(type==HOST_COMMENT)?NEBATTR_HOST_COMMENT:NEBATTR_SERVICE_COMMENT,this_comment->host_name,this_comment->service_description,this_comment->entry_time,this_comment->author,this_comment->comment_data,this_comment->persistent,this_comment->source,comment_id,NULL);
+ #endif
+
if(comment_list==this_comment)
comment_list=this_comment->next;
***************
*** 439,442 ****
--- 465,475 ----
last_comment->next=new_comment;
}
+
+ #ifdef NSCORE
+ #ifdef USE_EVENT_BROKER
+ /* send data to event broker */
+ broker_comment_data(NEBTYPE_COMMENT_LOAD,NEBFLAG_NONE,(comment_type==HOST_COMMENT)?NEBATTR_HOST_COMMENT:NEBATTR_SERVICE_COMMENT,host_name,svc_description,entry_time,author,comment_data,persistent,source,comment_id,NULL);
+ #endif
+ #endif
return OK;
|