○collectdの画面
○構築方法
以下のVagrantfileを使用して、collectdとcollectd-webをインストールした仮想マシン(Ubuntu 18.04)を構築できます。
ブラウザからhttp://192.168.55.107:8080/でcollectd-webにアクセスします。
Vagrantfile
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bento/ubuntu-18.04"
config.vm.hostname = "ub1804collectd"
config.vm.provider :virtualbox do |vbox|
vbox.name = "ub1804collectd"
vbox.cpus = 2
vbox.memory = 2048
vbox.customize ["modifyvm", :id, "--nicpromisc2","allow-all"]
end
config.vm.network "private_network", ip: "192.168.55.107", :netmask => "255.255.255.0"
config.vm.network "public_network", ip:"192.168.1.107", :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
# install collectd
apt-get -y install collectd
systemctl enable collectd.service
systemctl start collectd.service
# install collected-web
apt-get -y install git librrds-perl libjson-perl libhtml-parser-perl libcgi-session-perl
cd /usr/local/
git clone https://github.com/httpdss/collectd-web.git
chmod +x /usr/local/collectd-web/cgi-bin/graphdefs.cgi
cat << EOF > /etc/systemd/system/collectd-web.service
[Unit]
Description=collectd-web
[Service]
Type=simple
ExecStart=/usr/bin/python /usr/local/collectd-web/runserver.py 192.168.55.107 8080
WorkingDirectory=/usr/local/collectd-web
[Install]
WantedBy=multi-user.target
EOF
systemctl enable collectd-web.service
systemctl start collectd-web.service
sleep 10
echo 'access http://192.168.55.107:8080/'
SHELL
end
0 件のコメント:
コメントを投稿