Issue importing service templates
Posted: Fri Dec 21, 2018 11:28 am
Hi. I've found a bug regarding importing service templates. When importing service templates that have no "Check interval", "Retry interval" or "Max check attempts" defined, that value gets set to 0 instead of staying blank.
For instance, after importing

This is a regression, it used to work perfectly in older versions. The cause is wrong default values in tbl_servicetemplate table of nagiosql:
A simple workaround would be to execute
Tested using the provided XI 5.5.7 ovf/ova.
Thanks, Gonzalo
For instance, after importing
Code: Select all
define service {
name bugged-service-template
use generic-service
register 0
}
This is a regression, it used to work perfectly in older versions. The cause is wrong default values in tbl_servicetemplate table of nagiosql:
Code: Select all
MariaDB [nagiosql]> describe tbl_servicetemplate;
+------------------------------+---------------------+------+-----+---------------------+-----------------------------+
| Field | Type | Null | Key | Default | Extra |
+------------------------------+---------------------+------+-----+---------------------+-----------------------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| template_name | varchar(255) | NO | MUL | | |
| host_name | tinyint(3) unsigned | NO | | 0 | |
| host_name_tploptions | tinyint(3) unsigned | NO | | 2 | |
| hostgroup_name | tinyint(3) unsigned | NO | | 0 | |
| hostgroup_name_tploptions | tinyint(3) unsigned | NO | | 2 | |
| service_description | varchar(255) | NO | | | |
| display_name | varchar(255) | NO | | | |
| servicegroups | tinyint(3) unsigned | NO | | 0 | |
| servicegroups_tploptions | tinyint(3) unsigned | NO | | 2 | |
| use_template | tinyint(3) unsigned | NO | | 0 | |
| use_template_tploptions | tinyint(3) unsigned | NO | | 2 | |
| check_command | text | YES | | NULL | |
| is_volatile | tinyint(3) unsigned | NO | | 2 | |
| initial_state | varchar(20) | NO | | | |
| max_check_attempts | int(11) | YES | | 0 | | !!! INCORRECT
| check_interval | int(11) | YES | | 0 | | !!! INCORRECT
| retry_interval | int(11) | YES | | 0 | | !!! INCORRECT
...
Code: Select all
ALTER TABLE tbl_servicetemplate ALTER max_check_attempts SET DEFAULT NULL;
ALTER TABLE tbl_servicetemplate ALTER check_interval SET DEFAULT NULL;
ALTER TABLE tbl_servicetemplate ALTER retry_interval SET DEFAULT NULL;Thanks, Gonzalo