[rrd-users] rrdtool::graph and German weekday names

Joachim Hartmann joachim.hartmann at gmx-topmail.de
Wed Nov 1 19:17:11 CET 2017


Hello perl experts,
I run Munin on a Debian server. In the graphs the days of the week are
displayed in German. Now I monitor the weather data on a raspberry,
which basically works, but the days of the week are displayed in
English. How do I get this Perl script to display the weekdays in
English?

+++++++++++++++++++++++++++++++++++++++
#!/usr/bin/perl
#
# CGI script to create image using RRD graph


use CGI qw(:all);
use RRDs;
use strict;
use Encode;
use feature qw/switch/;


# size
my $width=703;
my $height=100;

# Grafic title
my $title='';
my $v_axis='';
my $legende='';
my $t_unit='';
my $rrd_file='wetter.rrd';
my $rrd_field='';

# read and check query params
my $query=new CGI;
my $graphvalue=$query->param('graphvalue');
my $startstamp=$query->param('startstamp');
my $stoppstamp=$query->param('stoppstamp');
my $graphwidth=$query->param('graphwidth');

$width=703;
$title='Luftdruck bezogen auf Meereshöhe';
$rrd_field='Luftdruck';
$v_axis='hPa';
$t_unit='hPa';
$legende='Luftdruck ';


# write image into temp file
my $tmpfile="/tmp/graphx_$$.png";
my @opts=("-v", $v_axis,
"-t", $title,
"-W", "Wetterstation Hannover-List",
"-w", $width,
"-l", "0",
"-s", "$startstamp",
"-e", "$stoppstamp",
"-c", "BACK#F0EFEF",
"-l", "870");

RRDs::graph($tmpfile,
       @opts,
       "DEF:temp0=$rrd_file:$rrd_field:AVERAGE",
       "LINE2:temp0#0000FF:$legende",
       "GPRINT:temp0:LAST:akt.\\:%5.1lf $t_unit",
       "GPRINT:temp0:MIN:min.\\:%5.1lf $t_unit",
       "GPRINT:temp0:MAX:max.\\:%5.1lf $t_unit",
       "GPRINT:temp0:AVERAGE:mittel\\:%5.1lf $t_unit\\n",
       "HRULE:1013.25#FF0000:mittler Luftdruck (1.1013,25 hPa):dashes"
);




# check error
my $err=RRDs::error;
die "$err\n" if $err;
# feed tmpfile to stdout
open(IMG, $tmpfile) or die "can't open $tmpfile\n";
print header('image/png');
print <IMG>;
close IMG;
unlink $tmpfile;
+++++++++++++++++++++++++++++++++++++++

The output of locale is the same for both computers:

+++++++++++++++++++++++++++++++++++++++
# locale
LANG=de_DE.UTF-8
LANGUAGE=
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=
++++++++++++++++++++++++++++++++++++++
-- 
Greetings from the home of CeBIT
Gruß aus der Stadt der CeBIT
Jochen



More information about the rrd-users mailing list