While adding a contact template through the API hasn't been added yet, to get the contact template functionality to work when adding/updating a contact you can edit this file:
Code: Select all
/usr/local/nagiosxi/html/api/includes/utils-config.inc.php
Change this line (around line 888):
Code: Select all
$others = array('alias', 'contactgroups', 'minimum_importance', 'email', 'pager', 'can_submit_commands', 'retain_status_information', 'retain_nonstatus_information');
To this:
Code: Select all
$others = array('alias', 'contactgroups', 'minimum_importance', 'email', 'pager', 'can_submit_commands', 'retain_status_information', 'retain_nonstatus_information', 'use');
Then change this one (around line 954):
Code: Select all
$options = array('host_notifications_enabled', 'service_notifications_enabled', 'host_notification_period', 'service_notification_period', 'host_notification_options', 'service_notification_options', 'host_notification_commands', 'service_notification_commands', 'alias', 'contactgroups', 'minimum_importance', 'email', 'pager', 'can_submit_commands', 'retain_status_information', 'retain_nonstatus_information');
To:
Code: Select all
$options = array('host_notifications_enabled', 'service_notifications_enabled', 'host_notification_period', 'service_notification_period', 'host_notification_options', 'service_notification_options', 'host_notification_commands', 'service_notification_commands', 'alias', 'contactgroups', 'minimum_importance', 'email', 'pager', 'can_submit_commands', 'retain_status_information', 'retain_nonstatus_information', 'use');
That should do it for the "use" option to set a contact template when adding/updating a contact.
Please note that if you upgrade XI before development implements the change the change will be overwritten and you'll need to re-implement it after upgrading.