Closed graemekay7 closed 5 years ago
The host name is stored in the icinga_objects
table as name1
column, so you'll need to modify your query to join this table as well. alias
is just an old column which is updated for compatibility reasons - either it takes the hostname, or the display_name if set.
select oh.name1 as hostname, h.display_name from icinga_objects oh join icinga_hosts h on oh.object_id=h.host_object_id;
Thank you @dnsmichi
We are reviewing now, but see it as you described so will close this down.
Many thanks, GK
Expected Behavior
When Hostname and Display_name are both used, display_name does not overwrite the hostname
Current Behavior
If only hostname is used, the alias field contains the hostname. If the display_name is filled in, this overwrites the hostname. We have another, production, instance on 2.8.1-1 which works as expected.
The configuration below links to the mysql entry, both copied out below.
Host configuration:
object Host "e96e0650db7b030044c5f9b41d9619d4" { import "___generic_host" display_name = "VIJU-UK-EDIN-EDI1-MX700-01" address = "10.x.x.x" vars.model = "MX700" vars.pwd = "something" vars.username = "something" }
MySQL Entry under icinga.icinga_hosts:
| host_id | instance_id | config_type | host_object_id | alias | display_name | address | address6 | check_command_object_id | check_command_args | eventhandler_command_object_id | eventhandler_command_args | notification_timeperiod_object_id | check_timeperiod_object_id | failure_prediction_options | check_interval | retry_interval | max_check_attempts | first_notification_delay | notification_interval | notify_on_down | notify_on_unreachable | notify_on_recovery | notify_on_flapping | notify_on_downtime | stalk_on_up | stalk_on_down | stalk_on_unreachable | flap_detection_enabled | flap_detection_on_up | flap_detection_on_down | flap_detection_on_unreachable | low_flap_threshold | high_flap_threshold | process_performance_data | freshness_checks_enabled | freshness_threshold | passive_checks_enabled | event_handler_enabled | active_checks_enabled | retain_status_information | retain_nonstatus_information | notifications_enabled | obsess_over_host | failure_prediction_enabled | notes | notes_url | action_url | icon_image | icon_image_alt | vrml_image | statusmap_image | have_2d_coords | x_2d | y_2d | have_3d_coords | x_3d | y_3d | z_3d | config_hash
| 348 | 1 | 1 | 2860 | VIJU-UK-EDIN-EDI1-MX700-01 | VIJU-UK-EDIN-EDI1-MX700-01 | 10.x.x.x | | 28 | NULL | 2795 | NULL | 0 | 0 | | 5 | 1 | 3 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 25 | 25 | 1 | 1 | 300 | 1 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | | | | | | NULL | NULL | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3a3e53ee7b8a1fa202817d642507bd04f2f248b90d867ff19e2a21b653c711d9 |
Possible Solution
Do not overwrite hostname
Steps to Reproduce (for bugs)
Context
We currently assign a GUID via our ITSM to the hostname and pull this in for our event commands and reporting (reporting uses the GUID to pull location / model information)
Display name is used for a friendly, recognizable name for our service desk staff when using Icingaweb2.
Your Environment
icinga2 --version
): 2.9.1-1 & 2.10.2-1icinga2 feature list
): Disabled features: debuglog elasticsearch gelf graphite ido-pgsql influxdb livestatus opentsdb perfdata statusdata syslog Enabled features: api checker command compatlog ido-mysql mainlog notificationicinga2 daemon -C
): [2019-04-09 07:33:53 +0000] information/cli: Icinga application loader (version: r2.10.2-1) [2019-04-09 07:33:53 +0000] information/cli: Loading configuration file(s). [2019-04-09 07:33:53 +0000] information/ConfigItem: Committing config item(s). [2019-04-09 07:33:53 +0000] information/ApiListener: My API identity: viju-lab-master-01.viju.com [2019-04-09 07:33:53 +0000] warning/ApplyRule: Apply rule 'windows disk c:' (in /etc/icinga2/zones.d/global-templates/services/apply_windows.conf: 4:1-4:31) for type 'Service' does not match anywhere! [2019-04-09 07:33:53 +0000] warning/ApplyRule: Apply rule 'windows uptime' (in /etc/icinga2/zones.d/global-templates/services/apply_windows.conf: 26:1-26:30) for type 'Service' does not match anywhere! [2019-04-09 07:33:53 +0000] warning/ApplyRule: Apply rule 'windows cpu 5min' (in /etc/icinga2/zones.d/global-templates/services/apply_windows.conf: 38:1-38:32) for type 'Service' does not match anywhere! [2019-04-09 07:33:53 +0000] warning/ApplyRule: Apply rule 'windows ram' (in /etc/icinga2/zones.d/global-templates/services/apply_windows.conf: 53:1-53:27) for type 'Service' does not match anywhere! [2019-04-09 07:33:53 +0000] warning/ApplyRule: Apply rule 'WIN-PROCS' (in /etc/icinga2/zones.d/global-templates/services/apply_windows.conf: 69:1-69:25) for type 'Service' does not match anywhere! [2019-04-09 07:33:53 +0000] warning/ApplyRule: Apply rule 'WIN-SERVS' (in /etc/icinga2/zones.d/global-templates/services/apply_windows.conf: 81:1-81:25) for type 'Service' does not match anywhere! [2019-04-09 07:33:53 +0000] warning/ApplyRule: Apply rule 'nscp-local-cpu' (in /etc/icinga2/zones.d/global-templates/services/apply_windows.conf: 92:1-92:30) for type 'Service' does not match anywhere! [2019-04-09 07:33:53 +0000] information/ConfigItem: Instantiated 1 ScheduledDowntime. [2019-04-09 07:33:53 +0000] information/ConfigItem: Instantiated 348 Services. [2019-04-09 07:33:53 +0000] information/ConfigItem: Instantiated 1 IcingaApplication. [2019-04-09 07:33:53 +0000] information/ConfigItem: Instantiated 65 Hosts. [2019-04-09 07:33:53 +0000] information/ConfigItem: Instantiated 1 EventCommand. [2019-04-09 07:33:53 +0000] information/ConfigItem: Instantiated 1 FileLogger. [2019-04-09 07:33:53 +0000] information/ConfigItem: Instantiated 2 NotificationCommands. [2019-04-09 07:33:53 +0000] information/ConfigItem: Instantiated 1 NotificationComponent. [2019-04-09 07:33:53 +0000] information/ConfigItem: Instantiated 1 ApiListener. [2019-04-09 07:33:53 +0000] information/ConfigItem: Instantiated 1 Downtime. [2019-04-09 07:33:53 +0000] information/ConfigItem: Instantiated 1 CheckerComponent. [2019-04-09 07:33:53 +0000] information/ConfigItem: Instantiated 6 Zones. [2019-04-09 07:33:53 +0000] information/ConfigItem: Instantiated 1 ExternalCommandListener. [2019-04-09 07:33:53 +0000] information/ConfigItem: Instantiated 4 Endpoints. [2019-04-09 07:33:53 +0000] information/ConfigItem: Instantiated 7 ApiUsers. [2019-04-09 07:33:53 +0000] information/ConfigItem: Instantiated 1 CompatLogger. [2019-04-09 07:33:53 +0000] information/ConfigItem: Instantiated 1 IdoMysqlConnection. [2019-04-09 07:33:53 +0000] information/ConfigItem: Instantiated 350 CheckCommands. [2019-04-09 07:33:53 +0000] information/ConfigItem: Instantiated 14 ServiceGroups. [2019-04-09 07:33:53 +0000] information/ConfigItem: Instantiated 3 TimePeriods. [2019-04-09 07:33:53 +0000] information/ScriptGlobal: Dumping variables to file '/var/cache/icinga2/icinga2.vars' [2019-04-09 07:33:53 +0000] information/cli: Finished validating the configuration file(s).zones.conf
file (oricinga2 object list --type Endpoint
andicinga2 object list --type Zone
) from all affected nodes. Object 'master' of type 'Zone': % declared in '/etc/icinga2/zones.conf', lines 9:1-9:20Object 'lab-sat-01' of type 'Zone': % declared in '/etc/icinga2/zones.conf', lines 27:1-27:24
Object 'viju-uk-lab' of type 'Zone': % declared in '/etc/icinga2/zones.conf', lines 39:1-39:25
Object 'director-global' of type 'Zone': % declared in '/etc/icinga2/zones.conf', lines 17:1-17:29
Object 'global-templates' of type 'Zone': % declared in '/etc/icinga2/zones.conf', lines 13:1-13:30