激情久久久_欧美视频区_成人av免费_不卡视频一二三区_欧美精品在欧美一区二区少妇_欧美一区二区三区的

服務(wù)器之家:專注于服務(wù)器技術(shù)及軟件下載分享
分類導(dǎo)航

Mysql|Sql Server|Oracle|Redis|MongoDB|PostgreSQL|Sqlite|DB2|mariadb|Access|數(shù)據(jù)庫技術(shù)|

服務(wù)器之家 - 數(shù)據(jù)庫 - Oracle - 一文聊聊如何快速監(jiān)控 Oracle 數(shù)據(jù)庫

一文聊聊如何快速監(jiān)控 Oracle 數(shù)據(jù)庫

2024-01-01 07:15未知服務(wù)器之家 Oracle

安裝配置 Oracle 簡單起見,我使用 Docker 啟動 Oracle,命令如下: docker run -d --name oracle -p 1022:22 -p 18080:8080 -p 1521:1521 wnameless/oracle-xe-11g-r2 如上命令啟動之后,Oracle 的監(jiān)聽端口是 1521,用戶名/密碼是 system/oracle,數(shù)據(jù)庫 SID 是 xe,要監(jiān)

安裝配置 Oracle

簡單起見,我使用 Docker 啟動 Oracle,命令如下:

docker run -d --name oracle -p 1022:22 -p 18080:8080 -p 1521:1521 wnameless/oracle-xe-11g-r2

如上命令啟動之后,Oracle 的監(jiān)聽端口是 1521,用戶名/密碼是 system/oracle,數(shù)據(jù)庫 SID 是 xe,要監(jiān)控 Oracle,首先得有賬號連上去執(zhí)行 SQL,所以這些連接信息得記住嘍,待會要用。

如果是對既有的 Oracle 做監(jiān)控,需要創(chuàng)建賬號并分派權(quán)限,比如:

-- Create the monitoring user "cprobe"
CREATE USER cprobe IDENTIFIED BY <YOUR-PASSWORD>;

-- Grant the "cprobe" user the required permissions
GRANT CONNECT TO cprobe;
GRANT SELECT ON SYS.GV_$RESOURCE_LIMIT to cprobe;
GRANT SELECT ON SYS.V_$SESSION to cprobe;
GRANT SELECT ON SYS.V_$WAITCLASSMETRIC to cprobe;
GRANT SELECT ON SYS.GV_$PROCESS to cprobe;
GRANT SELECT ON SYS.GV_$SYSSTAT to cprobe;
GRANT SELECT ON SYS.V_$DATAFILE to cprobe;
GRANT SELECT ON SYS.V_$ASM_DISKGROUP_STAT to cprobe;
GRANT SELECT ON SYS.V_$SYSTEM_WAIT_CLASS to cprobe;
GRANT SELECT ON SYS.DBA_TABLESPACE_USAGE_METRICS to cprobe;
GRANT SELECT ON SYS.DBA_TABLESPACES to cprobe;
GRANT SELECT ON SYS.GLOBAL_NAME to cprobe;

安裝 Cprobe

Cprobe 是一個探針采集器,支持常見數(shù)據(jù)庫、中間件的采集,比如 MySQL、Redis、MongoDB、Oracle、Kafka、ElasticSearch 等,最新版本是 v0.7.1,我們從 github releases 頁面下載:

https://github.com/cprobe/cprobe/releases/tag/v0.7.1

我是 arm 的 linux,所以下載的是 cprobe-v0.7.1-linux-arm64.tar.gz,如果你是 x86 的,應(yīng)該下載 amd64 那個包。如果你從 github 下載有困難,我這里提供一個國內(nèi)的下載地址:

http://www.zmynmublwnt.cn/uploads/allimg/fzjawkwdax0.gz
https://download.flashcat.cloud/cprobe-v0.7.1-linux-amd64.tar.gz

解壓縮進入對應(yīng)目錄,執(zhí)行 install 和 start 命令即可:

./cprobe -install
./cprobe -start
./cprobe -status

安裝完成。

配置 Cprobe 采集

首先配置要采集的 Oracle 的地址,進入剛才 cprobe 解壓出的目錄,編輯 conf.d/oracledb/main.yaml,修改如下:

global:
  scrape_interval: 15s
  external_labels:
    cplugin: 'oracle'

scrape_configs:
- job_name: 'oracle'
  static_configs:
  - targets:
    - 10.99.1.107:1521/xe # ip:port/service
  scrape_rule_files:
  - 'link.toml'
  - 'comm.toml'

上面的 IP 是我的 Oracle 的 IP,你要根據(jù)你的環(huán)境做調(diào)整。這個 main.yaml 又引用了 link.toml 和 comm.toml,在 link.toml 中配置認(rèn)證信息,比如:

[global]
username = "system"
password = "oracle"
options = {}

comm.toml 的內(nèi)容不用動。監(jiān)控 Oracle 的原理就是連上去執(zhí)行一堆 SQL,comm.toml 中提前幫你準(zhǔn)備好了一堆 SQL,其實還有 cust.toml 有更多 SQL,看你需求,如果 cust.toml 中的監(jiān)控項你也需要,那就把 cust.toml 也配置到 main.yaml 中,如下:

global:
  scrape_interval: 15s
  external_labels:
    cplugin: 'oracle'

scrape_configs:
- job_name: 'oracle'
  static_configs:
  - targets:
    - 10.99.1.107:1521/xe # ip:port/service
  scrape_rule_files:
  - 'link.toml'
  - 'comm.toml'
  - 'cust.toml'

