2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00
contrib-munin/plugins/sensors/ip_thermo_125

69 lines
1.4 KiB
Plaintext
Raw Normal View History

2008-06-05 14:54:36 +02:00
#!/usr/bin/perl
#
# Copyright (C) 2008 Yuriy Sabov
# Version 0.1
#
# Plugin to fetch temperature from "IP Thermo 125" ethernet thermometer
# available at http://www.procontrol.hu/GyartasFejlesztes/Termekeink/IPThermoSimple/IPThermo125_eng.htm
# This version supports only one temperature sensor per server!
#
#
# Parameters supported:
#
# config
# autoconf
#
my ($hostname, $port, $line, $telnet);
# "C" = Celsius, "F" = Fahrenheit
my $unit = $ENV{unit} || "C";
$hostname = "10.10.10.10";
$port = 23;
use Net::Telnet ();
if ($ARGV[0] and $ARGV[0] eq "autoconf")
{
print "yes\n";
exit 0;
}
if (defined $ARGV[0] and $ARGV[0] eq "config")
{
print "graph_title IP Thermo 125\n";
print "graph_args --base 1000 -l 0\n";
print "graph_category sensors\n";
print "graph_info This graph shows temperature using IP Thermo 125 server.\n";
if ($unit =~ /F/)
{
print "graph_vlabel temp in °F\n";
}
else
{
print "graph_vlabel temp in °C\n";
}
print "temperature.label temperature\n";
exit 0
}
$telnet = new Net::Telnet (Telnetmode => 0);
# create telnet connection to temperature server
$telnet->open(Host => $hostname, Port => $port);
# read line from server.
$line = $telnet->getline;
# get measurement of first sensor from received data
$value1 = substr(substr($line, 0, 20), -4, 4);
print "temperature.value ";
print "$value1\n";