Component Monitoring Configuration
After UniAgent installation is complete, exporters for various components are also installed. Each type of exporter is used to monitor the corresponding component. To monitor specific components, you also need to configure monitoring in the control console.
After the agent is installed, no monitoring configuration is required for SQL Server; the system automatically discovers SQL Server.
Kubernetes Monitoring Configuration
After installing the Kubernetes agent, you need to add the agent information to the control console.
- In the left navigation bar, click All Apps, then click Settings in the lite app list.
- In the left navigation bar of the settings page, select Instance Management, then click the Kubernetes tab at the top of the page.
- In the upper right corner of the Kubernetes instance management page, click Create.
- Fill in the cluster name, business system, deployment environment, and the IP and port of the Prometheus exporter.
- Click OK to complete the addition of Kubernetes cluster monitoring.
Apache HTTP Server Monitoring Configuration
To monitor Apache HTTP Server, you need to enable the Apache mod_status module and then add Apache HTTP Server in the dashboard.
Enabling Apache mod_status Module
To enable the mod_status module, add the following configuration to the httpd.conf file of the Apache server:
ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 10.128.1.5
# Change the IP here to the tingyun-infra-collector address
</Location>
After making changes, restart the Apache service. Assuming the Apache server IP is 10.128.1.10, the monitoring status page address is http://10.128.1.10/server-status.
Adding Monitoring Instance
- In the left navigation bar, click All Apps, then click Settings in the lite app list.
- In the left navigation bar of the settings page, select Instance Management, then click the Apache tab at the top of the page.
- In the upper right corner of the Apache instance management page, click Create.
- Fill in the instance name, instance IP, instance port, and StatusPath. Select the business system and agent (exporter) IP address for the instance.
- Click OK to complete the addition of the Apache instance.
Nginx Monitoring Configuration
To monitor Nginx, you need to add the stub_status module to Nginx and then add Nginx monitoring in the dashboard.
Adding Nginx stub_status Module
By default, Nginx is not installed with the stub_status module. When compiling, add the following parameter:
--with-http_stub_status_module
You can check if it is supported by running nginx -V.
After adding, edit nginx.conf to enable stub_status:
http {
server {
listen 80;
server_name localhost;
location / {
root html;
index index.html index.htm;
}
location /nginx-status {
stub_status on;
access_log off;
}
}
}
After making changes, restart the Nginx service. Assuming the Nginx server IP is 10.128.1.10, the monitoring status page address is http://10.128.1.10/nginx-status.
Adding Monitoring Instance
- In the left navigation bar, click All Apps, then click Settings in the lite app list.
- In the left navigation bar of the settings page, select Instance Management, then click the Nginx tab at the top of the page.
- In the upper right corner of the Nginx instance management page, click Create.
- Fill in the instance name, instance IP, instance port, and StatusPath. Select the business system and agent (exporter) IP address for the instance.
- Click OK to complete the addition of the Nginx instance.
Redis Monitoring Configuration
- In the left navigation bar, click All Apps, then click Settings in the lite app list.
- In the left navigation bar of the settings page, select Instance Management, then click the Redis tab at the top of the page.
- In the upper right corner of the Redis instance management page, click Create.
- Fill in the instance name, instance IP, instance port, and password. Select the business system and agent (exporter) IP address for the instance.
- Click OK to complete the addition of the Redis instance.
MySQL Monitoring Configuration
Creating a Monitoring User
For security, it is recommended to create a dedicated monitoring user. Log in to MySQL and execute:
CREATE USER 'tingyun'@'mysql_agent_ip' IDENTIFIED BY 'your_password';
GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'tingyun'@'mysql_agent_ip';
GRANT DROP ON performance_schema.events_statements_summary_global_by_event_name TO 'tingyun'@'mysql_agent_ip';
Adding Monitoring Instance
- In the left navigation bar, click All Apps, then click Settings in the lite app list.
- In the left navigation bar of the settings page, select Instance Management, then click the MySQL tab at the top of the page.
- In the upper right corner of the MySQL instance management page, click Create.
- Fill in the instance name, instance IP, instance port, account, and password. Select the business system and agent (exporter) IP address for the instance.
- Click OK to complete the addition of the MySQL instance.
Oracle Monitoring Configuration
Creating a Monitoring User
For security, it is recommended to create a dedicated monitoring user. Log in to Oracle and execute:
create user tingyun identified by your_password;
grant connect to tingyun ;
grant resource to tingyun ;
GRANT UNLIMITED TABLESPACE TO tingyun;
GRANT SELECT ANY DICTIONARY TO tingyun;
Adding Monitoring Instance
- In the left navigation bar, click All Apps, then click Settings in the lite app list.
- In the left navigation bar of the settings page, select Instance Management, then click the Oracle tab at the top of the page.
- In the upper right corner of the Oracle instance management page, click Create.
- Fill in the instance name, instance IP, instance port, service_name, account, and password. Select the business system and agent (exporter) IP address for the instance.
- Click OK to complete the addition of the Oracle instance.
PostgreSQL Monitoring Configuration
Creating a Monitoring User
For security and traceability, create a dedicated user for monitoring data collection:
CREATE USER postgres_exporter;
ALTER USER postgres_exporter WITH PASSWORD 'your_password';
ALTER USER postgres_exporter SET SEARCH_PATH TO postgres_exporter,pg_catalog;
CREATE SCHEMA IF NOT EXISTS postgres_exporter;
GRANT USAGE ON SCHEMA postgres_exporter TO postgres_exporter;
GRANT CONNECT ON DATABASE postgres TO postgres_exporter;
CREATE OR REPLACE FUNCTION get_pg_stat_activity() RETURNS SETOF pg_stat_activity AS
$$ SELECT * FROM pg_catalog.pg_stat_activity; $$
LANGUAGE sql
VOLATILE
SECURITY DEFINER;
CREATE OR REPLACE VIEW postgres_exporter.pg_stat_activity
AS
SELECT * from get_pg_stat_activity();
GRANT SELECT ON postgres_exporter.pg_stat_activity TO postgres_exporter;
CREATE OR REPLACE FUNCTION get_pg_stat_replication() RETURNS SETOF pg_stat_replication AS
$$ SELECT * FROM pg_catalog.pg_stat_replication; $$
LANGUAGE sql
VOLATILE
SECURITY DEFINER;
CREATE OR REPLACE VIEW postgres_exporter.pg_stat_replication
AS
SELECT * FROM get_pg_stat_replication();
GRANT SELECT ON postgres_exporter.pg_stat_replication TO postgres_exporter;
Adding Monitoring Instance
- In the left navigation bar, click All Apps, then click Settings in the lite app list.
- In the left navigation bar of the settings page, select Instance Management, then click the PostgreSQL tab at the top of the page.
- In the upper right corner of the PostgreSQL instance management page, click Create.
- Fill in the instance name, instance IP, instance port, account, and password. Select the business system and agent (exporter) IP address for the instance.
- Click OK to complete the addition of the PostgreSQL instance.
MongoDB Monitoring Configuration
Creating a Monitoring User
For security and traceability, create a dedicated user for monitoring data collection.
- For sharded cluster monitoring, execute the following on mongos, configServer, and each shard (choose any replica set instance for configServer and shard):
- For replica set monitoring, choose any instance in the replica set to execute.
- For standalone monitoring, execute directly on the standalone instance.
db.createRole({
role: "explainRole",
privileges: [{
resource: {
db: "",
collection: ""
},
actions: [
"listIndexes",
"listCollections",
"dbStats",
"dbHash",
"collStats",
"find"
]
}],
roles:[]
})
db.getSiblingDB("admin").createUser({
user: "tingyun",
pwd: "your_password",
roles: [
{ role: "explainRole", db: "admin" },
{ role: "clusterMonitor", db: "admin" },
{ role: "read", db: "local" }
]
})
Adding Monitoring Instance
- In the left navigation bar, click All Apps, then click Settings in the lite app list.
- In the left navigation bar of the settings page, select Instance Management, then click the MongoDB tab at the top of the page.
- In the upper right corner of the MongoDB instance management page, click Create.
- Fill in the instance name, instance IP, instance port, account, and password. Select the business system and agent (exporter) IP address for the instance.
- Click OK to complete the addition of the MongoDB instance.
Kingbase Monitoring Configuration
Compatibility
- Kingbase: V8R6+, V9+
- Collector: 4.3.1 or later
Creating a Monitoring User
For security and the principle of least privilege, create a read-only account in Kingbase and grant read-only permissions. This account is used only for collecting monitoring data.
Run the following command using ksql (the following is only sample data; please modify according to your actual situation):
CREATE USER kingbase_exporter WITH PASSWORD 'your_password';
Parameters:
kingbase_exporter: Read-only user. You can customize the name. If you change it, updatekingbase_exporterin all subsequent commands accordingly.your_password: Replace it with a strong password.
Granting Monitoring Permissions
Run the following authorization commands using ksql (the following is only sample data; please modify according to your actual situation):
-- Try granting the native KingbaseES monitoring role. If it does not exist, fall back to the PG-compatible role.
DO $$
BEGIN
-- Try sys_monitor (recommended for KingbaseES V8R6+)
BEGIN
EXECUTE 'GRANT sys_monitor TO kingbase_exporter';
RAISE NOTICE 'Successfully granted sys_monitor to kingbase_exporter.';
EXCEPTION WHEN undefined_object THEN
-- Fall back to pg_monitor (compatible with older versions or PG mode)
BEGIN
EXECUTE 'GRANT pg_monitor TO kingbase_exporter';
RAISE NOTICE 'Successfully granted pg_monitor to kingbase_exporter (sys_monitor not found).';
EXCEPTION WHEN undefined_object THEN
RAISE WARNING 'Neither sys_monitor nor pg_monitor exists. Manual grants may be required.';
END;
END;
END $$;
If the ksql output contains Successfully, the grant is successful. Otherwise, you need to grant permissions manually.
Enabling the sys_stat_statements Plugin
The sys_stat_statements plugin is a KingbaseES extension that provides statistics on executed SQL statements on the server side. It helps database administrators analyze and optimize performance, especially for identifying TOP SQL and analyzing query performance overhead.
Modifying sys_stat_statements Configuration
The plugin is disabled by default. Modify the configuration file kingbase.conf and set:
sys_stat_statements.track = 'top'
Also make sure shared_preload_libraries includes sys_stat_statements, and sys_stat_statements.track is set to 'top'. For example (the following is only sample data; actual settings may differ):
shared_preload_libraries = 'sys_kwr,sys_stat_statements,auto_bmr'
sys_stat_statements.max = 10000
sys_stat_statements.track = 'top'
- If the plugin is disabled, restart Kingbase after modifying
kingbase.conf. - If the plugin is already enabled, no further action is required.
Checking sys_stat_statements Status
SHOW shared_preload_libraries;
SELECT * FROM sys_settings WHERE name LIKE '%statements%';
Firewall Policy
To ensure the Collector can access the Kingbase instance, contact your operations team to allow network access from Collector to Kingbase (Collector IP → Kingbase IP:port).
Confirming the Kingbase Database Name
By default, Collector connects to the test database in Kingbase. If the test database does not exist, set the TINGYUN_KINGBASE_DB environment variable to a valid database name.
For a standard Collector deployment, edit COLLECTOR_PATH/conf/env.txt and add:
TINGYUN_KINGBASE_DB=your_database_name
For a Collector deployed on Kubernetes, update the YAML and add an environment variable to the tingyun-collector StatefulSet:
- name: TINGYUN_KINGBASE_DB
value: "your_database_name"
Adding Monitoring Instance
- In the left navigation bar, click All Apps, then click Settings in the lite app list.
- In the left navigation bar of the settings page, select Instance Management, then click the Kingbase tab at the top of the page.
- In the upper right corner of the Kingbase instance management page, click Create.
- Fill in the instance name, permission group, agent list, monitoring account, password, and instance information:
- Role group: Set a permission group tag for the instance.
- Agent list: Select the Collector used to pull monitoring data.
- IP/Port: Enter the IP address and access port of the Kingbase database.
- User/Password: Enter the username and password of the monitoring user.
- Entity list: Enter the IP address and port of the instance nodes. Domain names are supported.
- Click OK to complete the addition of the Kingbase instance.