K
K
Konstantin2014-01-31 16:32:05
bash
Konstantin, 2014-01-31 16:32:05

How to make correct output of sensors value for prtg?

Good afternoon! Costs centos 6.4 x86. Installed lm_sensors and there is a need to monitor the temperature in PRTG. The monitoring program itself requires:
1. that the script be in /var/prtg/scripts/****
2. be in the format returncode:value:message
In my case, 0:$temperature:OK!
Quite recently I started studying all this, so I ask for help. There is an easier way to get 6 (!!!) values ​​​​from the output of sensors.
For one I got this:

#!/bin/bash
data=$(sensors | awk '/'temp1'/ {print $2}' | awk '{print $1}' | sed 's/+//' | sed 's/.0°C//')
data2=$(echo $data | awk '{print $1}')
echo "0:"$data2":OK!"

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question