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