〇Prometheusの画面
ブラウザからhttp://192.168.1.107:9090/にアクセスします。
〇構築方法
以下のVagrantfileを使用して、Prometheusをインストールした仮想マシン(CentOS7.5)を構築します。
Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/centos-7.5"
config.vm.hostname = "co75prometheus"
config.vm.network :public_network, ip:"192.168.1.107"
config.vm.network "private_network", ip: "192.168.55.107", :netmask => "255.255.255.0"
config.vm.provider :virtualbox do |vbox|
vbox.name = "co75prometheus"
vbox.cpus = 4
vbox.memory = 4096
vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
end
config.vm.provision "shell", inline: <<-SHELL
localectl set-locale LANG=ja_JP.UTF-8
# download and install prometheus
wget https://github.com/prometheus/prometheus/releases/download/v2.3.2/prometheus-2.3.2.linux-amd64.tar.gz
tar xvfz prometheus-2.3.2.linux-amd64.tar.gz
mv prometheus-2.3.2.linux-amd64 /opt
cat << EOF > /etc/systemd/system/prometheus.service
[Unit]
Description=Prometheus
Requires=network.target
[Service]
Restart=always
WorkingDirectory=/opt/prometheus-2.3.2.linux-amd64
ExecStart=/opt/prometheus-2.3.2.linux-amd64/prometheus --config.file=prometheus.yml
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target
EOF
systemctl enable prometheus
systemctl start prometheus
echo 'access -> http://192.168.1.107:9090/'
SHELL
end
0 件のコメント:
コメントを投稿