[solved] Current temperature value

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
shady79
Posts: 5
Joined: Thu Jan 08, 2015 3:58 am

[solved] Current temperature value

Post by shady79 »

Hello

Can anyone explain me one thing.
I have some ds18b20 sensors and cacti draw charts for them.
I get current temp. from sensor using python script.
I noticed that current temp in graph is a little overestimated compared to actual value. Sometimes the difference is about one degree.
In graph template item for current temp is set like that:

Image
regards
shady
Last edited by shady79 on Fri Jan 09, 2015 7:13 am, edited 1 time in total.
User avatar
BSOD2600
Cacti Moderator
Posts: 12171
Joined: Sat May 08, 2004 12:44 pm
Location: USA

Re: Current temperature value

Post by BSOD2600 »

Sounds like rrdtool consolidating data over time. read up http://docs.cacti.net/manual:088:8_rrdtool
shady79
Posts: 5
Joined: Thu Jan 08, 2015 3:58 am

Re: Current temperature value

Post by shady79 »

Thanks for replay.
I still have a problem with current value of temperature when it falls below 1

Image

It is represented as 630.00 instead of 0.63
When I exported some data to csv file - values are as follows:

2015-01-08 17:50:00 1.0683333333e+00
2015-01-08 17:55:00 1.1861000000e+00
2015-01-08 18:00:00 1.1312000000e+00
2015-01-08 18:05:00 1.0614000000e+00
2015-01-08 18:10:00 1.0018000000e+00
2015-01-08 18:15:00 8.8240000000e-01
2015-01-08 18:20:00 8.8000000000e-01
2015-01-08 18:25:00 9.3880000000e-01
2015-01-08 18:30:00 8.1216666667e-01

Maybe I must tweak some settings in cacti but I have no idea where...

Regards
Shady
Last edited by shady79 on Fri Jan 09, 2015 7:15 am, edited 1 time in total.
shady79
Posts: 5
Joined: Thu Jan 08, 2015 3:58 am

Re: Current temperature value

Post by shady79 »

My script that gets the temperature..

Code: Select all

import os, glob, sys
#import rrdtool
from time import sleep

# Load the 1-wire modules (if modules are loaded on boot these two lines can be commented out)
os.system('modprobe w1-gpio')
os.system('modprobe w1-therm')

# Set up some variables
base_dir = '/sys/bus/w1/devices/'
devices = glob.glob(base_dir + '28*')
device_file = '/w1_slave'

def read_temp_file(device_file):
    f = open(device_file, 'r')
    lines = f.readlines()
    f.close()
    return lines

def read(id):
        device_dir = '/sys/bus/w1/devices/'+ id + device_file
        raw_data = read_temp_file(device_dir)
        while raw_data[0].find('YES') == -1:
            sleep(0.1)
            raw_data = read_temp_file(device_dir)

        t_pos = raw_data[1].find('t=')

        if t_pos != -1:
                temp = float(raw_data[1][t_pos+2:]) / 1000
                temp = round(temp,2)
                print temp
                # return temp



try:
        read('28-0000051eb082')

except KeyboardInterrupt:
    # quit
    print('Exiting application')
    sys.exit()
Maybe here is a problem...
User avatar
phalek
Developer
Posts: 2838
Joined: Thu Jan 31, 2008 6:39 am
Location: Kressbronn, Germany
Contact:

Re: Current temperature value

Post by phalek »

This falls into this FAQ entry: http://docs.cacti.net/faq#show_exact_numbers
Greetings,
Phalek
---
Need more help ? Read the Cacti documentation or my new Cacti 1.x Book
Need on-site support ? Look here Cacti Workshop
Need professional Cacti support ? Look here CereusService
---
Plugins : CereusReporting
shady79
Posts: 5
Joined: Thu Jan 08, 2015 3:58 am

Re: Current temperature value

Post by shady79 »

phalek wrote:This falls into this FAQ entry: http://docs.cacti.net/faq#show_exact_numbers
Thanks that's it ;)
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests