1.安装smokeping软件
sudo apt-get install smokeping -y
2.编辑smokeping配置文件,不发送报警邮件。如有需要,可以后续添加。
sudo vim /etc/smokeping/config.d/pathnames
#sendmail = /usr/sbin/sendmail
sudo nano /etc/smokeping/config.d/General
cgiurl = http://your-ip/cgi-bin/smokeping.cgi
3.编辑apache配置文件。
sudo vim /etc/apache2/conf-available/serve-cgi-bin.conf
<IfModule mod_alias.c>
<IfModule mod_cgi.c>
Define ENABLE_USR_LIB_CGI_BIN
</IfModule>
<IfModule mod_cgid.c>
Define ENABLE_USR_LIB_CGI_BIN
</IfModule>
<IfDefine ENABLE_USR_LIB_CGI_BIN>
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Require all granted
</Directory>
ScriptAlias /smokeping/smokeping.cgi /usr/lib/cgi-bin/smokeping.cgi
Alias /smokeping /usr/share/smokeping/www
<Directory “/usr/share/smokeping/www”>
Options FollowSymLinks
</Directory>
</IfDefine>
</IfModule>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
4.重启cgi,apache,smokeping
sudo a2enmod cgi
sudo service apache2 restart
sudo service smokeping restart
5.总结
笔者亲测使用centos部署相当麻烦,依赖包都需要十几个。用ubuntu部署smokeping,只需要几行命令就可以搞定。