summer 2016 webinar series performance monitoring, easy as pi · 2016-07-06 · find declaration...
TRANSCRIPT
Gonz Guzman ([email protected], 919-248-1842) Lead Client Network Engineer
Summer 2016 Webinar Series Performance Monitoring,
Easy As Pi
Webinar Links: www.mcnc.org/cne-webinars
Agenda
n Discuss differences in the Pi platforms
n Preparing the Pi
n Visualizing the data
n Deployment Options
2 10/3/12
Differences in the Pi Platform
n Not all Pi’s are created equally • Raspberry Pi 1 B+ – 100Mbps - 49Mbps Up, 94Mbps Down
• Raspberry Pi 2 – 100Mbps - 94Mbps Up, 94Mbps Down
• Raspberry Pi 3 – 100Mbps - 94Mbps Up, 94Mbps Down
• Banana Pi Pro – 1Gbps - 700Mpbs Up, 885Mbps Down
3 10/3/12
Differences in the Pi Platform
n We have wireless • Raspberry Pi 3 • Banana Pi Pro
n Both utilize 802.11n at 2.4Ghz • Theoretical limit for 802.11n, 600Mbps 5Ghz
and 300Mbps 2.4Ghz • Realistic throughputs are 300Mbps 5Ghz
and 144Mbps 2.4Ghz
4 7/6/16
Prepare the Pi
n Use the latest Raspbian image • https://www.raspberrypi.org/documentation/
installation/installing-images/README.md
n Use the raspi-config utility • Expand the file system • Change the user password • Set the timezone , under Internationalization Options
5 7/6/16
Prepare the Pi
6 7/6/16
Prepare the Pi
n Update OS • sudo apt-get update • sudo apt-get upgrade –y
n Download and install Influxdb • wget
https://dl.influxdata.com/influxdb/releases/influxdb_0.13.0_armhf.deb
• sudo dpkg -i influxdb_0.13.0_armhf.deb • sudo apt-get install -y python-influxdb
7 7/6/16
Prepare the Pi
n Install Collectd • sudo apt-get install -y collectd collectd-utils
n Configure Influxdb for use with Collectd • sudo vi /etc/influxdb/influxdb.conf • Find [collectd] declaration and add the following
below the declaration - enabled = true - bind-address = “localhost:8096“ - database = “collectd” - typesdb = “/usr/share/collectd/types.db”
8 7/6/16
Prepare the Pi
n Start and enable the Influxdb service • sudo systemctl start influxdb • sudo systemctl enable influxdb
n Create a database for Collectd in Influxdb • curl -POST http://localhost:8086/query --data-
urlencode “q=CREATE DATABASE collectd”
9 7/6/16
Prepare the Pi
n Configure Collectd • sudo vi /etc/collectd/collectd.conf • Find and remove # from the global settings - #BaseDir “/var/lib/collectd“ - #PluginDir “/usr/lib/collectd“ - #TypesDB “/usr/share/collectd/types.db” “/etc/
collectd/my_types.db“ • Find Interval declaration and remove # and
change value to 300 - #Interval 10
10 7/6/16
Prepare the Pi
n Enable the following plugins by remove # from the beginning of the statement • LoadPlugin curl • LoadPlugin interface • LoadPlugin network • LoadPlugin ping
11 7/6/16
Prepare the Pi
12 7/6/16
n Find the <Plugin curl> declaration and remove # from the start and end of the declaration. Then configure test for a desired site, example below • <Page “Google”> • URL http://www.google.com
• MeasureResponseTime True • MeasureResponseCode True
• </Page>
Prepare the Pi
13 7/6/16
n Find the <Plugin interface> declaration and remove # from the following lines • #<Plugin interface>
• # Interface “eth0” • # IgnoreSelected false • #</Plugin>
Prepare the Pi
14 7/6/16
n Find <Plugin network> declaration and configure for influxdb, add the following below the declaration. • Server “127.0.0.1” “8096”
n Find <Plugin ping> declaration and configure for desired sites or devices, by adding something similar to this example. • Host “10.100.0.44“ • Host “host.baz.qux“
• Host “www.yahoo.com”
Prepare the Pi
15 7/6/16
n Also remove # from the following statements
• <Plugin ping> • Interval 300.0 • Timeout 0.9 • TTL 255 • Device “eth0” • MaxMissed -1
• </Plugin>
Prepare the Pi
16 7/6/16
n Start and enable Collectd • sudo systemctl start collectd
• sudo systemctl enable collectd
Secure the Pi
17 7/6/16
n Lastly we want to secure the Pi with iptables • Install iptable-persistent - sudo apt-get install –y iptables-persistent
n Any changes to iptables will be saved with the following command. • sudo iptables-save
Example iptables rule set
n sudo iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
n sudo iptables -A INPUT -p icmp -j ACCEPT
n sudo iptables -A INPUT -i lo -j ACCEPT
n #SSH access
n sudo iptables -A INPUT -p tcp -m tcp -s 10.100.0.0/16 --dport 22 -j ACCEPT
n sudo iptables -A INPUT -p tcp -m tcp -s 10.101.0.0/16 --dport 22 -j ACCEPT
n #Grafana access for datasource
n sudo iptables -A INPUT -p tcp -m tcp -s 10.100.0.0/16 --dport 8086 -j ACCEPT
n sudo iptables -A INPUT -p tcp -m tcp -s 10.101.0.0/16 --dport 8086 -j ACCEPT
n #InfulxDB web admin
n sudo iptables -A INPUT -p tcp -m tcp -s 10.100.0.0/16 --dport 8083 -j ACCEPT
n sudo iptables -A INPUT -p tcp -m tcp -s 10.101.0.0/16 --dport 8083 -j ACCEPT
n #drop everything else
n sudo iptables -A INPUT -p tcp --dport 1:8088 -j DROP
n sudo iptables -A INPUT -p udp --dport 1:8088 -j DROP
n sudo iptables -A INPUT -j REJECT --reject-with icmp-host-prohibited
n sudo iptables -A FORWARD -j REJECT --reject-with icmp-host-prohibited 18 7/6/16
Visualizing the data
n Install Grafana latest version (v3.0.4) • http://grafana.org/download/ • http://docs.grafana.org/installation/
n Configure a data source for Influxdb, instruction found here
• http://docs.grafana.org/datasources/influxdb/ • Use data source type influxDB
19 7/6/16
Visualizing the data – UI Example
20 7/6/16
Deployment Options
n MDF at each school and the core.
n In a problem class room to test wireless performance complaints.
n You could also utilize the Pi’s with Iperf, Curl via the command line or MTR, for deep dives into an issue.
21 7/6/16
Tool examples
n Curl • curl -L --output /dev/null --silent --show-error --write-out ‘lookup: %{time_namelookup}
\nconnect: %{time_connect}\nappconnect: %{time_appconnect}\npretransfer: %{time_pretransfer}\nredirect: %{time_redirect}\nstarttransfer: %{time_starttransfer}\ntotal: %{time_total}\n’ ‘google.com’
lookup: 0.005 connect: 0.013 appconnect: 0.000 pretransfer: 0.013 redirect: 0.069 starttransfer: 0.078 total: 0.148
22 7/6/16
Tool examples
n MTR • mtr --report --report-cycle 10 www.google.com
Start: Tue Jul 5 12:02:57 2016 HOST: raspmon2 Loss% Snt Last Avg Best Wrst StDev 1.|-- 128.109.178.2 0.0% 10 1.2 1.2 1.1 1.2 0.0 2.|-- 152.46.46.5 0.0% 10 1.1 1.1 1.1 1.2 0.0 3.|-- 128.109.246.41 0.0% 10 5.7 5.6 5.5 5.7 0.0 4.|-- ws-a1a-ip-asr-gw-to-rlasr 0.0% 10 7.6 7.6 7.5 7.7 0.0 5.|-- 204.85.30.79 0.0% 10 7.1 7.1 7.1 7.2 0.0
23 7/6/16
Tool examples
n Iperf **Bandwidth limiting - **100Mb/sec** [Server] – iperf -s -i 1 -u [Client] – iperf -c 10.101.101.101 -t 30 -u -b 100000000
**Transfer 1GB of data then stop - **1GB of data** [Server] – iperf -s -i 1 [Client] – iperf -c 10.101.101.101 -n 1073741824
**Bidirectional testing [Server] – iperf -s -i 1 [Client] – iperf -c 10.101.101.101 -t 30 -d or -r
24 7/6/16
Gonz Guzman ([email protected], 919-248-1842) Lead Client Network Engineer
Summer 2016 Webinar Series Performance Monitoring, Easy As
Pi
Webinar Links: www.mcnc.org/cne-webinars