重庆思庄Oracle、KingBase、PostgreSQL、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 8|回复: 0
打印 上一主题 下一主题

[系统管理] prometheus的sqlserver多套部署脚本与步骤

[复制链接]
跳转到指定楼层
楼主
发表于 3 天前 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
SQLSERVER:

[root@prometheus ~]# more /etc/systemd/system/sql_exporter@.service
[Unit]
Description=SQL Server Exporter for Prometheus
After=network.target

[Service]
User=root
ExecStart=/opt/sql_exporter/sql_exporter --config.file="/opt/sql_exporter/sql_exporter_%i.yml" -web.listen-address=":%i"
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target



[root@prometheus ~]# cd /opt/sql_exporter/
[root@prometheus sql_exporter]# ls -ltr
total 96416
-rwxr-xr-x 1 1001 oracle 98672802 Jun  7 17:27 sql_exporter
-rw-r--r-- 1 1001 oracle    24655 Jun  7 17:27 README.md
-rw-r--r-- 1 1001 oracle     1104 Jun  7 17:27 LICENSE
-rw-r--r-- 1 1001 oracle     1859 Jun 11 10:28 sql_exporter_9400.yml
-rw-r--r-- 1 root root       6495 Jun 11 10:34 mssql_standard.collector.yml.bak
-rw-r--r-- 1 1001 oracle     7344 Jun 11 10:35 mssql_standard.collector.yml
[root@prometheus sql_exporter]# more sql_exporter_9400.yml
# Global defaults.
global:
  # If scrape_timeout <= 0, no timeout is set unless Prometheus provides one. The default is 10s.
  scrape_timeout: 10s
  # Subtracted from Prometheus' scrape_timeout to give us some headroom and prevent Prometheus from timing out first.
  scrape_timeout_offset: 500ms
  # Minimum interval between collector runs: by default (0s) collectors are executed on every scrape.
  min_interval: 0s
  # Maximum number of open connections to any one target. Metric queries will run concurrently on multiple connections,
  # as will concurrent scrapes.
  max_connections: 3
  # Maximum number of idle connections to any one target. Unless you use very long collection intervals, this should
  # always be the same as max_connections.
  max_idle_connections: 3
  # Maximum number of maximum amount of time a connection may be reused. Expired connections may be closed lazily before reuse.
  # If 0, connections are not closed due to a connection's age.
  max_connection_lifetime: 5m
  # Interval between database pings. By default (0s) ping every time when call target.ping().
  ping_interval: 30s

# The target to monitor and the collectors to execute on it.
target:
  # Data source name always has a URI schema that matches the driver name. In some cases (e.g. MySQL)
  # the schema gets dropped or replaced to match the driver expected DSN format.
  data_source_name: 'sqlserver://prometheus:sztech_4U@192.168.77.114:1433/master'

  # Collectors (referenced by name) to execute on the target.
  # Glob patterns are supported (see <https://pkg.go.dev/path/filepath#Match> for syntax).
  collectors: [mssql_*]

# Collector files specifies a list of globs. One collector definition is read from each matching file.
# Glob patterns are supported (see <https://pkg.go.dev/path/filepath#Match> for syntax).
collector_files:
  - "*.collector.yml"




[root@prometheus sql_exporter]# systemctl status sql_exporter@9400.service
sql_exporter@9400.service - SQL Server Exporter for Prometheus
     Loaded: loaded (/etc/systemd/system/sql_exporter@.service; enabled; vendor preset: disabled)
     Active: active (running) since Thu 2026-06-11 11:17:13 CST; 1h 4min ago
   Main PID: 58673 (sql_exporter)
      Tasks: 10 (limit: 21616)
     Memory: 21.5M
     CGroup: /system.slice/system-sql_exporter.slice/sql_exporter@9400.service
             └─ 58673 /opt/sql_exporter/sql_exporter --config.file=/opt/sql_exporter/sql_exporter_9400.yml -web.listen-address=:9400

Jun 11 11:17:13 prometheus systemd[1]: Started SQL Server Exporter for Prometheus.
Jun 11 11:17:13 prometheus sql_exporter[58673]: time=2026-06-11T11:17:13.559+08:00 level=WARN source=main.go:101 msg="Starting SQL exporter" versionInfo="(version=0.24.1, branch=HEAD, revision=266712dd6981639d21eb7e8ab4067c605e37eb9>
Jun 11 11:17:13 prometheus sql_exporter[58673]: time=2026-06-11T11:17:13.566+08:00 level=INFO source=tls_config.go:354 msg="Listening on" address=[::]:9400
Jun 11 11:17:13 prometheus sql_exporter[58673]: time=2026-06-11T11:17:13.566+08:00 level=INFO source=tls_config.go:357 msg="TLS is disabled." http2=false address=[::]:9400

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2026-6-17 19:45 , Processed in 0.293293 second(s), 22 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表