Tuesday 3 January 2017

VNStat installation ad configuration in RHEL 7

What is VNSTAT :

VNstat is console based network monitor tools. It keeps the logs of hourly, weekly and monthly for the selected network. It's not a packet sniffer and it analyze the traffic from proc filesystem.

Installation :

First update or install the epel repo for your rhel 7.

cd /tmp

wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

rpm -ivh epel-release-latest-7.noarch.rpm

Now install vnstat with following command

yum install vnstat

Configuration :

Main configuration file will be stored in /etc/vnstat.conf. edit the configuration file.

vi /etc/vnstat.conf

and change the default interface eth0 to eth1

Interface "eth1"

save & Close it.

DB Creation :

Run the following command to create the DB for vnstat

chsh -s /bin/bash vnstat

grep --color vnstat /etc/passwd


Run the following command to create DB

runuser -l vnstat -g vnstat -c '/usr/bin/vnstat -u -i eth0'

Now make sure that vnstat user can't login server

chsh -s /sbin/nologin vinstat

grep --color vnstat /etc/passwd



Start the service and make sure turn on while reboot.

chkconfig vnstat on

service vnstat start/restart/stop

View the stat :

vnstat

vnstat -i { interface }

vnstat -i { interface } -option

vnstat -i { interface } -option 1 -option 2

Sample Output

vnstat



vnstat -i eth0 -d


Like this we have more commands, below mentioned

vnstat -i eth0 -w

vnstat -i etho -m

vnstat -i eth0 -h

if we want to see top 10 network

vnstat -t

vnstat -i etho -t

For short output

vnstat -i eth0 -s

For calculate 

vnstat -i eth0 -tr

For real time transfer rate

vnstat -i eth0 -l


That's all you can use this to see your network bandwidth usage.

Permanent hostname setup for RHEL7

Step 1 Set the host name on NMTUI tool like following nmtui set host name   then save and exit Step 2 add the following l...