Repository
Munin (contrib)
Last change
2018-08-02
Graph Categories
Keywords
Language
Perl
Authors

ip_thermo_125

Sadly there is no documentation for this plugin.

#!/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";