thingsboard icon indicating copy to clipboard operation
thingsboard copied to clipboard

Is there a way for thingsboard instrumentation? getting cpu time and other metrics?

Open e-infotech opened this issue 6 years ago • 9 comments

Hello,

Is there any feature in TB or any way to collect some performance metrics and do tracing for TB?

Thank you

e-infotech avatar Jul 26 '20 21:07 e-infotech

I using python script like this in cron

#!/usr/bin/env python3
import paho.mqtt.client as mqtt
import json
import psutil
import subprocess
from re import findall

client = mqtt.Client('SERVER')
client.username_pw_set('TOKEN')
client.connect('IP', PORT, 60)

def get_temp():
    temp = subprocess.check_output(["vcgencmd","measure_temp"]).decode("UTF-8")
    return float(findall("\d+\.\d+",temp)[0])

def GetFreeMem():
    return float(round(psutil.virtual_memory().free/1024/1024,2))

def GetAvailableMem():
    return float(round(psutil.virtual_memory().available/1024/1024,2))

def GetCpuPercent():
    return float(psutil.cpu_percent(interval=1, percpu=False))

def GetFreeDisk():
   return float(round(psutil.disk_usage('/home/pi').free/1024/1024))

x = {
  "CPU_load": GetCpuPercent(),
  "Free_spase": GetFreeDisk(),
  "Free_ram" : GetFreeMem(),
  "Available_ram": GetAvailableMem(),
  "temp": get_temp()
}

client.publish('v1/devices/me/telemetry', json.dumps(x), 1)
client.disconnect()

Alentus avatar Jul 28 '20 11:07 Alentus

i highly recommend the tool: nodequery.com

free up to 10 servers

image

t0mZ4 avatar Aug 07 '20 04:08 t0mZ4

i highly recommend the tool: nodequery.com

free up to 10 servers

image

Can I use it for my Local thingsboard? I mean the one I have on the localhost? I use windows 10

e-infotech avatar Aug 07 '20 23:08 e-infotech

i highly recommend the tool: nodequery.com

free up to 10 servers

image

I installed this tool and worked with it. But it can provide monitoring information for the OS, not the ThingsBoard! I need this information for ThingsBoard itself.

e-infotech avatar Aug 08 '20 15:08 e-infotech

for the ThingsBoard you can have a use of the rule engine statistics for now, so that does provide you with the metrics for the rule engine processing and also reports the failures occurring on the rule engine. Please, refer for this link regarding the rule engine statistics: https://raw.githubusercontent.com/thingsboard/thingsboard/master/application/src/main/data/json/demo/dashboards/rule_engine_statistics.json and you can refer for this link as for the documentation for it: https://thingsboard.io/docs/user-guide/rule-engine-2-0/overview/#rule-engine-statistics

Karabiy avatar Sep 30 '20 16:09 Karabiy

for the ThingsBoard you can have a use of the rule engine statistics for now, so that does provide you with the metrics for the rule engine processing and also reports the failures occurring on the rule engine. Please, refer for this link regarding the rule engine statistics: https://raw.githubusercontent.com/thingsboard/thingsboard/master/application/src/main/data/json/demo/dashboards/rule_engine_statistics.json and you can refer for this link as for the documentation for it: https://thingsboard.io/docs/user-guide/rule-engine-2-0/overview/#rule-engine-statistics

Thank you for the solution. Unfortunately, I am sending the data from node-red to my thingsboard and it means my rule chain is on the node-red. can I configure the dashboard and get the metric from my node-red instead of thingsboard rule engine?

e-infotech avatar Oct 01 '20 16:10 e-infotech

in case if you can get those metrics from your node-red, you can send those for the device, which will be yours "Service metrics" device, so that you can have the visualization to be applied for those, though, it is required to send those being not that experienced with the node red particularly, so can not comment whether those is possible with it, though, from the ThingsBoard side you can just have the visualization of any data be done, in case if you are able to send those to the ThingsBoard. For those reasons, you can apply different connectivity types: ThingsBoard Integration feature, ThingsBoard IoT Gateway, ThingsBoard Device API. Please, refer for links on those on the below. ThingsBoard IoT Gateway: https://thingsboard.io/docs/iot-gateway/what-is-iot-gateway/ ThingsBoard Integration: https://thingsboard.io/docs/user-guide/integrations/ ThingsBoard Device API: https://thingsboard.io/docs/api/

Karabiy avatar Oct 06 '20 10:10 Karabiy

in case if you can get those metrics from your node-red, you can send those for the device, which will be yours "Service metrics" device, so that you can have the visualization to be applied for those, though, it is required to send those being not that experienced with the node red particularly, so can not comment whether those is possible with it, though, from the ThingsBoard side you can just have the visualization of any data be done, in case if you are able to send those to the ThingsBoard. For those reasons, you can apply different connectivity types: ThingsBoard Integration feature, ThingsBoard IoT Gateway, ThingsBoard Device API. Please, refer for links on those on the below. ThingsBoard IoT Gateway: https://thingsboard.io/docs/iot-gateway/what-is-iot-gateway/ ThingsBoard Integration: https://thingsboard.io/docs/user-guide/integrations/ ThingsBoard Device API: https://thingsboard.io/docs/api/

I want to instrument the thingsboard itself not any device! I did visualization for the data coming from the sensors and devices several months ago.

e-infotech avatar Oct 10 '20 22:10 e-infotech

@e-infotech you can have zabbix installation for the monitoring, for example, or in case if you are using the AWS, you can set up the Cloudwatch for those kind of a monitoring you can refer to this video for the grafana + zabbix setup: https://youtu.be/9TCsaf5h_w4

Karabiy avatar Feb 25 '21 20:02 Karabiy