1.23.4 Configuring SQL exporter
This section describes how to configure SQL exporter, an optional feature of integrated agent host.
- Organization of this subsection
(1) Preparing for SQL exporter Configuration
This section describes how to prepare for setting up SQL exporter.
(a) Setting up JP1/IM - Manager
If JP1/IM - Manager 13-11 or later is newly installed, it does not need to be executed.
If you upgraded from a version earlier than JP1/IM - Manager 13-11, perform the following steps:
(b) Obtaining setup archive files
Retrieve the setup archive file to use SQL exporter. The setup archive file is located in the folder where JP1/IM - Agent is installed.
The file names for the setup archive files are as follows:
JP1/IM-Agent-installation-destination/jp1ima/options/
-
sql_exporter_windows_VVRRSS.zip
■ Placing metric definition files
Perform the following steps when upgrading from a version earlier than JP1/IM - Manager 13-11 in logical host operation.
-
Copy the model file of metric definition file of the following SQL exporter and rename it to the definition file name of the copy destination.
Source filename: JP1/IM-Manager-installation-folder\jp1imm\conf\imdd\plugin\jp1pccs\metrics_sql_exporter.conf.model
Destination filename: JP1/IM-Manager-installation-folder\jp1imm\conf\imdd\plugin\jp1pccs\metrics_sql_exporter.conf
For logical host operation, place this file in the following location:
shared-folder\jp1imm\conf\imdd\plugin\jp1pccs\
(c) Setting up JP1/IM - Agent
This step is not required if you are installing JP1/IM - Agent 13-11 or later.
If you upgraded from a version earlier than JP1/IM - Agent 13-11, perform the following steps:
Note that you do not need to install Microsoft SQL Server modules on JP1/IM - Agent hosts.
■ Stopping JP1/IM - Agent
Stop JP1/IM - Agent service.
-
For physical hosts
Stop JP1/IM - Agent servicing by running the following command.
jpc_service_stop -s all
-
For logical hosts
Stop from the cluster software.
■ Setting up SQL exporter scrape jobs
The model file of the Prometheus configuration file is updated when the version is upgraded. Write the following details of Prometheus configuration file model file (jpc_prometheus_server.yml.model) under scrape_configs of Prometheus configuration file (jpc_prometheus_server.yml).
For logical host operation, update the following files:
shared-folder\jp1ima\conf\jpc_prometheus_server.yml
(Omitted)
:
scrape_configs:
:
- job_name: 'jpc_sql'
scrape_interval: 60s
scrape_timeout: 30s
metrics_path: /metrics
file_sd_configs:
- files:
- 'jpc_file_sd_config_mssql.yml'
relabel_configs:
- target_label: jp1_pc_nodelabel
replacement: MSSQL metric collector(SQL exporter)
metric_relabel_configs:
- source_labels: ['__name__']
regex: 'mssql_local_time_seconds|mssql_connections|mssql_deadlocks|mssql_user_errors|mssql_kill_connection_errors|mssql_page_life_expectancy_seconds|mssql_batch_requests|mssql_log_growths|mssql_buffer_cache_hit_ratio|mssql_checkpoint_pages_sec|mssql_io_stall_seconds|mssql_io_stall_total_seconds|mssql_resident_memory_bytes|mssql_virtual_memory_bytes|mssql_memory_utilization_percentage|mssql_page_fault_count|mssql_os_memory|mssql_os_page_file|mssql_database_detail_process_count|mssql_global_server_summary_perc_busy|mssql_global_server_summary_packet_errors|mssql_server_detail_blocked_processes|mssql_server_overview_cache_hit|mssql_transaction_log_overview_log_space_used'
action: 'keep'
- source_labels: [exported_job]
target_label: instance
replacement: ${1}
- source_labels: [target]
target_label: jp1_pc_nodelabel
replacement: ${1}■ Deploying SQL exporter discovery configuration file
-
Copy the model file of the definition file that defines the monitoring target of the following SQL exporter, and rename it to the definition file name of the copy destination.
Source filename: JP1/IM - Agent installation folder\jp1ima\conf\jpc_file_sd_config_mssql.yml.model
Destination filename: JP1/IM - Agent installation folder\jp1ima\conf\jpc_file_sd_config_oracledb.yml
For logical host operation, place this file in the following location:
shared-folder\jp1ima\conf\
-
Open the jpc_file_sd_config_oracledb.yml file created in step 1 in a text editor, edit it as follows, and overwrite it.
- targets: #-@@hostname@@#:SQL-exporter's-port-number labels: jp1_pc_exporter: JPC SQL exporter jp1_pc_category: database jp1_pc_trendname: sql_exporter jp1_pc_remote_monitor_instance: @@hostname@@:MSSQL metric collector(SQL exporter) jp1_pc_multiple_node: "{__name__=~'mssql_.*'}"- #
-
Specify the host name of JP1/IM - Agent (or logical host name for logical host operation).
■ Checking the settings
Prometheus server definition file is checked because the format can be checked by the promtool command.
The promtool command is stored in under JP1/IM-Agent-installation-destination/jp1ima/tools.
promtool check config jpc_prometheus_server.yml
If an error is displayed, review the error.
Note that there is no problem even if the following warning is displayed.
WARNING: file "../conf/jpc_file_sd_config_windows.yml" for file_sd in scrape job "jpc_windows" does not exist
■ Starting JP1/IM - Agent
Start JP1/IM - Agent servicing.
-
For physical hosts
Run the following command to start JP1/IM - Agent services.
jpc_service_start -s all
-
For logical hosts
Start from the cluster software.
(2) Installing SQL exporter
This section describes how to install SQL exporter.
(a) Preparing for Installation
-
Confirm the setting of JP1IMADIR.
You must set JP1IMADIR in service definition file for SQL exporter. Depending on the type of host in the JP1/IM - Agent, the following values will occur.
Host type
Environment variable JP1IMADIR
For physical host operation
JP1/IM-Agent-installation-folder\jp1ima
For logical host operation
shared-folder\jp1ima
-
Confirm whether to operate on a physical host or a logical host.
SQL exporter is also a physical host operation if scrape of the newly added JP1/IM - Agent is a physical host operation.
SQL exporter is also logical host operation if scrape of the newly added JP1/IM - Agent is logical host operation.
(b) Installing SQL exporter
-
Place SQL exporter.
Extract the setup archive file# obtained in 1.23.4(1)(b) Obtaining setup archive files to a folder of your choice. Do not specify the folder where JP1/IM - Manager or JP1/IM - Agent will be installed in the destination folder.
- #
-
sql_exporter_windows_VVRRSS.zip
To operate SQL exporter on a logical host, place it in shared-folder.
-
Create a defaulted metric definition-file.
Copies the model file of the following default metric definition file and renames it to the definition file name of the copy destination.
Source filename: SQL exporter location\sql_exporter_windows\jp1ima\conf\mssql_standard.collector.yml.model
Destination filename: SQL exporter location\sql_exporter_windows\jp1ima\conf\mssql_standard.collector.yml
-
Updating service definition file.
Verify that the following files exist:
SQL exporter location\sql_exporter_windows\jp1ima\bin\sql_exporter_service.exe
SQL exporter location\sql_exporter_windows\jp1ima\bin\sql_exporter_service.xml.model
Modify the following service definition file settings:
Value to be changed
Value to specify
@@sql_exporter_installdir@@
Replace with SQL exporter location.
@@autostart@@
-
To start automatically at OS startup
Replace with "Automatic".
-
To not start automatically
Replace with "Manual".
For logical hosts, substitute "Manual".
-
-
Register the service.
Run the following command to register SQL exporter service with Windows:
-
For physical host operation
sql_exporter_service.exe install
-
For logical host operation
sql_exporter_logical-host-name_service.exe install
For logical host operation, execute the command on both nodes that make up the cluster.
-
-
Set the monitoring target in SQL exporter configuration file.
The target of SQL exporter is listed in SQL exporter configuration file (jpc_sql_exporter.yml).
For details about SQL exporter configuration file, see SQL exporter configuration file (jpc_sql_exporter) in Chapter 2. Definition Files in the JP1/Integrated Management 3 - Manager Command, Definition File and API Reference.
-
Add a target.
For details on adding a target, see 1.23.4(4)(a) Adding monitoring targets (required).
-
Register the service with the cluster software.
For a cluster configuration, register the service with the cluster software.
(c) Configuring Prometheus
-
Configure monitoring targets for SQL exporter discovery configuration file.
SQL exporter targets are listed in SQL exporter Discovery configuration file (jpc_file_sd_config_mssql) targets.
For details about SQL exporter discovery configuration file, see SQL exporter discovery configuration file (jpc_file_sd_config_mssql) in Chapter 2. Definition Files in the JP1/Integrated Management 3 - Manager Command, Definition File and API Reference.
-
Checking the settings with promtool command.
Verify that the settings are correct.
promtool command is located in JP1/IM-Agent-installation-folder\jp1ima\tools folder.
promtool check config jpc_prometheus_server.yml
If an error is displayed, review the error.
Note that there is no problem even if the following warning is displayed.
WARNING: file "../conf/jpc_file_sd_config_windows.yml" for file_sd in scrape job "jpc_windows" does not exist
-
Restart Prometheus.
Restart Prometheus for the changes to take effect.
(3) Uninstalling SQL exporter
-
Deletes SQL exporter.
To remove SQL exporter, delete the folders you placed in 1.23.4(2)(b) Installing SQL exporter.
(4) Configuring SQL exporter
This section explains how to set SQL exporter.
(a) Adding monitoring targets (required)
■ Preparing to add a target
-
Set the monitoring target in SQL exporter configuration file.
The target of SQL exporter is listed in SQL exporter configuration file (jpc_sql_exporter) (.yml).
For details about SQL exporter configuration file, see SQL exporter configuration file (jpc_sql_exporter) in Chapter 2. Definition Files in the JP1/Integrated Management 3 - Manager Command, Definition File and API Reference.
-
Verify that Microsoft SQL Server you are monitoring has the required permissions assigned to you.
For details about the privileges required, see "Prerequisites for monitoring Microsoft SQL Server in 3.15.1(1)(q) SQL exporter (Microsoft SQL Server monitoring function) in the JP1/Integrated Management 3 - Manager Overview and System Design Guide.
■ Configuring SQL exporter
-
Shut down SQL exporter servicing.
-
Register the password of the user used to connect to Microsoft SQL Server.
Use jimasecret command. Register the password of the user used to connect to Microsoft SQL Server.
-
For physical host operation
jimasecret-add-key MSSQL.hostname.instance-name.username -s password
-
For logical host operation
jimasecret-add-key MSSQL.hostname.instance-name.username -s password -l shared-folder
For details about jimasecret command, see jimasecret in Chapter 1. Commands in the JP1/Integrated Management 3 - Manager Command, Definition File and API Reference.
-
-
Start SQL exporter servicing.
Start SQL exporter service from Windows management tools service window, etc.
For a cluster configuration, start the service from the cluster software.
-
Confirm that SQL exporter can acquire the performance data.
The following URL can be accessed by using curl commands/browsers to check whether performance data can be obtained.
Http://hostname:20735/metrics
■ The hostname specifies the host on which SQL exporter is running.Configuring Intelligent Integrated Management Base
-
Refresh Intelligent Integrated Management Base tree a few minutes after all services have started.
Generate or import tree data from integrated operation viewer, or execute jddcreatetree command or jddupdatetree command to refresh the tree and check the following:
-
Microsoft SQL Server targets are displayed in Intelligent Integrated Management Base tree.
-
The monitoring target can be selected and displayed as a trend.
-
(b) Change password for connection (optional)
If you change the password for Microsoft SQL Server during operation, you must refresh the password that SQL exporter uses to connect.
-
Shut down SQL exporter.
-
Update the password.
Use jimasecret command to refresh the password of the user used to connect to Microsoft SQL Server.
-
For physical host operation
jimasecret-add-key MSSQL.hostname.instance-name.username -s password
-
For logical host operation
jimasecret-add-key MSSQL.hostname.instance-name.username -s password -l shared-folder
For details about jimasecret command, see jimasecret in Chapter 1. Commands in the JP1/Integrated Management 3 - Manager Command, Definition File and API Reference.
-
-
Start SQL exporter.
(c) Delete a monitored target (optional)
■ Configuring SQL exporter
- To delete some monitoring targets
-
Shut down SQL exporter.
-
Delete a password.
Use jimasecret command to remove the password of the user used to connect to Microsoft SQL Server.
-
For physical host operation
jimasecret-rm-key MSSQL.hostname.instance-name.username
-
For logical host operation
jimasecret-rm-key MSSQL.hostname.instance-name.username -l shared-folder
For details about jimasecret command, see jimasecret in Chapter 1. Commands in the JP1/Integrated Management 3 - Manager Command, Definition File and API Reference.
-
-
Deletes the monitored connectivity from SQL exporter configuration file.
Removes SQL exporter monitored connectivity from SQL exporter configuration file (jpc_sql_exporter).
For details about SQL exporter configuration file, see SQL exporter configuration file (jpc_sql_exporter) in Chapter 2. Definition Files in the JP1/Integrated Management 3 - Manager Command, Definition File and API Reference.
-
Start SQL exporter.
- To delete all monitoring targets
-
Shut down SQL exporter.
-
Deregister a service.
Unregister the service by executing the following command.
-
For physical host operation
sql_exporter_service.exe uninstall
-
For logical host operation
sql_exporter_logical-hostname_service.exe uninstall
In the case of logical host operation, it must be executed on both nodes of the cluster.
-
-
Deletes the password for the user used to connect to Microsoft SQL Server.
-
For physical host operation
jimasecret-rm-key MSSQL.hostname.instance-name.username
-
For logical host operation
jimasecret-rm-key MSSQL.hostname.instance-name.username -l shared-folder
For details about jimasecret command, see jimasecret in Chapter 1. Commands in the JP1/Integrated Management 3 - Manager Command, Definition File and API Reference.
If you have registered passwords for more than one Microsoft SQL Server user, perform the same procedure for all users.
-
(d) Configure SQL exporter alive monitoring (optional)
You can monitor SQL exporter service-alive monitoring with up metric on Prometheus server. The following is an example of how to monitor SQL exporter in the alert-definition.
groups:
- name: exporter_healthcheck
rules:
- alert: jp1_pc_exporter_healthcheck
expr: up{jp1_pc_remote_monitor_instance=""} == 0 or label_replace(up{jp1_pc_exporter="JPC SQL exporter"}, "jp1_pc_nodelabel", "${1}", "jp1_pc_remote_monitor_instance", "^[^:]*:([^:]*)$") == 0 or label_replace(up{jp1_pc_remote_monitor_instance!="", jp1_pc_exporter!="JPC SQL exporter"}, "jp1_pc_nodelabel", "${1}", "jp1_pc_remote_monitor_instance", "^[^:]*:([^:]*)$") == 0
for: 3m
labels:
jp1_pc_product_name: "/HITACHI/JP1/JPCCS2"
jp1_pc_component: "/HITACHI/JP1/JPCCS/CONFINFO"
jp1_pc_severity: "Error"
jp1_pc_metricname: "up"
annotations:
jp1_pc_firing_description: "Communication to Exporter failed. instance={{ $labels.instance }}"
jp1_pc_resolved_description: "Communication to Exporter successful. instance={{ $labels.instance }}"(e) Modifying Users for Connections (Optional)
-
Add a new person to Microsoft SQL Server.
Perform this procedure only if a new monitoring user is required and not registered.
-
Shut down SQL exporter.
-
Delete the password of the user before the change.
Use jimasecret command to remove the password of the user who was connecting to Microsoft SQL Server.
-
For physical host operation
jimasecret-rm-key MSSQL.hostname.instance-name.old-username
-
For logical host operation
jimasecret-rm-key MSSQL.hostname.instance-name.old-username -l shared-folder
For details about jimasecret command, see jimasecret in Chapter 1. Commands in the JP1/Integrated Management 3 - Manager Command, Definition File and API Reference.
-
-
Register the password of the user after change.
Use jimasecret command. Register the password of the user used to connect to Microsoft SQL Server.
-
For physical host operation
jimasecret-add-key MSSQL.hostname.instance-name.new-username -s password
-
For logical host operation
jimasecret-add-key MSSQL.hostname.instance-name.new-username -s password -l shared-folder
For details about jimasecret command, see jimasecret in Chapter 1. Commands in the JP1/Integrated Management 3 - Manager Command, Definition File and API Reference.
-
-
Change the username of the connection-information described in SQL exporter configuration file.
Removes the username for SQL exporter connectivity from SQL exporter configuration file (jpc_sql_exporter).
For details about SQL exporter configuration file, see SQL exporter configuration file (jpc_sql_exporter) in Chapter 2. Definition Files in the JP1/Integrated Management 3 - Manager Command, Definition File and API Reference.
-
Start SQL exporter.
-
Deletes the previous person from Microsoft SQL Server.
If the old user is not needed, remove the old user from Microsoft SQL Server.
(5) Troubleshooting SQL exporter Building
- Metrics are not available after SQL exporter has been configured.
After performing the procedure of 1.23.4(4)(a) Adding monitoring targets (required), the following shows what to check when the value of the metric cannot be obtained and how to target it.
|
Check details |
Corrective action |
See... |
|---|---|---|
|
Are the monitored Microsoft SQL Server's services and instance running? |
Start the monitored Microsoft SQL Server servicesand instance. |
None |
|
Are the permissions of the user used to connect to the monitored Microsoft SQL Server set correctly? |
Grant the correct permissions to the user you want to use to connect. |
Prerequisites for monitoring Microsoft SQL Server in 3.15.1(1)(q) SQL exporter (Microsoft SQL Server Monitoring Feature in the JP1/Integrated Management 3 - Manager Overview and System Design Guide |
|
Is the password for the user used to connect to the monitored Microsoft SQL Server registered? |
Register the password of the user used for connection. |
None |
|
Is the error log displayed in SQL-exporter-location\sql_exporter_windows\jp1ima\logs folder? If an error log is output, is there a remedy described in the explanation of the reference destination? |
Perform the action described in the reference. |
12.5.1 (14) sql_exporter Logging in the JP1/Integrated Management 3 - Manager Administration Guide |
(6) Cluster environment
SQL exporter must also be logical host operation if scrape of JP1/IM - Agent is logical host operation.