下面我們測試一下,看看是否真的能夠采集到數(shù)據(jù):

./cprobe -no-writer -no-httpd -plugins oracledb

正常來講,會輸出很多指標(biāo),類似下面這樣:

./cprobe -no-writer -no-httpd -plugins oracledb
2023-12-25T10:27:33.868Z        info    /Users/ulric/works/cprobe/lib/logger/flag.go:12 build version: 0.0.1-2023-12-25-08-39-11
2023-12-25T10:27:33.868Z        info    /Users/ulric/works/cprobe/lib/logger/flag.go:13 command-line flags
2023-12-25T10:27:33.868Z        info    /Users/ulric/works/cprobe/lib/logger/flag.go:20   -no-httpd="true"
2023-12-25T10:27:33.868Z        info    /Users/ulric/works/cprobe/lib/logger/flag.go:20   -no-writer="true"
2023-12-25T10:27:33.868Z        info    /Users/ulric/works/cprobe/lib/logger/flag.go:20   -plugins="oracledb"
2023-12-25T10:27:33.868Z        info    /Users/ulric/works/cprobe/lib/runner/runner.go:25       hostname: ulric-flashcat.local
2023-12-25T10:27:33.868Z        info    /Users/ulric/works/cprobe/lib/runner/runner.go:26       runtime.fd_limits: (soft=61440, hard=unlimited)
2023-12-25T10:27:33.868Z        info    /Users/ulric/works/cprobe/lib/runner/runner.go:27       runtime.vm_limits: (soft=unlimited, hard=unlimited)
>> __name__=oracledb_sessions_value cplugin=oracle instance=10.99.1.107:1521/xe job=oracle status=ACTIVE type=BACKGROUND  1703500053881 22.000000
>> __name__=oracledb_sessions_value cplugin=oracle instance=10.99.1.107:1521/xe job=oracle status=ACTIVE type=USER  1703500053881 1.000000
>> __name__=oracledb_resource_current_utilization cplugin=oracle instance=10.99.1.107:1521/xe job=oracle resource_name=processes  1703500053881 29.000000
>> __name__=oracledb_resource_limit_value cplugin=oracle instance=10.99.1.107:1521/xe job=oracle resource_name=processes  1703500053881 100.000000
...

上面的各個參數(shù)的含義:

  • -no-writer 表示不寫入 TSDB,只是輸出到控制臺
  • -no-httpd 表示 Cprobe 不啟動 HTTP 服務(wù)
  • -plugins oracledb 表示只啟動 oracledb 插件,如果你還想啟動其他插件,可以用逗號分隔,比如 -plugins oracledb,mysql,redis,如果想啟動所有插件,就不加 -plugins 參數(shù)即可,默認(rèn)就是啟動所有插件

配置 Cprobe 寫入 TSDB

監(jiān)控數(shù)據(jù)采集到之后,需要寫入 TSDB,Cprobe 在 conf.d 目錄下提供 writer.yaml 配置文件,把其中 writers.url 部分改成你自己的時序庫的 remote write 地址即可。

  • 如果時序庫是 Prometheus,url 通常是:http://IP:9090/api/v1/write
  • 如果時序庫是單機版本的 VictoriaMetrics,url 通常是:http://IP:8428/api/v1/write
  • 如果時序庫是集群版本的 VictoriaMetrics,url 通常是:http://IP:8480/insert/0/prometheus/api/v1/write
  • 如果想把數(shù)據(jù)直接推給夜鶯,url 通常是:http://IP:17000/prometheus/v1/write

配置完成之后,重啟 Cprobe 即可:

./cprobe -restart

writer.yaml 的改動需要重啟 Cprobe 才能生效。如果是修改各個插件目錄下的配置,改完之后發(fā)給 HUP 信號給 Cprobe,Cprobe 會自動 reload 配置,不需要重啟。比如:

kill -HUP `pidof cprobe`

儀表盤

筆者整理了 Oracle 的 Grafana 儀表盤,分享給大家,不過 Oracle 的指標(biāo)都是通過配置文件自定義 SQL 采集的,指標(biāo)差別可能比較大,這個儀表盤只能是僅供參考了:

https://github.com/cprobe/cprobe/blob/main/conf.d/oracledb/doc/dash/grafana_oracledb_01.json

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 三人弄娇妻高潮3p视频 | 欧美激情999 | 成年人黄色免费网站 | 亚洲婷婷日日综合婷婷噜噜噜 | 中文字幕专区高清在线观看 | 欧美国产免费 | 国产精品一区二区三区99 | 久久毛片 | 国产亚洲精彩视频 | 无码专区aaaaaa免费视频 | 在线成人看片 | 99视频有精品视频高清 | 久久久久成人精品免费播放 | 久久国产28 | av影片在线观看 | 国产日韩精品欧美一区视频 | 日本免费大片免费视频 | 超级av在线 | 九九热视频在线免费观看 | 欧美一级免费视频 | 欧美在线中文字幕 | 欧美一级一区二区三区 | 欧美性videofree精品 | 欧美不卡 | 久久久久久久久久久高潮一区二区 | 午夜国产精品成人 | 青青青在线免费 | 亚洲欧美不卡视频 | 狼人狠狠干 | 日本道中文字幕 | 午夜影视一区二区 | 色妞欧美 | 一区二区三区四区视频在线观看 | 欧美a级理论片 | 国产成人免费高清激情视频 | 极色品影院 | 一级免费黄色免费片 | 久久影院午夜 | 少妇的肉体的满足毛片 | 18欧美性xxxx极品hd | 日日碰日日操 |