1.理由
顧客のRedHat 7.5サーバーのインストールと展開のグラファナは、プロメテウスデータソースを追加できず、初期パスワードを変更できないため、環境アクセスのセキュリティを確保するために、アカウントとパスワードの認証を通じてプロメテウスにアクセスするための特別な調査が行われているため、Baiduには多くの情報がありますが、不足しています。特定の実装プロセスはここに記録されています:
2つ目は、httpdをインストールしてデプロイすることです。
方法1:yumを使用してインストールする
yum -y install apr apr-util httpd
方法2:ソースコードからインストールする
yum -y install expat-devel gcc gcc-c++ autoreconf libtoolize automake
1.httpdインストールパッケージをダウンロードします
wget http://mirrors.hust.edu.cn/apache/httpd/httpd-2.4.46.tar.gz
2.解凍します
tar zxvf httpd-2.4.46.tar.gz
3.新しいaprおよびapr-utilインストールをダウンロードします(インストールプロセス中にさまざまな奇妙なエラーが発生します。これはBaiduによって解決されますが、ここでは詳しく説明しません)。
wget http://mirror.bit.edu.cn/apache/apr/apr-1.7.0.tar.gz
wget http://mirror.bit.edu.cn/apache/apr/apr-util-1.6.1.tar.gz
4. apr、apr-utilをインストールします
tar -zxvf apr-1.7.0.tar.gz
tar -zxvf apr-util-1.6.1.tar.gz
cd /opt/apr-1.7.0
./configure --prefix=/usr/local/apr && make && make install
cd /opt/apr-util-1.6.1
./configure --prefix=/usr/local/apr-util && make && make install
5.ディレクトリcdhttpd-2.4.46 /を入力します
cd /opt/httpd-2.4.46/
./configure --prefix=/usr/local/apache2/ --enable-rewrite --enable-so --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util
make && make install
3、プロメテウスアクセス認証アカウントのパスワードを作成します
注:パス、ユーザー名、およびパスワードは、実際の環境操作に応じて変更されます(インタラクティブインターフェイスで同じパスワードを2回入力します)
/usr/bin/htpasswd -c /etc/nginx/.htpasswd promethues
4、nginxアクセス構成を構成します
vim /etc/nginx/conf/nginx.conf
location / {
auth_basic "Prometheus";
auth_basic_user_file /etc/nginx/.htpasswd;
proxy_pass http://localhost:9090;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
root html;
index index.html index.htm;
}
/etc/nginx/sbin/nginx -t
/etc/nginx/sbin/nginx -s reload
5つ目は、prometheus.ymlファイルを変更し、基本的な認証認証を構成することです。
1.prometheus.ymlファイルを変更します
vim /usr/local/prometheus/prometheus.yml
- job_name: 'prometheus'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['localhost:9090']
basic_auth:
username: promethues
password: 密码
2.プロメテウスサービスを再起動します
systemctl restart prometheus
systemctl status prometheus
3.prometheusサービスインターフェイスにアクセスします
。4。構成済みのユーザー名と認証パスワードを入力します
。5。ターゲット情報を表示します。