linux-dash web监控系统的安装

Linux-dash是一款为Linux设计的基于Web的轻量级监控面板。这个程序会实时显示各种不同的系统属性,比如CPU负载、RAM使用率、磁盘使用率、网速、网络连接、RX/TX带宽、登录用户、运行的进程等等。它不会存储长期的统计。因为它没有后端数据库。其支持PHP, Node.js, Go 做为web展示。这里以php平台进行展示为例,简单了解下其安装和使用。 

一、安装nginx和php 

1、yum源安装相关软件

yum install nginx git php-common php-fpm
<br />

nginx在默认redhat/centos源中不存在,需使用第三方源epel

2、clone linux-dash包

git clone https://github.com/afaqurk/linux-dash.git
sudo cp -r linux-dash/ /var/www/
sudo chown -R www:www /var/www
<br />

二、配置

1、nginx配置

现在我们要在nginx中配置Linux-dash。我们如下创建 /etc/nginx/conf.d/linuxdash.conf,如下:

# vim /etc/nginx/conf.d/linuxdash.conf
server {
        listen          80;
        server_name    www.361way.com;
        root /var/www;
        index index.php  index.html index.htm;
        location / {
                try_files $uri $uri/ /index.php?$args;
        }
        location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
         access_log off;
         log_not_found off;
         expires max;
        }
  location ~ \.php$ {
    fastcgi_index index.php;
    fastcgi_keep_conn on;
    include fastcgi_params;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  }
}
<br />

2、php-fpm配置

确保设置了如下的“listen”,“user”和“group”字段。你可以保留其它的配置不变。

# vim /etc/php-fpm.d/www.conf
……
listen =127.0.0.1:9000
user = www
group= www
……
<br />

3、配置services

重启 Nginx和php-fpm服务,并配置为开机自启动。

service nginx restart
service php-fpm restart
chkconfig nginx on
chkconfig php-fpm on
<br />

三、使用

你现在可以在浏览器中输入http://linux-dash/来访问Linux-dash。我这里是https://www.361way.com/linux-dash/ ,具体效果如下(点击图片看大图):

&nbsp; &nbsp; &nbsp;<a href="https://www.361way.com/wp-content/uploads/2015/06/linux-dash.png"><img src="https://www.361way.com/wp-content/uploads/2015/06/linux-dash-300x173.png" alt="linux-dash" width="300" height="173" class="alignnone size-medium wp-image-4530" /></a>

更多的可以查看demo页面

四、其他

1、其他web展示平台

除了基于php web 的展示,其还支持node.js、go方式的展示,具体参见linux-dash的git页面 ,使用方法如下:

#node.js平台下
npm install
node server
#go平台下
go run index.go
使用go的二进制方式
go build && ./server -h
<br />

注:从其源码包上来看,其已经在考虑基于python的web展示,具体可以查看python-server.py 文件,不过在使用python python-server.py文件运行查看http://localhost:8081时,发现无法正常防问(基于redhat6 python2.6)。

2、概述

linux-dash由于是基于一种无数据库的方式展示,本身前台展示时依赖于主机的性能,通过server/moudle下的脚本文件取得相应的数据后再在前台展示,所以速度不快。而且也无法查看历史数据 ,相对较鸡肋。从一方面来说,程序相对简洁,一些东西还是值得我们借鉴。

linux-dash web监控系统的安装》有2条评论

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注