Install vnstat monitoring system traffic tool in centos

Source: Internet
Author: User
Tags chmod diff fpm vars

System: centos 5.9
Required software packages: vnstat-1.11.tar.gz
Vnstat_php_frontend-1.5.1.tar.gz
1. Download vnstat

The code is as follows: Copy code
Wget http://humdi.net/vnstat/vnstat-1.11.tar.gz
Wget http://www.sqweek.com/sqweek/files/vnstat_php_frontend-1.5.1.tar.gz


2. Install vnstat

The code is as follows: Copy code
Yum-y install gcc * make vixie-cron
Tar zxf vnstat-1.11.tar.gz & cd vnstat-1.11
Make
Make install


3. Install vnstat_php_frontend

The code is as follows: Copy code

Tar zxf vnstat_php_frontend-1.5.1.tar.gz
Music vnstat_php_frontend-1.5.1 vnstat
Mv vnstat/var/www/vhosts/wwwroot/


Cat>/var/lib/vnstat/dump. sh <EOF
Vnstat-u-I eth0
Vnstat -- dumpdb-I eth0>/var/lib/vnstat/vnstat_dump_eth0
EOF
Chmod + x/var/lib/vnstat/dump. sh


Vi/etc/crontab
*/3 */bin/sh/var/lib/vnstat/dump. sh
Service crond restart


Use the vnstat daemon

The code is as follows: Copy code

Vnstatd-d


Vi/root/. bashrc
Alias vnstat = "vnstat-I"


Run commands

The code is as follows: Copy code
Alias vnstat = "vnstat-I"
Sh/var/lib/vnstat/dump. sh

Run sh/var/lib/vnstat/dump. sh to report that the eth0 database does not exist, so run sh/var/lib/vnstat/dump. sh again.


4. Configure vnstat_php_frontend
Vi/var/www/vhosts/wwwroot/vnstat/config. php

The code is as follows: Copy code

<? Php
Error_reporting (E_ALL | E_NOTICE );

$ Locale = 'en _ US.UTF-8 ';
$ Language = 'en ';

$ Iface_list = array ('eth0 ');

$ Iface_title ['eth0'] = 'internal ';

$ Vnstat_bin = '/usr/bin/vnstat ';
$ Data_dir = '/var/lib/vnstat /';

$ Graph_format = 'PNG ';
   
Define ('graph _ font', dirname (_ FILE _). '/VeraBd. Ttf ');

Define ('svg _ font', 'verdana ');

Define ('default _ COLORSCHEME ', 'light ');

?>

5. Configure vnstat self-starting script

The code is as follows: Copy code
Wget-P/etc/init. d/http://humdi.net/vnstat/init.d/redhat/vnstat
Chmod + x/etc/init. d/vnstat
Chkconfig -- add vnstat
Chkconfig vnstat on
Service vnstat restart

6. Verify the effect


Enter http://domain.name/vnstat success in the browser, as shown in the figure

If the vnstat_php_frontend does not show a picture, let's look down.

1. Delete the original compiled package first

The code is as follows: Copy code

Rm-fr php-5.2.17

You can also execute

The code is as follows: Copy code

Make clean

2. Compile php

The code is as follows: Copy code

Gzip-cd php-5.2.17-fpm-0.5.14.diff.gz | patch-d./php-5.2.17-p1
Cp php-5.2.17-max-input-vars.patch php-5.2.17
Cd php-5.2.17
Patch-p1 <php-5.2.17-max-input-vars.patch

I forgot to execute gzip-cd php-5.2.17-fpm-0.5.14.diff.gz when compiling php | patch-d. /php-5.2.17-p1, and then start phpf-pm, reported php_fpm Error in argument 1, char 1 no argument for option Error, you should pay attention to Oh.


3. Access http://www.111cn.net/xxx now my vnStat PHP frontend has to figure out

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.