Escalations (Service / Advanced Services / Hosts)

User / Community contributed content: modifications, patches, extensions, modules, scripts etc.

Re: Escalations (Service / Advanced Services / Hosts)

Postby jsmegerman » Mon Apr 22, 2013 16:19

I just added this to my NConf setup (I haven't tried it yet, but from what I've read that seems to be working pretty well for others), and I noticed 2 things with the SQL statements that can/should be changed:

1) The second insert (into ConfigAttrs) has several rows duplicated (254-256), which obviously doesn't work.

2) Since the first item in each row is the autoindexed primary key, you should insert them with NULL instead of assigning a number. That way, it won't matter if there are any differences in the number in a particular instance of NConf, it'll just add them sequentially with the next available numbers.

Thanks for making this available - assuming it works the way I want it to, it'll be a huge help! :)

ETA: After playing around with them a little, they look like they should work just fine. The one other change I recommend is adding hostgroups to the host-escalation class, and make host and hostgroup not required (icinga at least can handle hostescalations not associated with any hosts, and it's MUCH easier to put host escalations on hostgroups rather than individual hosts :)). Thanks again!
jsmegerman
NConf rookie
NConf rookie
 
Posts: 17
Joined: Tue Mar 12, 2013 18:50

Re: Escalations (Service / Advanced Services / Hosts)

Postby jsmegerman » Wed Apr 24, 2013 18:05

After playing with escalations a bit and seeing that they work (at least the output is good, I haven't actually turned on notifications in icinga and tested that part yet), I realized that I really wanted to be able to use escalation templates to standardize certain defaults. So I added them. Here is the modified SQL code to add all escalation-related classes and attributes to NConf. It uses the same ExportNagios patch, and assumes that no additional classes have been added to NConf from a clean 1.3 install. If classes with an ID over 18 are present, you need to change the class ID globally in the SQL code.

My thanks to pebr for doing the initial work on this, which showed me how to extend it.

Code: Select all
INSERT INTO `ConfigClasses` (`id_class`, `config_class`, `friendly_name`, `nav_visible`, `ordering`, `grouping`, `nav_links`, `nav_privs`, `class_type`, `out_file`, `nagios_object`) VALUES
(19, 'host-escalation', 'Host escalation', 'yes', 6, 'Advanced Items', 'Show::overview.php?class=host-escalation;;Add::handle_item.php?item=host-escalation', 'admin', 'collector', 'escalation.cfg', 'hostescalation'),
(20, 'service-escalation', 'Service escalation', 'yes', 7, 'Advanced Items', 'Show::overview.php?class=service-escalation;;Add::handle_item.php?item=service-escalation', 'admin', 'collector', 'escalation.cfg', 'serviceescalation'),
(21, 'adv-service-escalation', 'Adv Srv escalation', 'yes', 8, 'Advanced Items', 'Show::overview.php?class=adv-service-escalation;;Add::handle_item.php?item=adv-service-escalation', 'admin', 'collector', 'escalation.cfg', 'serviceescalation'),
(22, 'host-escalation-template', 'Host esc. tpml.', 'yes', 9, 'Advanced Items', 'Show::overview.php?class=host-escalation-template;;Add::handle_item.php?item=host-escalation-template', 'admin', 'global', 'escalation_templates.cfg', 'hostescalation');
(23, 'service-escalation-template', 'Service esc. tmpl.', 'yes', 10, 'Advanced Items', 'Show::overview.php?class=service-escalation-template;;Add::handle_item.php?item=service-escalation-template', 'admin', 'global', 'escalation_templates.cfg', 'serviceescalation');

INSERT INTO `ConfigAttrs` (`id_attr`, `attr_name`, `friendly_name`, `description`, `datatype`, `max_length`, `poss_values`, `predef_value`, `mandatory`, `ordering`, `visible`, `write_to_conf`, `naming_attr`, `link_as_child`, `link_bidirectional`, `fk_show_class_items`, `fk_id_class`) VALUES
(NULL, 'name', 'Name', 'Name', 'text', 1024, '', '', 'yes', 1, 'yes', 'no', 'yes', 'no', 'no', NULL, 19),
(NULL, 'first_notification', 'first notification', '', 'text', 1024, '', '0', 'no', 2, 'yes', 'yes', 'no', 'no', 'no', NULL, 19),
(NULL, 'last_notification', 'last notification', '', 'text', 1024, '', '', 'no', 3, 'yes', 'yes', 'no', 'no', 'no', NULL, 19),
(NULL, 'notification_interval', 'notification interval', '', 'text', 1024, '', '', 'no', 4, 'yes', 'yes', 'no', 'no', 'no', NULL, 19),
(NULL, 'escalation_period', 'escalation period', '', 'assign_one', 0, '', '', 'no', 5, 'yes', 'yes', 'no', 'no', 'no', 7, 19),
(NULL, 'use', 'host escalation template(s)', 'host escalation template(s) to inherit properties from', 'assign_cust_order', 0, '', '', 'no', 6, 'yes', 'yes', 'no', 'no', 'no', 22, 19),
(NULL, 'host', 'host', '', 'assign_many', 0, '', '', 'yes', 7, 'yes', 'yes', 'no', 'no', 'no', 1, 19),
(NULL, 'hostgroup', 'hostgroup', '', 'assign_many', 0, '', '', 'yes', 8, 'yes', 'yes', 'no', 'no', 'no', 2, 19),
(NULL, 'contact_groups', 'contact groups', '', 'assign_many', 0, '', '', 'yes', 9, 'yes', 'yes', 'no', 'no', 'no', 6, 19),
(NULL, 'name', 'Name', 'Name', 'text', 1024, '', '', 'yes', 1, 'yes', 'no', 'yes', 'no', 'no', NULL, 20),
(NULL, 'first_notification', 'first notification', '', 'text', 1024, '', '0', 'no', 2, 'yes', 'yes', 'no', 'no', 'no', NULL, 20),
(NULL, 'last_notification', 'last notification', '', 'text', 1024, '', '', 'no', 3, 'yes', 'yes', 'no', 'no', 'no', NULL, 20),
(NULL, 'notification_interval', 'notification interval', '', 'text', 1024, '', '', 'no', 4, 'yes', 'yes', 'no', 'no', 'no', NULL, 20),
(NULL, 'escalation_period', 'escalation period', '', 'assign_one', 0, '', '', 'no', 5, 'yes', 'yes', 'no', 'no', 'no', 7, 20),
(NULL, 'use', 'service escalation template(s)', 'service escalation template(s) to inherit properties from', 'assign_cust_order', 0, '', '', 'no', 6, 'yes', 'yes', 'no', 'no', 'no', 23, 20),
(NULL, 'host_name', 'host name', '', 'assign_many', 0, '', '', 'yes', 7, 'yes', 'yes', 'no', 'no', 'no', 1, 20),
(NULL, 'service_description', 'service description', '', 'assign_many', 0, '', '', 'yes', 8, 'yes', 'yes', 'no', 'no', 'no', 3, 20),
(NULL, 'contact_groups', 'contact groups', '', 'assign_many', 0, '', '', 'yes', 9, 'yes', 'yes', 'no', 'no', 'no', 6, 20),
(NULL, 'name', 'Name', 'Name', 'text', 1024, '', '', 'yes', 1, 'yes', 'no', 'yes', 'no', 'no', NULL, 21),
(NULL, 'first_notification', 'first notification', '', 'text', 1024, '', '0', 'no', 2, 'yes', 'yes', 'no', 'no', 'no', NULL, 21),
(NULL, 'last_notification', 'last notification', '', 'text', 1024, '', '', 'no', 3, 'yes', 'yes', 'no', 'no', 'no', NULL, 21),
(NULL, 'notification_interval', 'notification interval', '', 'text', 1024, '', '', 'no', 4, 'yes', 'yes', 'no', 'no', 'no', NULL, 21),
(NULL, 'escalation_period', 'escalation period', '', 'assign_one', 0, '', '', 'no', 5, 'yes', 'yes', 'no', 'no', 'no', 7, 21),
(NULL, 'use', 'service escalation template(s)', 'service escalation template(s) to inherit properties from', 'assign_cust_order', 0, '', '', 'no', 6, 'yes', 'yes', 'no', 'no', 'no', 23, 21),
(NULL, 'host_name', 'host name', '', 'assign_many', 0, '', '', 'yes', 7, 'yes', 'yes', 'no', 'no', 'no', 1, 21),
(NULL, 'service_description', 'service description', '', 'assign_many', 0, '', '', 'yes', 8, 'yes', 'yes', 'no', 'no', 'no', 18, 21),
(NULL, 'contact_groups', 'contact groups', '', 'assign_many', 0, '', '', 'yes', 9, 'yes', 'yes', 'no', 'no', 'no', 6, 21),
(NULL, 'name', 'Name', 'Name', 'text', 1024, '', '', 'yes', 1, 'yes', 'yes', 'yes', 'no', 'no', NULL, 22),
(NULL, 'first_notification', 'first notification', '', 'text', 1024, '', '0', 'yes', 2, 'yes', 'yes', 'no', 'no', 'no', NULL, 22),
(NULL, 'last_notification', 'last notification', '', 'text', 1024, '', '', 'yes', 3, 'yes', 'yes', 'no', 'no', 'no', NULL, 22),
(NULL, 'notification_interval', 'notification interval', '', 'text', 1024, '', '', 'yes', 4, 'yes', 'yes', 'no', 'no', 'no', NULL, 22),
(NULL, 'escalation_period', 'escalation period', '', 'assign_one', 0, '', '', 'no', 5, 'yes', 'yes', 'no', 'no', 'no', 7, 22),
(NULL, 'use', 'host escalation template(s)', 'host escalation template(s) to inherit properties from', 'assign_cust_order', 0, '', '', 'no', 6, 'yes', 'yes', 'no', 'no', 'no', 22, 22),
(NULL, 'register', 'register', '', 'select', 0, '0::1', '0', 'yes', 7, 'no', 'yes', 'no', 'no', 'no', NULL, 22),
(NULL, 'name', 'Name', 'Name', 'text', 1024, '', '', 'yes', 1, 'yes', 'yes', 'yes', 'no', 'no', NULL, 23),
(NULL, 'first_notification', 'first notification', '', 'text', 1024, '', '0', 'yes', 2, 'yes', 'yes', 'no', 'no', 'no', NULL, 23),
(NULL, 'last_notification', 'last notification', '', 'text', 1024, '', '', 'yes', 3, 'yes', 'yes', 'no', 'no', 'no', NULL, 23),
(NULL, 'notification_interval', 'notification interval', '', 'text', 1024, '', '', 'yes', 4, 'yes', 'yes', 'no', 'no', 'no', NULL, 23),
(NULL, 'escalation_period', 'escalation period', '', 'assign_one', 0, '', '', 'no', 5, 'yes', 'yes', 'no', 'no', 'no', 7, 23),
(NULL, 'use', 'service escalation template(s)', 'service escalation template(s) to inherit properties from', 'assign_cust_order', 0, '', '', 'no', 6, 'yes', 'yes', 'no', 'no', 'no', 23, 23),
(NULL, 'register', 'register', '', 'select', 0, '0::1', '0', 'yes', 7, 'no', 'yes', 'no', 'no', 'no', NULL, 23);


NOTE: The use of NULL as the first value in the Attrs is valid - it automatically selects the next available index. However, I can't use it in the Class inserts, as the last value in the attributes (and the second to last value in 'use' attributes) are tied to the Class ID numbers. If you have to change a class ID, make sure you change it globally in the Attributes as well.
jsmegerman
NConf rookie
NConf rookie
 
Posts: 17
Joined: Tue Mar 12, 2013 18:50

Re: Escalations (Service / Advanced Services / Hosts)

Postby JDB4 » Thu Aug 22, 2013 19:16

Hi, Wondering if anyone can help me out here, was all set to put Nagios live this morning until I discovered nconf had no escalations. I've followed the steps here, inserted the sql statements. Everything looks ok sql wise. I didnt do the php changes as I am not doing. the advanced escalations.
Problem is when I create the host or service escalations and deploy the config, escalation.cfg does not get created. Do I need to create an empty copy first? Also noescalation attributes appear, do I need to put them in manually?
Thanks
JDB4
 

Previous

Return to Contributions

Who is online

Users browsing this forum: No registered users and 2 guests

cron