{"id":87,"date":"2020-04-23T19:27:52","date_gmt":"2020-04-23T18:27:52","guid":{"rendered":"http:\/\/10.0.1.68\/?p=87"},"modified":"2020-04-28T08:18:26","modified_gmt":"2020-04-28T07:18:26","slug":"installatie-grafana-influxdb-en-telegraf-op-een-rpi-raspbian","status":"publish","type":"post","link":"https:\/\/scriptpress.rfuchs.nl\/index.php\/2020\/04\/23\/installatie-grafana-influxdb-en-telegraf-op-een-rpi-raspbian\/","title":{"rendered":"Installatie Grafana, InfluxDB en Telegraf op een RPi (Raspbian)"},"content":{"rendered":"\n<p>In deze tutorial beschrijf ik hoe je Grafana, InfluxDB en Telegraf op een RPi (3b) installeert. Grafana word gebruikt om mooie grafieken van data (bijv. SNMP) te maken.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Update Raspbian<\/h2>\n\n\n\n<ol class=\"wp-block-list\"><li>sudo apt-get update<\/li><li>sudo apt-get upgrade<\/li><\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Installatie InfluxDB<\/h2>\n\n\n\n<ol class=\"wp-block-list\"><li>curl -sL https:\/\/repos.influxdata.com\/influxdb.key | sudo apt-key add \u2013<\/li><li>echo &#8220;deb https:\/\/repos.influxdata.com\/debian stretch stable&#8221; | sudo tee \/etc\/apt\/sources.list.d\/influxdb.list<\/li><li>sudo apt\nupdate<\/li><li>sudo apt\ninstall influxdb<\/li><li>sudo\nsystemctl enable influxdb<\/li><li>sudo\nsystemctl start influxdb<\/li><li>influx (of sudo influx)<\/li><li>CREATE\nDATABASE telegraf<\/li><\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Installatie Grafana<\/h2>\n\n\n\n<ol class=\"wp-block-list\"><li>sudo apt-get install&nbsp;-y adduser libfontconfig1<\/li><li>wget https:\/\/dl.grafana.com\/oss\/release\/grafana-rpi_6.7.2_armhf.deb<\/li><li>sudo dpkg&nbsp;-i&nbsp;grafana-rpi_6.7.2_armhf.deb<\/li><li>sudo\nsystemctl enable grafana-server<\/li><li>sudo\nsystemctl start grafana-server<\/li><li>Nu is\nGrafana te bereiken op het <a href=\"http:\/\/IP:3000\">http:\/\/IP:3000<\/a> login is\nadmin-admin<\/li><\/ol>\n\n\n\n<p>(installatie InfluxDB en Grafana bronnen)<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"http:\/\/blog.centurio.net\/2018\/10\/28\/howto-install-influxdb-and-grafana-on-a-raspberry-pi-3\/\">http:\/\/blog.centurio.net\/2018\/10\/28\/howto-install-influxdb-and-grafana-on-a-raspberry-pi-3\/<\/a><\/li><li><a href=\"https:\/\/grafana.com\/grafana\/download?platform=arm\">https:\/\/grafana.com\/grafana\/download?platform=arm<\/a> (ARMv6!!)<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Installatie Telegraf<\/h2>\n\n\n\n<ol class=\"wp-block-list\"><li>sudo apt install -y gnupg2 curl wget<\/li><li>wget -qO- https:\/\/repos.influxdata.com\/influxdb.key | sudo apt-key add \u2013<\/li><li>echo &#8220;deb https:\/\/repos.influxdata.com\/debian buster stable&#8221; | sudo tee \/etc\/apt\/sources.list.d\/influxdb.list<\/li><li>sudo apt update<\/li><li>sudo apt -y install telegraf<\/li><li>systemctl status telegraf <em>(hiermee controleer je of Telegraf correct is ge\u00efnstalleerd en draait)<\/em><\/li><\/ol>\n\n\n\n<p>(installatie Telegraf bron)<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/computingforgeeks.com\/install-and-configure-telegraf-on-debian-linux\/\">https:\/\/computingforgeeks.com\/install-and-configure-telegraf-on-debian-linux\/<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Installatie SNMP<\/h2>\n\n\n\n<ol class=\"wp-block-list\"><li>sudo apt install snmp snmpd snmp-mibs-downloader<\/li><li>Indien je gebruikt maakt van een andere string zoals\n<em>public<\/em> kan je het config bestand\naanpassen met: sudo nano \/etc\/snmp\/snmpd.conf<\/li><li>Ga naar de regel waar je het volgende ziet:<br>\n\u2026<br>\nrocommunity public default -V systemonly<br>\nrocommunity6 public default -V systemonly<br>\n\u2026<br>\nPas dan dus hier <em>public<\/em> aan naar wat\nanders.<\/li><li>Indien aangepast voer het volgende commando uit:<br>\nsudo service snmpd restart<\/li><li>Om te zien of je SNMP MIBS kunnen worden uitgelezen\nkun je dit testen d.m.v. het volgende commando (in mijn geval):<br>\nsnmpwalk -v 2c -c public 192.168.1.1<\/li><\/ol>\n\n\n\n<p>(installatie SNMP bron)<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/sbcode.net\/grafana\/install-snmpd-config-telegraf\/\">https:\/\/sbcode.net\/grafana\/install-snmpd-config-telegraf\/<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"> Configuratie Telegraf <\/h2>\n\n\n\n<ol class=\"wp-block-list\"><li>sudo nano \/etc\/telegraf\/telegraf.conf<\/li><li>Zoek naar <em>[agent]<\/em> (commando zoeken in nano: CTRL + W)<\/li><li>Haal de hashtag weg bij <em>interval<\/em> en zet deze op <em>5s<\/em><\/li><li>Zoek naar <em>[[outputs.influxdb]]<\/em><\/li><li>Haal de hashtag weg bij <em>urls = [&#8220;http:\/\/127.0.0.1:8086&#8221;]<\/em><\/li><li>Haal 3 regels lager de hashtag weg bij <em>database = \u201ctelegraf\u201d<\/em><br> (pas telegraf aan indien er een andere database is gekozen bij de installatie van InfluxDB)<\/li><li>Zoek nu naar de regel:&nbsp; <em>#&nbsp;&nbsp; dump_zeros&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; = true<\/em><\/li><li>Zet tussen deze regel en de regel <em># # Get standard NTP query metrics, requires ntpq executable <\/em>de volgende tekst:<\/li><\/ol>\n\n\n\n<pre class=\"wp-block-code\"><code>[[inputs.snmp]]\n agents = [ \"192.168.1.1\" ]\n version = 2\n community = \"public\"\n name = \"snmp\"\n\n [[inputs.snmp.field]]\n    name = \"hostname\"\n    oid = \"RFC1213-MIB::sysName.0\"\n    is_tag = true\n\n  [[inputs.snmp.table]]\n    name = \"snmp\"\n    inherit_tags = [ \"hostname\" ]\n    oid = \"IF-MIB::ifXTable\"\n\n    [[inputs.snmp.table.field]]\n      name = \"ifName\"\n      oid = \"IF-MIB::ifName\"\n      is_tag = true\n<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Tip<\/p><cite>Als je van een ander apparaat de SNMP wil uitlezen, zet je uiteraard bij <em>[[inputs.snmp]]<\/em> een ander IP adres neer.<\/cite><\/blockquote>\n\n\n\n<p>Dat ziet er dan zo ongeveer uit:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"508\" height=\"547\" src=\"http:\/\/10.0.1.68\/wp-content\/uploads\/2020\/04\/telegrafconf-1.png\" alt=\"\" class=\"wp-image-104\" srcset=\"https:\/\/scriptpress.rfuchs.nl\/wp-content\/uploads\/2020\/04\/telegrafconf-1.png 508w, https:\/\/scriptpress.rfuchs.nl\/wp-content\/uploads\/2020\/04\/telegrafconf-1-279x300.png 279w\" sizes=\"auto, (max-width: 508px) 100vw, 508px\" \/><\/figure>\n\n\n\n<p>Vervolgens als laatste herstart je de telegraf service:<br>sudo service telegraf restart<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"> Configuratie InfluxDB in Grafana <\/h2>\n\n\n\n<ol class=\"wp-block-list\"><li>Login op Grafana.<\/li><li>Maak een datasource aan.<\/li><li>Kies voor, of zoek naar InfluxDB.<\/li><li>Vul bij URL <a href=\"http:\/\/localhost:8086\">http:\/\/localhost:8086<\/a> in.<\/li><li>Onder <em>InfluxDB Details<\/em> vul je bij <em>Database<\/em> telegraf in.<\/li><li> Klik onderaan op <em>Save &amp; Test<\/em>.  <\/li><\/ol>\n\n\n\n<p>Nu is alles gereed en kan er worden gestart met de configuratie van je dashboard.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"407\" src=\"http:\/\/10.0.1.68\/wp-content\/uploads\/2020\/04\/2020-04-23-20_26_22-Window-1024x407.png\" alt=\"\" class=\"wp-image-127\" srcset=\"https:\/\/scriptpress.rfuchs.nl\/wp-content\/uploads\/2020\/04\/2020-04-23-20_26_22-Window-1024x407.png 1024w, https:\/\/scriptpress.rfuchs.nl\/wp-content\/uploads\/2020\/04\/2020-04-23-20_26_22-Window-300x119.png 300w, https:\/\/scriptpress.rfuchs.nl\/wp-content\/uploads\/2020\/04\/2020-04-23-20_26_22-Window-768x305.png 768w, https:\/\/scriptpress.rfuchs.nl\/wp-content\/uploads\/2020\/04\/2020-04-23-20_26_22-Window-1536x611.png 1536w, https:\/\/scriptpress.rfuchs.nl\/wp-content\/uploads\/2020\/04\/2020-04-23-20_26_22-Window-750x298.png 750w, https:\/\/scriptpress.rfuchs.nl\/wp-content\/uploads\/2020\/04\/2020-04-23-20_26_22-Window.png 1846w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>In deze tutorial beschrijf ik hoe je Grafana, InfluxDB en Telegraf op een RPi (3b) installeert. Grafana word gebruikt om mooie grafieken van data (bijv. SNMP) te maken. Update Raspbian [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","footnotes":""},"categories":[23],"tags":[24,27,25,26,29,28],"class_list":["post-87","post","type-post","status-publish","format-standard","hentry","category-raspberry-pi","tag-grafana","tag-influxdb","tag-raspberry-pi","tag-rpi","tag-snmp","tag-telegraf"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/scriptpress.rfuchs.nl\/index.php\/wp-json\/wp\/v2\/posts\/87","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scriptpress.rfuchs.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scriptpress.rfuchs.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scriptpress.rfuchs.nl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/scriptpress.rfuchs.nl\/index.php\/wp-json\/wp\/v2\/comments?post=87"}],"version-history":[{"count":22,"href":"https:\/\/scriptpress.rfuchs.nl\/index.php\/wp-json\/wp\/v2\/posts\/87\/revisions"}],"predecessor-version":[{"id":136,"href":"https:\/\/scriptpress.rfuchs.nl\/index.php\/wp-json\/wp\/v2\/posts\/87\/revisions\/136"}],"wp:attachment":[{"href":"https:\/\/scriptpress.rfuchs.nl\/index.php\/wp-json\/wp\/v2\/media?parent=87"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scriptpress.rfuchs.nl\/index.php\/wp-json\/wp\/v2\/categories?post=87"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scriptpress.rfuchs.nl\/index.php\/wp-json\/wp\/v2\/tags?post=87"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}