[Nagios-devel] Comment IDs
Posted: Tue Jun 03, 2008 8:57 am
------=_Part_1547_33533767.1212511604085
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Hi,
I saw that Nagios version 3.0.x try to reuse the IDs from deleted comments to insert new ones. This is a little messing because in the CGIs the comments appears in an incorrect order(from the date point of view) allowing old comments to appears before newest(Specifically in migrations from 2.x to 3.x, or when a comment has been deleted).
Maybe the correct form to solve this is adjusting CGI to order comments by date, I dont known. Anyway I did a change in xrddefault_read_state_information() to get the highest id when loading retention info(see attachment) and put this value in next_comment_id var.
With this logic store next_comment_id when saving retention data has become an unnecessary job(may be removed).
Can this solution impact in any other part of Nagios that actually I can't see?
best regards.
-rm
------=_Part_1547_33533767.1212511604085
Content-Type: text/x-patch; name=patch.diff
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=patch.diff
--- ../nagios/xdata/xrddefault.c 2008-02-23 18:12:11.000000000 -0300
+++ ../nagios-PATCHED/xdata/xrddefault.c 2008-06-03 11:12:42.000000000 -0300
@@ -903,8 +903,12 @@
else if(persistent==FALSE)
remove_comment=TRUE;
- if(remove_comment==TRUE)
+ if(remove_comment==TRUE) {
delete_comment((data_type==XRDDEFAULT_HOSTCOMMENT_DATA)?HOST_COMMENT:SERVICE_COMMENT,comment_id);
+ } else {
+ if (next_comment_id < comment_id)
+ next_comment_id = comment_id;
+ }
/* free temp memory */
my_free(host_name);
------=_Part_1547_33533767.1212511604085--
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Hi,
I saw that Nagios version 3.0.x try to reuse the IDs from deleted comments to insert new ones. This is a little messing because in the CGIs the comments appears in an incorrect order(from the date point of view) allowing old comments to appears before newest(Specifically in migrations from 2.x to 3.x, or when a comment has been deleted).
Maybe the correct form to solve this is adjusting CGI to order comments by date, I dont known. Anyway I did a change in xrddefault_read_state_information() to get the highest id when loading retention info(see attachment) and put this value in next_comment_id var.
With this logic store next_comment_id when saving retention data has become an unnecessary job(may be removed).
Can this solution impact in any other part of Nagios that actually I can't see?
best regards.
-rm
------=_Part_1547_33533767.1212511604085
Content-Type: text/x-patch; name=patch.diff
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=patch.diff
--- ../nagios/xdata/xrddefault.c 2008-02-23 18:12:11.000000000 -0300
+++ ../nagios-PATCHED/xdata/xrddefault.c 2008-06-03 11:12:42.000000000 -0300
@@ -903,8 +903,12 @@
else if(persistent==FALSE)
remove_comment=TRUE;
- if(remove_comment==TRUE)
+ if(remove_comment==TRUE) {
delete_comment((data_type==XRDDEFAULT_HOSTCOMMENT_DATA)?HOST_COMMENT:SERVICE_COMMENT,comment_id);
+ } else {
+ if (next_comment_id < comment_id)
+ next_comment_id = comment_id;
+ }
/* free temp memory */
my_free(host_name);
------=_Part_1547_33533767.1212511604085--
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]