Skip to content
This repository has been archived by the owner. It is now read-only.

[dev.icinga.com #1883] add processed macro strings into database (notes, notes_url, action_url, icon_image) #734

Closed
icinga-migration opened this issue Sep 9, 2011 · 19 comments

Comments

@icinga-migration
Copy link
Member

@icinga-migration icinga-migration commented Sep 9, 2011

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

Created by mfriedrich on 2011-09-09 10:29:23 +00:00

Assignee: (none)
Status: Rejected (closed on 2013-07-31 08:42:35 +00:00)
Target Version: (none)
Last Update: 2014-12-08 14:37:23 +00:00 (in Redmine)


the cgis will fetch those macros on page generation, but e.g. icinga-web from database or any other external non shared C implementation will suffer from those.

it would be great to have various string containing macros to be inserted seperately as being already processed

the cgis resolve it like that

                                if (temp_host->action_url != NULL) {
                                        process_macros_r(mac, temp_host->action_url, &processed_string, 0);

it would be interesting to add that beyong any performance decrease.

Changesets

2013-07-20 11:42:39 +00:00 by (unknown) 7d83454

idoutils: add macro expanded columns for host/service (notes, notes_url, action_url, icon_image)

refs #1883

2013-07-20 12:14:37 +00:00 by (unknown) f1ce9ea

fix typo in oracle query

refs #1883

2013-07-20 12:16:57 +00:00 by (unknown) 8d5b7d8

update Changelog

refs #1883

2013-07-22 09:26:30 +00:00 by (unknown) 52fb382

Changelog: clarify on expanded macros (static attributes only)

refs #1883

2013-07-30 19:21:37 +00:00 by (unknown) 1af3f60

Revert "idoutils: add macro expanded columns for host/service (notes, notes_url, action_url, icon_image)"

This reverts commit 7d834545d0dfba98b1ef4df4dcfe95bd5bedd3a7.

Conflicts:
	module/idoutils/db/mysql/upgrade/mysql-upgrade-1.10.0.sql
	module/idoutils/db/oracle/upgrade/oracle-upgrade-1.10.0.sql
	module/idoutils/db/pgsql/upgrade/pgsql-upgrade-1.10.0.sql
	module/idoutils/src/db.c

Note: Will be solved differently.

refs #1883

2013-07-30 19:51:28 +00:00 by (unknown) 65727cd

idoutils: resolve attribute macros for host/service (disable via resolve_attribute_macros in idomod.cfg)

different approach - no additional columns, but changed behaviour which
can be reverted using resolve_attribute_macros=0

refs #1883

2013-07-31 08:41:20 +00:00 by (unknown) 9507718

update changelog from revert

refs #1883

Relations:

@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Sep 12, 2011

Updated by mfriedrich on 2011-09-12 13:29:45 +00:00

  • Category set to 70
  • Status changed from New to Assigned
  • Assigned to set to mfriedrich
  • Target Version set to 1.6
@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Oct 9, 2011

Updated by mfriedrich on 2011-10-09 19:23:09 +00:00

this can be done in idomod during the object config dump itsself.

this requires various macro grabbing and the processing the string.

  • memset mac
  • grab_*_macros
  • process_macros
        /****** dump host config ******/
        for (temp_host = host_list; temp_host != NULL; temp_host = temp_host->next) {

                es[0] = ido_escape_buffer(temp_host->name);
                es[1] = ido_escape_buffer(temp_host->alias);
                es[2] = ido_escape_buffer(temp_host->address);
                es[3] = ido_escape_buffer(temp_host->host_check_command);
                es[4] = ido_escape_buffer(temp_host->event_handler);
                es[5] = ido_escape_buffer(temp_host->notification_period);
                es[6] = ido_escape_buffer(temp_host->check_period);
                es[7] = ido_escape_buffer(temp_host->failure_prediction_options);

                es[7] = ido_escape_buffer(temp_host->notes);
                es[8] = ido_escape_buffer(temp_host->notes_url);
                es[9] = ido_escape_buffer(temp_host->action_url);
                es[10] = ido_escape_buffer(temp_host->icon_image);
                es[11] = ido_escape_buffer(temp_host->icon_image_alt);
                es[12] = ido_escape_buffer(temp_host->vrml_image);
                es[13] = ido_escape_buffer(temp_host->statusmap_image);
                have_2d_coords = temp_host->have_2d_coords;
@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Oct 20, 2011

Updated by mfriedrich on 2011-10-20 11:27:12 +00:00

  • Target Version changed from 1.6 to 1.7

it could be done if the performance problems on the config dump are resolved. for now, i don't see a reason to add more cpu cycles to that (macro processing is heavy).

@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Jan 20, 2012

Updated by mfriedrich on 2012-01-20 00:25:41 +00:00

  • Target Version deleted 1.7
@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented May 5, 2012

Updated by mfriedrich on 2012-05-05 11:33:35 +00:00

  • Status changed from Assigned to Closed
  • Assigned to deleted mfriedrich

i don't see the possibility with the blocking serialization of the callbacks right now.

@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Jul 4, 2013

Updated by mfriedrich on 2013-07-04 09:23:31 +00:00

  • Status changed from Closed to Assigned
  • Assigned to set to mfriedrich
  • Target Version set to 1.10

given the socket queue, i am eager to implement this now. furthermore the expanded check command should be passed through when a check happens and triggers a status update within idoutils.

within icinga web, there should be a column to show the new string then.

@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Jul 4, 2013

Updated by mfriedrich on 2013-07-04 09:24:02 +00:00

  • Subject changed from add processed macro strings into database, like action_url to add processed macro strings into database (check_command, action_url, etc)
@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Jul 20, 2013

Updated by mfriedrich on 2013-07-20 11:23:27 +00:00

  • Subject changed from add processed macro strings into database (check_command, action_url, etc) to add processed macro strings into database (notes, notes_url, action_url, icon_image)

check_command looks like "check_foo!$macro$" and isn't necessary here for the command expansion itsself.

mysql> select action_url, action_url_expanded from icinga_hosts where action_url <> "";
+-----------------------------------------------------------------------+----------------------------------------------------------------------------------------+
| action_url                                                            | action_url_expanded                                                                    |
+-----------------------------------------------------------------------+----------------------------------------------------------------------------------------+
| http://wiki/.../SvcView?hostgroup=$HOSTGROUPNAME$&hostname=$HOSTNAME$ | http://wiki/.../SvcView?hostgroup=2347hg_wildcard_all&hostname=1820localhost-test      |
| http://wiki/.../SvcView?hostgroup=$HOSTGROUPNAME$&hostname=$HOSTNAME$ | http://wiki/.../SvcView?hostgroup=2347hg_wildcard_all&hostname=1820localhost-test-p1   |
| http://wiki/.../SvcView?hostgroup=$HOSTGROUPNAME$&hostname=$HOSTNAME$ | http://wiki/.../SvcView?hostgroup=2347hg_wildcard_all&hostname=1820localhost-test-p1-2 |
| http://wiki/.../SvcView?hostgroup=$HOSTGROUPNAME$&hostname=$HOSTNAME$ | http://wiki/.../SvcView?hostgroup=2347hg_wildcard_all&hostname=1820localhost-test-p2   |
| http://wiki/.../SvcView?hostgroup=$HOSTGROUPNAME$&hostname=$HOSTNAME$ | http://wiki/.../SvcView?hostgroup=2347hg_wildcard_all&hostname=1910_localhost          |
| http://wiki/.../SvcView?hostgroup=$HOSTGROUPNAME$&hostname=$HOSTNAME$ | http://wiki/.../SvcView?hostgroup=2347hg_wildcard_all&hostname=1974_localhost          |
| http://wiki/.../SvcView?hostgroup=$HOSTGROUPNAME$&hostname=$HOSTNAME$ | http://wiki/.../SvcView?hostgroup=2347hg_wildcard_all&hostname=2688localhost-test      |
| http://wiki/.../SvcView?hostgroup=$HOSTGROUPNAME$&hostname=$HOSTNAME$ | http://wiki/.../SvcView?hostgroup=2347hg_wildcard_all&hostname=2688localhost-test-p1   |
| http://wiki/.../SvcView?hostgroup=$HOSTGROUPNAME$&hostname=$HOSTNAME$ | http://wiki/.../SvcView?hostgroup=2347hg_wildcard_all&hostname=2688localhost-test-p1-2 |
| http://wiki/.../SvcView?hostgroup=$HOSTGROUPNAME$&hostname=$HOSTNAME$ | http://wiki/.../SvcView?hostgroup=2347hg_wildcard_all&hostname=2688localhost-test-p2   |
| http://dev.icinga.org                                                 | http://dev.icinga.org                                                                  |
| i am the hosts action_url                                             | i am the hosts action_url                                                              |
+-----------------------------------------------------------------------+----------------------------------------------------------------------------------------+
12 rows in set (0.00 sec)
@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Jul 20, 2013

Updated by mfriedrich on 2013-07-20 11:30:21 +00:00

mysql> select action_url, action_url_expanded from icinga_services where action_url <> "";
+----------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
| action_url                                                                                                                 | action_url_expanded                                                                                                                          |
+----------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
| http://foobar.com                                                                                                          | http://foobar.com                                                                                                                            |
| http://dev.icinga.org                                                                                                      | http://dev.icinga.org                                                                                                                        |
| http://foobar.com                                                                                                          | http://foobar.com                                                                                                                            |
| /pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/popup?host=$HOSTNAME$&srv=$SERVICEDESC$ | /pnp4nagios/graph?host=ns4.univie.ac.at&srv=3441Service Name' class='tips' rel='/pnp4nagios/popup?host=ns4.univie.ac.at&srv=3441Service Name |
+----------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
4 rows in set (0.00 sec)
@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Jul 20, 2013

Updated by mfriedrich on 2013-07-20 12:02:10 +00:00

pgsql test with 4k services.

icinga=# select action_url, action_url_expanded from icinga_hosts where action_url != '' limit 10;
                              action_url                               |                                  action_url_expanded                                   
-----------------------------------------------------------------------+----------------------------------------------------------------------------------------
 http://wiki/.../SvcView?hostgroup=$HOSTGROUPNAME$&hostname=$HOSTNAME$ | http://wiki/.../SvcView?hostgroup=2347hg_wildcard_all&hostname=1820localhost-test
 http://wiki/.../SvcView?hostgroup=$HOSTGROUPNAME$&hostname=$HOSTNAME$ | http://wiki/.../SvcView?hostgroup=2347hg_wildcard_all&hostname=1820localhost-test-p1
 http://wiki/.../SvcView?hostgroup=$HOSTGROUPNAME$&hostname=$HOSTNAME$ | http://wiki/.../SvcView?hostgroup=2347hg_wildcard_all&hostname=1820localhost-test-p1-2
 http://wiki/.../SvcView?hostgroup=$HOSTGROUPNAME$&hostname=$HOSTNAME$ | http://wiki/.../SvcView?hostgroup=2347hg_wildcard_all&hostname=1820localhost-test-p2
 http://wiki/.../SvcView?hostgroup=$HOSTGROUPNAME$&hostname=$HOSTNAME$ | http://wiki/.../SvcView?hostgroup=2347hg_wildcard_all&hostname=1910_localhost
 http://wiki/.../SvcView?hostgroup=$HOSTGROUPNAME$&hostname=$HOSTNAME$ | http://wiki/.../SvcView?hostgroup=2347hg_wildcard_all&hostname=1974_localhost
 http://wiki/.../SvcView?hostgroup=$HOSTGROUPNAME$&hostname=$HOSTNAME$ | http://wiki/.../SvcView?hostgroup=2347hg_wildcard_all&hostname=2688localhost-test
 http://wiki/.../SvcView?hostgroup=$HOSTGROUPNAME$&hostname=$HOSTNAME$ | http://wiki/.../SvcView?hostgroup=2347hg_wildcard_all&hostname=2688localhost-test-p1
 http://wiki/.../SvcView?hostgroup=$HOSTGROUPNAME$&hostname=$HOSTNAME$ | http://wiki/.../SvcView?hostgroup=2347hg_wildcard_all&hostname=2688localhost-test-p1-2
 http://wiki/.../SvcView?hostgroup=$HOSTGROUPNAME$&hostname=$HOSTNAME$ | http://wiki/.../SvcView?hostgroup=2347hg_wildcard_all&hostname=2688localhost-test-p2
(10 rows)

icinga=# select action_url, action_url_expanded from icinga_services where action_url != '' limit 10;
                          action_url                          |                     action_url_expanded                      
--------------------------------------------------------------+--------------------------------------------------------------
 http://search.cpan.org/dist/Monitoring-Generator-TestConfig/ | http://search.cpan.org/dist/Monitoring-Generator-TestConfig/
 http://search.cpan.org/dist/Monitoring-Generator-TestConfig/ | http://search.cpan.org/dist/Monitoring-Generator-TestConfig/
 http://google.com/?q=$HOSTNAME$                              | http://google.com/?q=дверь
 http://search.cpan.org/dist/Monitoring-Generator-TestConfig/ | http://search.cpan.org/dist/Monitoring-Generator-TestConfig/
 http://search.cpan.org/dist/Monitoring-Generator-TestConfig/ | http://search.cpan.org/dist/Monitoring-Generator-TestConfig/
 http://google.com/?q=$HOSTNAME$                              | http://google.com/?q=дверь
 http://search.cpan.org/dist/Monitoring-Generator-TestConfig/ | http://search.cpan.org/dist/Monitoring-Generator-TestConfig/
 http://search.cpan.org/dist/Monitoring-Generator-TestConfig/ | http://search.cpan.org/dist/Monitoring-Generator-TestConfig/
 http://google.com/?q=$HOSTNAME$                              | http://google.com/?q=дверь
 http://search.cpan.org/dist/Monitoring-Generator-TestConfig/ | http://search.cpan.org/dist/Monitoring-Generator-TestConfig/
(10 rows)
@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Jul 20, 2013

Updated by mfriedrich on 2013-07-20 12:14:17 +00:00

oracle, fixed.

SQL> select action_url, action_url_expanded from hosts where action_url is not null and rownum <= 5;

ACTION_URL
--------------------------------------------------------------------------------
ACTION_URL_EXPANDED
--------------------------------------------------------------------------------
http://wiki/.../SvcView?hostgroup=$HOSTGROUPNAME$&hostname=$HOSTNAME$
http://wiki/.../SvcView?hostgroup=2347hg_wildcard_all&hostname=1820localhost-tes
t

http://wiki/.../SvcView?hostgroup=$HOSTGROUPNAME$&hostname=$HOSTNAME$
http://wiki/.../SvcView?hostgroup=2347hg_wildcard_all&hostname=1820localhost-tes
t-p1

http://wiki/.../SvcView?hostgroup=$HOSTGROUPNAME$&hostname=$HOSTNAME$

ACTION_URL
--------------------------------------------------------------------------------
ACTION_URL_EXPANDED
--------------------------------------------------------------------------------
http://wiki/.../SvcView?hostgroup=2347hg_wildcard_all&hostname=1820localhost-tes
t-p1-2

http://wiki/.../SvcView?hostgroup=$HOSTGROUPNAME$&hostname=$HOSTNAME$
http://wiki/.../SvcView?hostgroup=2347hg_wildcard_all&hostname=1820localhost-tes
t-p2

http://wiki/.../SvcView?hostgroup=$HOSTGROUPNAME$&hostname=$HOSTNAME$
http://wiki/.../SvcView?hostgroup=2347hg_wildcard_all&hostname=1910_localhost

ACTION_URL
--------------------------------------------------------------------------------
ACTION_URL_EXPANDED
--------------------------------------------------------------------------------
@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Jul 20, 2013

Updated by mfriedrich on 2013-07-20 12:17:46 +00:00

  • Status changed from Assigned to 8
  • Done % changed from 0 to 100
@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Jul 30, 2013

Updated by mfriedrich on 2013-07-30 07:59:04 +00:00

  • Status changed from 8 to Assigned
  • Done % changed from 100 to 80

discussion

  • remove schema extension
  • add idomod.cfg config option to set macro expansion (default enabled)
@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Jul 30, 2013

Updated by mfriedrich on 2013-07-30 19:46:12 +00:00

New idomod.cfg option

# RESOLVE ATTRIBUTE MACROS
# This option determines whether attribute macros are resolved by idomod or not.
# For example, action_url may contain $HOSTNAME$ which is automatically resolved
# then, if resolve_attribute_macros is set.
#
# Values:
#       0 = disabled
#       1 = enabled (default)

resolve_attribute_macros=1

Test disabled:

mysql> select display_name, action_url from icinga_services where action_url <> '';
+-------------------------+----------------------------------------------------------------------------------------------------------------------------+
| display_name            | action_url                                                                                                                 |
+-------------------------+----------------------------------------------------------------------------------------------------------------------------+
| dep1                    | http://foobar.com                                                                                                          |
| 2743service_custom_attr | http://dev.icinga.org                                                                                                      |
| dep1                    | http://foobar.com                                                                                                          |
| 3441Service Name        | /pnp4nagios/graph?host=$HOSTNAME$&srv=$SERVICEDESC$' class='tips' rel='/pnp4nagios/popup?host=$HOSTNAME$&srv=$SERVICEDESC$ |
+-------------------------+----------------------------------------------------------------------------------------------------------------------------+
4 rows in set (0.00 sec)

Test enabled:

mysql> select display_name, action_url from icinga_services where action_url <> '';
+-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
| display_name            | action_url                                                                                                                                   |
+-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
| dep1                    | http://foobar.com                                                                                                                            |
| 2743service_custom_attr | http://dev.icinga.org                                                                                                                        |
| dep1                    | http://foobar.com                                                                                                                            |
| 3441Service Name        | /pnp4nagios/graph?host=ns4.univie.ac.at&srv=3441Service Name' class='tips' rel='/pnp4nagios/popup?host=ns4.univie.ac.at&srv=3441Service Name |
+-------------------------+----------------------------------------------------------------------------------------------------------------------------------------------+
4 rows in set (0.00 sec)
@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Jul 30, 2013

Updated by mfriedrich on 2013-07-30 19:51:55 +00:00

  • Status changed from Assigned to 8
  • Done % changed from 80 to 100
@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Jul 31, 2013

Updated by mfriedrich on 2013-07-31 08:40:11 +00:00

  • Status changed from 8 to Closed
@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Jul 31, 2013

Updated by mfriedrich on 2013-07-31 08:40:18 +00:00

  • Status changed from Closed to New
@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Jul 31, 2013

Updated by mfriedrich on 2013-07-31 08:42:35 +00:00

  • Status changed from New to Rejected
  • Assigned to deleted mfriedrich
  • Target Version deleted 1.10
  • Done % changed from 100 to 0

the application itsself should decide how to handle those macros.

@icinga-migration
Copy link
Member Author

@icinga-migration icinga-migration commented Dec 8, 2014

Updated by mfriedrich on 2014-12-08 14:37:23 +00:00

  • Project changed from 18 to Core, Classic UI, IDOUtils
  • Category changed from 70 to IDOUtils
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.