-
Notifications
You must be signed in to change notification settings - Fork 0
Quick Start CentOS7
datacrat edited this page Apr 15, 2020
·
3 revisions
20 minutes or so.
- 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
- Make sure that SELinux is disabled.
$ getenforce
Disabled
- 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
- Install "jq"
$ sudo yum -y install jq
- Download nwUsagi code.
$ curl -o /tmp/nwusagi.zip https://codeload.github.com/datacrat/nwusagi/zip/master
- Unzip the code into "/var/lib" directory
$ cd /var/lib
$ sudo unzip /tmp/nwusagi.zip
- Rename the extracted directory "nwusage-master" to "nwusagi"
$ sudo mv nwusagi-master nwusagi
- Change the owner of "nwusagi" tree to "apache:apache"
$ sudo chown -R apache:apache nwusagi
- Make your user id belong to "apache" user
$ sudo usermod -G apache centos
-
Logout then re-login to group membership make effect
-
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
- 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")
- Add the entry for "rtr" into "nwusagi/conf/devices"
$ echo -e "rtr\t192.168.0.254\tpublic" >> nwusagi/conf/devices
- 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
- 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)
- 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"
- Start apache
$ sudo systemctl start httpd
- Configure firewalld to allow access via TCP/80
$ sudo firewall-cmd --add-service=http --permanent
$ sudo firewall-cmd --reload
- 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](https://user-images.githubusercontent.com/62040535/79334837-fbb64780-7f5b-11ea-8056-cc53fbe4c7b4.png)
-
Put "http://<Your CentOS7's IP>/nwusagi/wdc.html?device=rtr" into URL field. Wait for contents (Device name, list of columns) to appear
-
You will see "Pull Data" button in the bottom of the window. Press it
![ScreenShot 2020-04-15 20 57 59](https://user-images.githubusercontent.com/62040535/79335032-52238600-7f5c-11ea-8fad-99a0c3cd26cf.png)
- In the bottom of the window displayed, press "Sheet 1"
![ScreenShot 2020-04-15 21 04 33](https://user-images.githubusercontent.com/62040535/79335406-f279aa80-7f5c-11ea-97a9-32c86120d9c0.png)
- 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](https://user-images.githubusercontent.com/62040535/78912399-8281a500-7ac2-11ea-967e-29f3ecb0c4ea.png)
-
From "Measures" pick one of the metrics and drag&drop it to "Rows"
-
You will see a continuous line graph is drawn
![ScreenShot 2020-04-15 21 08 10](https://user-images.githubusercontent.com/62040535/79335659-58fec880-7f5d-11ea-8e24-b8a5f563db4d.png)
Note: To update (refresh) the data to be drawn, navigate "Data" -> "nwUsage WDC ()" -> "Refresh".
Enjoy!
nwUsagi © 2020 datacrat