Skip to content

Quick Start CentOS7

datacrat edited this page Apr 15, 2020 · 3 revisions

Quick Start - CentOS7

Time required

20 minutes or so.

Assumptions

  • You have a CentOS7 server installed with "Minimal" package
  • You login to the server using "centos" user id
  • "centos" user is configured to use "sudo"
  • You are going to graph the traffic of the device "rtr", whose IP address is 192.168.0.254
  • You have configured the device to be polled with a community name "public"
  • The update frequency of traffic data is 5 minutes

Steps

  1. Make sure that SELinux is disabled.
$ getenforce
Disabled
  1. Install "net-snmp-utils", "httpd", "unzip" and "epel-release". "epel-release" is needed to install "jq".
$ sudo yum -y install net-snmp-utils httpd unzip epel-release
  1. Install "jq"
$ sudo yum -y install jq
  1. Download nwUsagi code.
$ curl -o /tmp/nwusagi.zip https://codeload.github.com/datacrat/nwusagi/zip/master
  1. Unzip the code into "/var/lib" directory
$ cd /var/lib
$ sudo unzip /tmp/nwusagi.zip
  1. Rename the extracted directory "nwusage-master" to "nwusagi"
$ sudo mv nwusagi-master nwusagi
  1. Change the owner of "nwusagi" tree to "apache:apache"
$ sudo chown -R apache:apache nwusagi
  1. Make your user id belong to "apache" user
$ sudo usermod -G apache centos
  1. Logout then re-login to group membership make effect

  2. Make "nwusagi/conf", "nwusagi/data/live" and "nwusagi/tmp" to be group-writable

$ cd /var/lib
$ sudo chmod g+w nwusagi/conf nwusagi/data/live nwusagi/tmp
  1. Check if "rtr" (192.168.0.254) is reachable via SNMP using "public" community
$ snmpwalk -v2c -c public 192.168.0.254 ifIndex
(You will see the series of the output like "IF-MIB::ifIndex.1 = INTEGER: 1")
  1. Add the entry for "rtr" into "nwusagi/conf/devices"
$ echo -e "rtr\t192.168.0.254\tpublic" >> nwusagi/conf/devices
  1. Add a crontab entry to poll "rtr" every 5 minutes
$ crontab -l > /tmp/$(whoami)_crontab 2> /dev/null
$ echo "0-59/5 * * * * /var/lib/nwusagi/bin/nwuUpdate.sh rtr" >> /tmp/$(whoami)_crontab
$ crontab /tmp/$(whoami)_crontab
  1. Wait for the 1st poll and check if the data collection is successful
$ cat nwusagi/data/live/rtr 
(You will see a series of numbers in a row separated in TAB)
  1. Configure apache to serve WDC as designated in nwUsagi
$ sudo sh -c "echo \"IncludeOptional /var/lib/nwusagi/conf/httpd-*.conf\" >> /etc/httpd/conf/httpd.conf"
  1. Start apache
$ sudo systemctl start httpd
  1. Configure firewalld to allow access via TCP/80
$ sudo firewall-cmd --add-service=http --permanent
$ sudo firewall-cmd --reload
  1. Launch Tableau in your PC/Mac and navigate "Connect" -> "Web Data Connector". You will see the screen like below.
ScreenShot 2020-04-15 20 57 38
  1. Put "http://<Your CentOS7's IP>/nwusagi/wdc.html?device=rtr" into URL field. Wait for contents (Device name, list of columns) to appear

  2. You will see "Pull Data" button in the bottom of the window. Press it

ScreenShot 2020-04-15 20 57 59
  1. In the bottom of the window displayed, press "Sheet 1"
ScreenShot 2020-04-15 21 04 33
  1. From "Dimensions", drag "Timestamp" and drop it to "Columns". Hover over the dragged item (should be "YEAR(Timesta..)", press triangle and select "More" -> "Minute"
ScreenShot 2020-04-10 0 28 57
  1. From "Measures" pick one of the metrics and drag&drop it to "Rows"

  2. You will see a continuous line graph is drawn

ScreenShot 2020-04-15 21 08 10

Note: To update (refresh) the data to be drawn, navigate "Data" -> "nwUsage WDC ()" -> "Refresh".

Enjoy!

Clone this wiki locally