〇Prometheusの画面
ブラウザからhttp://192.168.1.108:9090/にアクセスします。
〇構築方法
以下のVagrantfileを使用して、Prometheusをインストールした仮想マシン(Debian Stretch/9.4)を構築します。
Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/debian-9.4"
config.vm.hostname = "db94prometheus"
config.vm.provider :virtualbox do |vbox|
vbox.name = "db94prometheus"
vbox.cpus = 4
vbox.memory = 4096
vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
end
config.vm.network "private_network", ip: "192.168.55.108", :netmask => "255.255.255.0"
config.vm.network "public_network", ip:"192.168.1.108", :netmask => "255.255.255.0"
config.vm.provision "shell", inline: <<-SHELL
# update packages
apt-get update
#DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
locale-gen ja_JP.UTF-8
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
SHELL
end
0 件のコメント:
コメントを投稿