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]:~/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.
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.