Skip to content
This repository has been archived by the owner on Jan 15, 2019. It is now read-only.

[dev.icinga.com #252] Invalid object_id for custom variables in IDO #110

Closed
icinga-migration opened this issue Jan 12, 2010 · 2 comments
Closed

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/252

Created by cdoebler on 2010-01-12 13:34:36 +00:00

Assignee: mfriedrich
Status: Resolved (closed on 2010-02-10 18:09:17 +00:00)
Target Version: 1.0.1
Last Update: 2010-02-10 18:09:17 +00:00 (in Redmine)


There are assigned invalid object_ids to custom variables.
Tested w/ host and service using icinga 1.0-stable and MySQL for IDO.

Config:

define host{
        use                     linux-server
        host_name               localhost
        alias                   localhost
        address                 127.0.0.1
        _host_custom_var        host_cv_value1
        }

define service{
        use                             local-service
        host_name                       localhost
        service_description             PING
        check_command                   check_ping!100.0,20%!500.0,60%
        _service_custom_var             service_cv_value1
        }

DB-output:

mysql> select * from icinga_customvariables;
+-------------------+-------------+------------+-------------+-------------------+--------------------+--------------------+
| customvariable_id | instance_id | object_id  | config_type | has_been_modified | varname            | varvalue           |
+-------------------+-------------+------------+-------------+-------------------+--------------------+--------------------+
|                 4 |           1 | 2147483647 |           1 |                 0 | HOST_CUSTOM_VAR    | host_cv_value1     |
|                 5 |           1 | 2147483647 |           1 |                 0 | SERVICE_CUSTOM_VAR | service_cv_value1 |
+-------------------+-------------+------------+-------------+-------------------+--------------------+--------------------+
2 rows in set (0,00 sec)

Regards,

Christian

Changesets

2010-02-08 20:09:15 +00:00 by mfriedrich c9985f5

fix oracle rewrites for other rdbms, add several fixes/features

* add database name in connection msg to syslog
* fix comment commentdata/downtimedata copypaste failures
* fix object insert rewrite for mysql/pgsql
* fix customvariablestatus timestamp

fixes #252,#272
@icinga-migration
Copy link
Author

Updated by mfriedrich on 2010-02-08 19:56:17 +00:00

  • Category set to Event Broker
  • Assigned to set to mfriedrich
  • Target Version set to 1.0.1

hmmm i defined one of my own, but i cannot reproduce the error

(1 server (timeserver), 2 services (testkisten))

mysql

mysql> select * from icinga_customvariables;
+-------------------+-------------+-----------+-------------+-------------------+-------------+------------+
| customvariable_id | instance_id | object_id | config_type | has_been_modified | varname     | varvalue   |
+-------------------+-------------+-----------+-------------+-------------------+-------------+------------+
|                 1 |           1 |      3357 |           1 |                 0 | CUSTOM_TEST | timeserver | 
|                 2 |           1 |      3557 |           1 |                 0 | CUSTOM_TEST | testkisten | 
|                 3 |           1 |      3946 |           1 |                 0 | CUSTOM_TEST | testkisten | 
+-------------------+-------------+-----------+-------------+-------------------+-------------+------------+
3 rows in set (0.00 sec)

pgsql also does something wrong:

Feb 8 19:47:57 nagbaer ido2db: Error: database query failed for 'INSERT INTO icinga_customvariablestatus (instance_id, object_id, status_update_time, has_been_modified, varname, varvalue) VALUES (1, 13413683899112883390, FROM_UNIXTIME(1265654876), 0, 'CUSTOM_TEST', 'timeserver')' - 'ERROR: integer out of range '

this customvariables patch costs me a lot of time grrrrrrrrrrrr

o_id is always object_id, contact_id, host_id or service_id => unsigned long
the parameter handed over to the function is just o_id => int
asprintf handles that correctly, but typecasting int => void => unsigned long fails heavy.

afterall it's a coding issue which gcc will show.

will be fixed in my oracle rewrite then.

coming to the table itsself:

icinga=# select * from icinga_customvariables;
 customvariable_id | instance_id | object_id | config_type | has_been_modified |   varname   |  varvalue  
-------------------+-------------+-----------+-------------+-------------------+-------------+------------
                 1 |           1 |      7791 |           1 |                 0 | CUSTOM_TEST | timeserver
                 2 |           1 |      7991 |           1 |                 0 | CUSTOM_TEST | testkisten
                 3 |           1 |      8380 |           1 |                 0 | CUSTOM_TEST | testkisten
(3 rows)

so it looks fine.

coming to oracle:

(huh found a bug in prepared statement)

I've also added debugoutput to show what gets inserted:

[1265657937.182843] [001.2] [pid=16093] ndo2db_save_custom_variablestatus() instance_id=1, object_id=20433, ts=(SELECT unixts2date(1265657935) FROM DUAL), modified=0, varname=CUSTOM_TEST, varvalue=timeserver

output is also fine from oracle.

         6            1      21021            1                 0   CUSTOM_TEST     testkisten
         4            1      20433            1                 0   CUSTOM_TEST     timeserver
         5            1      20633            1                 0   CUSTOM_TEST     testkisten

So i assume this has been fixed recently, but was nice to test because i found some other bugs coming through my oracle rewrite.

I also wrote a generic output which database is being used - while debugging 3 rdbm to see in syslog which one is being used.

will be applied to git master when housekeeping, oracle rewrites and delete fixes are through.

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2010-02-10 18:09:17 +00:00

  • Status changed from New to Resolved
  • Done % changed from 0 to 100
  • Estimated Hours set to 2

nothing more to test, everytzhing else will be applied to git master soon.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant