[Nagios-devel] Case-insensitive objects in NDOutils

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] Case-insensitive objects in NDOutils

Post by Guest »


--Apple-Mail-56-849817016
Content-Type: text/plain;
charset=US-ASCII;
format=flowed;
delsp=yes
Content-Transfer-Encoding: 7bit

Hi Hendrik,

Quick note. I saw this change below and wondered if this is best done
in the database. For Opsview, we made this change about 2 years ago
for the same effect:

ALTER TABLE nagios_objects MODIFY name1 varchar(128) COLLATE
latin1_bin NOT NULL default '';
ALTER TABLE nagios_objects MODIFY name2 varchar(128) COLLATE
latin1_bin default NULL;

The code then stayed the same. Also it means anything trying to read
the data doesn't need to remember to specify BINARY either.

I agree it is bad to consider them as the same object.

I thought I had blogged about it, but maybe it was a permanent draft ...

Ton


Begin forwarded message:

> From: Hendrik Baecker
> Date: 21 October 2009 20:18:39 BST
> To: [email protected]
> Subject: [Nagios-checkins] ndoutils/src dbhandlers.c,1.13,1.14
>
> Update of /cvsroot/nagios/ndoutils/src
> In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv411/src
>
> Modified Files:
> dbhandlers.c
> Log Message:
> Fix case insensitive behavior in ndo2db
>
> NDO2DB now handles renamed objects like Nagios itself. Renaming is
> deleting
> the old and creating a new object.
>
> Why change this and possibly loose historical data based on the same
> database
> object id?
> Think about the following:
> Nagios knows a "localhost" and a "LOCALHOST" two different objects.
> NDOUtils (without this patch) would handle both objects as the same
> including all references like services, state changes and so on.
>
> NDOUtils would mix two different objects together - this can't be
> right.
>
>
>
> Index: dbhandlers.c
> ===================================================================
> RCS file: /cvsroot/nagios/ndoutils/src/dbhandlers.c,v
> retrieving revision 1.13
> retrieving revision 1.14
> diff -C2 -d -r1.13 -r1.14
> *** dbhandlers.c 6 Oct 2009 06:34:52 -0000 1.13
> --- dbhandlers.c 21 Oct 2009 19:18:37 -0000 1.14
> ***************
> *** 82,86 ****
> else{
> es[0]=ndo2db_db_escape_string(idi,name1);
> ! if(asprintf(&buf1,"name1='%s'",es[0])==-1)
> buf1=NULL;
> }
> --- 82,86 ----
> else{
> es[0]=ndo2db_db_escape_string(idi,name1);
> ! if(asprintf(&buf1,"BINARY name1='%s'",es[0])==-1)
> buf1=NULL;
> }
> ***************
> *** 93,97 ****
> else{
> es[1]=ndo2db_db_escape_string(idi,name2);
> ! if(asprintf(&buf2,"name2='%s'",es[1])==-1)
> buf2=NULL;
> }
> --- 93,97 ----
> else{
> es[1]=ndo2db_db_escape_string(idi,name2);
> ! if(asprintf(&buf2,"BINARY name2='%s'",es[1])==-1)
> buf2=NULL;
> }
>
>
> ------------------------------------------------------------------------------
> Come build with us! The BlackBerry(R) Developer Conference in SF, CA
> is the only developer event you need to attend this year. Jumpstart
> your
> developing skills, take BlackBerry mobile applications to market and
> stay
> ahead of the curve. Join us from November 9 - 12, 2009. Register now!
> http://p.sf.net/sfu/devconference
> _______________________________________________
> Nagios-checkins mailing list
> [email protected]
> https://lists.sourceforge.net/lists/lis ... s-checkins

Ton Voon
Product Architect




Opsera Limited | Unit 69 Suttons Business Park
Reading | Berkshire | RG6 1AZ | UK

Phone: +44 (0) 845 057 7887
Mobile: +44 (0) 7931 365796
Skype: tonvoon Email: [email protected]
www.opsera.com
This e-mail is confidential, intended only for the named recipient(s)
above and may contain information that is privileged and confidential.
If you receive this message in error, or are not the named
recipient(s), please notify the sender at the phone number above, do
not copy this message, do not disclose its contents to anyone, and
delete this e-mail message from your computer. Although Opsera
routinely screens for viruses, addressees should scan this e-mail and
any attachments for viruses. Opsera makes no representation or
warranty a

...[email truncated]...


This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked