Skip to main content

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.

Note: After the agent is installed, no configuration is required for SQL Server monitoring; the system will automatically detect SQL Server.

Kubernetes Monitoring Configuration

After installing the Kubernetes agent, you need to add the agent information to the control console.

  1. In the left navigation bar, select Infrastructure > Configuration > Instance Management, then click the Kubernetes tab at the top of the page.
  2. In the upper right corner of the Kubernetes cluster list page, click the Add button.
  3. Fill in the cluster name, business system, deployment environment, and the IP and port of the Prometheus exporter.
  4. Click Confirm 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.

Enable 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.

Configure in the Dashboard

  1. In the left navigation bar, select Infrastructure > Configuration > Instance Management, then click the Apache tab at the top of the page.
  2. In the upper right corner of the Apache instance management page, click the Add button.
  3. Fill in the instance name, instance IP, instance port, and StatusPath. Select the business system and agent (exporter) IP address for the instance.
  4. Click Confirm 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.

Add 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.

Configure in the Dashboard

  1. In the left navigation bar, select Infrastructure > Configuration > Instance Management, then click the Nginx tab at the top of the page.
  2. In the upper right corner of the Nginx instance management page, click the Add button.
  3. Fill in the instance name, instance IP, instance port, and StatusPath. Select the business system and agent (exporter) IP address for the instance.
  4. Click Confirm to complete the addition of the Nginx instance.

Redis Monitoring Configuration

  1. In the left navigation bar, select Infrastructure > Configuration > Instance Management, then click the Redis tab at the top of the page.
  2. In the upper right corner of the Redis instance management page, click the Add button.
  3. Fill in the instance name, instance IP, instance port, and password. Select the business system and agent (exporter) IP address for the instance.
  4. Click Confirm to complete the addition of the Redis instance.

MySQL Monitoring Configuration

Create 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';

Configure in the Dashboard

  1. In the left navigation bar, select Infrastructure > Configuration > Instance Management, then click the MySQL tab at the top of the page.
  2. In the upper right corner of the MySQL instance management page, click the Add button.
  3. Fill in the instance name, instance IP, instance port, account, and password. Select the business system and agent (exporter) IP address for the instance.
  4. Click Confirm to complete the addition of the MySQL instance.

Oracle Monitoring Configuration

Create 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;

Configure in the Dashboard

  1. In the left navigation bar, select Infrastructure > Configuration > Instance Management, then click the Oracle tab at the top of the page.
  2. In the upper right corner of the Oracle instance management page, click the Add button.
  3. 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.
  4. Click Confirm to complete the addition of the Oracle instance.

PostgreSQL Monitoring Configuration

Create 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;

Configure in the Dashboard

  1. In the left navigation bar, select Infrastructure > Configuration > Instance Management, then click the PostgreSQL tab at the top of the page.
  2. In the upper right corner of the PostgreSQL instance management page, click the Add button.
  3. Fill in the instance name, instance IP, instance port, account, and password. Select the business system and agent (exporter) IP address for the instance.
  4. Click Confirm to complete the addition of the PostgreSQL instance.

MongoDB Monitoring Configuration

Create 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" }
]
})

Configure in the Dashboard

  1. In the left navigation bar, select Infrastructure > Configuration > Instance Management, then click the MongoDB tab at the top of the page.
  2. In the upper right corner of the MongoDB instance management page, click the Add button.
  3. Fill in the instance name, instance IP, instance port, account, and password. Select the business system and agent (exporter) IP address for the instance.
  4. Click Confirm to complete the addition of the MongoDB instance.