21 Apr

Monitor TP-Link Smart Plug in check_mk

Objective: to integrate TP-Link Smart Plug into check_mk (for data history and for fun)
Pre-requisite: Check_MK is installed and you have created check_mk site. check_mk installation tutorial will not be covered under this post.

Install software dependencies

apt-get install nodejs npm

Install TP-Link Smart Home API

Switch to OMD site

OMD[home]:~/local/bin$ npm install tplink-smarthome-api

Install TP-Link power monitoring plugin

OMD[home]:~/tmp/wget https://mathias-kettner.com/check_mk-exchange-file.php?&file=tp-link-cmk-1.0.mkp

OMD[home]:~/mkp install /tmp/tp-link-cmk-1.0.mkp

Create monitoring host

Go to WATO > Host & Service Parameters > Datasource Programs

Go to Individual program call instead of agent access

Create new rule. You may insert the rule description and comments as needed (optional). Specify this command under INDIVIDUAL PROGRAM CALL INSTEAD OF AGENT ACCESS.
tp-link-power.js $HOSTNAME$

To be safe during test, you may hardcode explicitly the smart plug ip address.

Create new host, enter hostname and IP address and click “Save & Finish”. Edit again this node and click Parameters on top.

Expand DATASOURCE PROGRAM and select the custom check from here. Click “Individual program call instead of agent access” and make sure the check is here and valid.

Wait for few minutes and check the service graph.

References:

https://github.com/bmachek/tp-link-cmk
https://mathias-kettner.com/check_mk-exchange-file.php?&file=tp-link-cmk-1.0.mkp
https://mathias-kettner.com/download/Marco_Reale_Check_MK_Beginner_guide.pdf
https://www.npmjs.com/package/tplink-smarthome-api
https://mathias-kettner.com/cms_datasource_programs.html

05 Feb

Munin monitoring on RaspberryPi/DietPi

Here’s the situation. I have an Odroid XU4 and Raspberry Pi, both of them running with DietPi image. The mission is to perform system monitoring for both of the system.

Install Munin server

Ensure that the system is up to date before you start to install Munin, run:

apt-get updateapt-get upgrade

Apache is used to show the Munin pages, the apache fcgid module is required for the Munin graph zoom feature. Install apache and the fcgid module with apt.

apt-get install apache2 libcgi-fast-perl libapache2-mod-fcgid

Enable the fcgid module in apache.

a2enmod fcgid

Install & Configure Munin

To install Munin on DietPi, we do this:

apt-get install munin munin-node munin-plugins-extra 

Next, we must edit the Munin configuration file /etc/munin/munin.conf. Uncomment the dbdirhtmldirlogdirrundir, and tmpldir lines (the default values are fine). We want Munin to use the name raspiblack.local instead of localhost.localdomain in the HTML output, therefore we replace localhost.localdomain with raspiblack.local in the simple host tree section. Without the comments, the changed file looks like this:

nano /etc/munin/munin.conf
# Example configuration file for Munin, generated by 'make build'

# The next three variables specifies where the location of the RRD
# databases, the HTML output, logs and the lock/pid files. They all
# must be writable by the user running munin-cron. They are all
# defaulted to the values you see here.
#
dbdir /var/lib/munin
htmldir /var/cache/munin/www
logdir /var/log/munin
rundir /var/run/munin

# Where to look for the HTML templates
#
tmpldir /etc/munin/templates

# Where to look for the static www files
#
#staticdir /etc/munin/static

# temporary cgi files are here. note that it has to be writable by
# the cgi user (usually nobody or httpd).
#
# cgitmpdir /var/lib/munin/cgi-tmp # (Exactly one) directory to include all files from. includedir /etc/munin/munin-conf.d [...] # a simple host tree
[raspiblack.local]
address 127.0.0.1
use_node_name yes
[XU4.local]
address 192.168.1.6
use_node_name yes [...]

Run these commands to enable and load the configuration into apache.

cd /etc/apache2/conf-enabled/ln -s /etc/munin/apache24.conf munin.confservice apache2 restart

Make sure you comment out the line Require local and add Require all granted and Options FollowSymLinks SymLinksIfOwnerMatch instead (otherwise you will only be able to access the Munin output from localhost):

nano /etc/munin/apache24.conf
Alias /munin /var/cache/munin/www
<Directory /var/cache/munin/www>
 # Require local
 Require all granted
 Options FollowSymLinks SymLinksIfOwnerMatch
 Options None
</Directory>

ScriptAlias /munin-cgi/munin-cgi-graph /usr/lib/munin/cgi/munin-cgi-graph
<Location /munin-cgi/munin-cgi-graph>
 # Require local
 Require all granted
 Options FollowSymLinks SymLinksIfOwnerMatch
 <IfModule mod_fcgid.c>
 SetHandler fcgid-script
 </IfModule>
 <IfModule !mod_fcgid.c>
 SetHandler cgi-script
 </IfModule>
</Location>

Restart Apache:

service apache2 restart

Then restart Munin:

service munin-node restart

Install munin node on XU4

apt-get install munin-node munin-plugins-extra 

Edit munin node configuration

nano /etc/munin/munin-node.conf

Change munin node identification and allow probe

host_name XU4.local 
allow ^192\.168\.1\.230$

192.168.1.230 is the address of the munin server

Then restart Munin:

service munin-node restart

Now wait a few minutes so that Munin can produce its first output, and then go to http://munin-server-ip-address/munin/ in your browser, and you see the first statistics.

References:
https://www.howtoforge.com/tutorial/server-monitoring-with-munin-and-monit-on-debian/

https://www.digitalocean.com/community/tutorials/how-to-install-the-munin-monitoring-tool-on-debian-8

Incoming search terms:

  • munin on raspberry i
  • munin raspberry pi
26 Jun

Installing iperf on ubuntu

Iperf was orginally developed by NLANR/DAST as a modern alternative for measuring maximum TCP and UDP bandwidth performance. Iperf allows the tuning of various parameters and UDP characteristics. Iperf reports bandwidth, delay jitter, datagram loss.

We’ll setting up 1 iperf client and 1 iperf server.
Read More

Incoming search terms:

  • Iperf ubuntu
  • ubuntu iperf
  • iperf for ubuntu
  • iperf download for ubuntu
  • how to install iperf3 on ubuntu
  • how to use iperf ubuntu
  • iperf para ubuntu
  • compile iperf in ubuntu
  • install ubuntu iperf
  • how to use iperf tool in ubuntu
  • Install iperf Ubuntu
  • linux iperf offline installation package ubuntu
  • iperf client and server installation ubuntu
  • jperf ubuntu
  • install jperf ubuntu