一 、Golang编译器离线安装
1.解压缩文件
tar -C /usr/local -xzf go1.x.x.linux-amd64.tar.gz
2.配置环境变量并生效
vi /etc/profile export PATH=$PATH:/usr/local/go/bin export GOPATH=/your/gopath # 可选,如果您需要设置 GOPATH source /etc/profile
二、Opensatck exporter 安装
1.解压缩 openstack exporter go程序包
下载原地址:GitHub - openstack-exporter/openstack-exporter: OpenStack Exporter for Prometheus
unzip -zxvf openstack-exporter-main.zip
2.编写node_exporter运行的配置文件
官方示例:
vim /etc/openstack/clouds.yaml clouds: default: region_name: {{ openstack_region_name }} //default identity_api_version: 3 identity_interface: internal auth: username: {{ keystone_admin_user }} //keystone password: {{ keystone_admin_password }} project_name: {{ keystone_admin_project }} project_domain_name: 'Default' project_domain_id: 'Default' // This can replace "project_domain_name" user_domain_name: 'Default' auth_url: {{ admin_protocol }}://{{ kolla_internal_fqdn }}:{{ keystone_admin_port }}/v3 cacert: | ---- BEGIN CERTIFICATE --- ... verify: true | false // disable || enable SSL certificate verification
测试示例:
clouds: default: region_name: RegionOne interface: public identity_api_version: 3 auth: auth_url: http://controller/v3 username: admin password: 000000 project_name: admin user_domain_name: 'Default' project_domain_name: 'Default' verify: true
3.构建可执行文件本地运行:(注:得有golang环境)
go build -o ./openstack-exporter .
3.1多云模式
./openstack-exporter --os-client-config /etc/openstack/clouds.yaml --multi-cloud curl "http://localhost:9180/probe?cloud=region.mycludprovider.org"
3.2传统模式
./openstack-exporter --os-client-config /etc/openstack/clouds.yaml myregion.cloud.org /*注意:myregion.cloud.org 是opensatck云项目的名称或者id 这个id 的查询方法是 openstack cloud list 命令,但是如果没有修改,一般是default curl "http://localhost:9180/metrics" +
4.使用 docker 镜像运行:
docker run -v "$HOME/.config/openstack/clouds.yml":/etc/openstack/clouds.yaml -it -p 9180:9180 \ghcr.io/openstack-exporter/openstack-exporter:latest curl "http://localhost:9180/probe?cloud=my-cloud.org"
安装包下载:
(1)Golang下载:下载Go - Go中文网 Go语言中文网 golang (p2hp.com)
(2)grafana面板:OpenStack overview | Grafana Labs
(3)Grafana下载:Index of grafana-local (huaweicloud.com)
grafana推荐版本:https://mirrors.huaweicloud.com/grafana/9.5.18/grafana-enterprise-9.5.18.linux-amd64.tar.gz