Skip to content


 Zabbix
 Grafana
 Prometheus
 Threejs and TypeScript
 SocketIO and TypeScript
 Blender Topological Earth
 Sweet Home 3D
 Design Patterns Python
 Design Patterns TypeScript
   
 Course Coupon Codes
Three.js and TypeScript
Kindle Edition
$9.99 $14.99 Paperback 
$29.99 $34.99




Design Patterns in TypeScript
Kindle Edition
$9.99 $14.99 Paperback
$19.99 $24.99




Design Patterns in Python
Kindle Edition
$9.99 $14.99 Paperback
$19.99 $24.99




Zabbix Sender and Trapper - Intro and Example 1 - Cron

Video Lecture

Zabbix Sender and Trapper - Intro and Example 1 - Cron Zabbix Sender and Trapper - Intro and Example 1 - Cron Zabbix Sender and Trapper - Intro and Example 1 - Cron

Description

On My Raspberry Pi Zabbix Proxy, I copy this file to /home/pi/gettemp_cron.py

and create a cron job with settings,

*/1 * * * * python /home/pi/gettemp_cron.py

Provided, I have a Zabbix trapper item in my raspberrypi host settings in Zabbix Server, with key = pitemp

I will see the temperature of my raspberry pi logged every minute.

Python Script

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
import subprocess
import time

cmd = '/opt/vc/bin/vcgencmd measure_temp'
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
output, error = process.communicate()
#print(output)

tempC = output.split("=")[1].replace("'C", "").strip()
#print(tempC)

cmd = 'zabbix_sender -z 127.0.0.1 -s "raspberrypi" -k "pitemp" -o "%s" ' % (tempC)
print(cmd)

process = subprocess.Popen(cmd, stdout=subprocess.PIPE, shell=True)
output, error = process.communicate()
print(output)

Cron

Crontab Guru