2013-01-04 08:27:05 +00:00
#
# Monitorix - A lightweight system monitoring tool.
#
2017-07-28 11:13:27 +01:00
# Copyright (C) 2005-2017 by Jordi Sanfeliu <jordi@fibranet.cat>
2013-01-04 08:27:05 +00:00
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
package hptemp ;
use strict ;
use warnings ;
use Monitorix ;
use RRDs ;
use Exporter 'import' ;
our @ EXPORT = qw( hptemp_init hptemp_update hptemp_cgi ) ;
sub hptemp_init {
my $ myself = ( caller ( 0 ) ) [ 3 ] ;
my ( $ package , $ config , $ debug ) = @ _ ;
my $ rrd = $ config - > { base_lib } . $ package . ".rrd" ;
2013-10-22 09:28:56 +01:00
my $ info ;
my @ rra ;
my @ tmp ;
my $ n ;
my @ average ;
my @ min ;
my @ max ;
my @ last ;
2013-01-04 08:27:05 +00:00
# checks if 'hplog' does exists.
if ( ! open ( IN , "hplog -t |" ) ) {
logger ( "$myself: unable to execute 'hplog'. $!" ) ;
return ;
}
# save the output of 'hplog -t' since only 'root' is able to run it
my @ data = <IN> ;
close ( IN ) ;
2013-01-31 13:44:06 +00:00
open ( OUT , "> $config->{base_dir}/cgi/monitorix.hplog" ) ;
2013-01-04 08:27:05 +00:00
print ( OUT @ data ) ;
close ( OUT ) ;
2013-10-22 09:28:56 +01:00
if ( - e $ rrd ) {
$ info = RRDs:: info ( $ rrd ) ;
for my $ key ( keys %$ info ) {
if ( index ( $ key , 'rra[' ) == 0 ) {
if ( index ( $ key , '.rows' ) != - 1 ) {
push ( @ rra , substr ( $ key , 4 , index ( $ key , ']' ) - 4 ) ) ;
}
}
}
2013-11-04 15:51:19 +00:00
if ( scalar ( @ rra ) < 12 + ( 4 * $ config - > { max_historic_years } ) ) {
2013-10-24 09:49:58 +01:00
logger ( "$myself: Detected size mismatch between 'max_historic_years' (" . $ config - > { max_historic_years } . ") and $rrd (" . ( ( scalar ( @ rra ) - 12 ) / 4 ) . "). Resizing it accordingly. All historical data will be lost. Backup file created." ) ;
2013-10-22 09:28:56 +01:00
rename ( $ rrd , "$rrd.bak" ) ;
}
}
2013-01-04 08:27:05 +00:00
if ( ! ( - e $ rrd ) ) {
logger ( "Creating '$rrd' file." ) ;
2013-10-22 09:28:56 +01:00
for ( $ n = 1 ; $ n <= $ config - > { max_historic_years } ; $ n + + ) {
push ( @ average , "RRA:AVERAGE:0.5:1440:" . ( 365 * $ n ) ) ;
push ( @ min , "RRA:MIN:0.5:1440:" . ( 365 * $ n ) ) ;
push ( @ max , "RRA:MAX:0.5:1440:" . ( 365 * $ n ) ) ;
push ( @ last , "RRA:LAST:0.5:1440:" . ( 365 * $ n ) ) ;
}
2013-01-04 08:27:05 +00:00
eval {
RRDs:: create ( $ rrd ,
"--step=60" ,
"DS:hptemp1_1:GAUGE:120:0:100" ,
"DS:hptemp1_2:GAUGE:120:0:100" ,
"DS:hptemp1_3:GAUGE:120:0:100" ,
"DS:hptemp1_4:GAUGE:120:0:100" ,
"DS:hptemp1_5:GAUGE:120:0:100" ,
"DS:hptemp1_6:GAUGE:120:0:100" ,
"DS:hptemp1_7:GAUGE:120:0:100" ,
"DS:hptemp1_8:GAUGE:120:0:100" ,
"DS:hptemp2_1:GAUGE:120:0:100" ,
"DS:hptemp2_2:GAUGE:120:0:100" ,
"DS:hptemp2_3:GAUGE:120:0:100" ,
"DS:hptemp2_4:GAUGE:120:0:100" ,
"DS:hptemp2_5:GAUGE:120:0:100" ,
"DS:hptemp2_6:GAUGE:120:0:100" ,
"DS:hptemp3_1:GAUGE:120:0:100" ,
"DS:hptemp3_2:GAUGE:120:0:100" ,
"DS:hptemp3_3:GAUGE:120:0:100" ,
"DS:hptemp3_4:GAUGE:120:0:100" ,
"DS:hptemp3_5:GAUGE:120:0:100" ,
"DS:hptemp3_6:GAUGE:120:0:100" ,
"RRA:AVERAGE:0.5:1:1440" ,
"RRA:AVERAGE:0.5:30:336" ,
"RRA:AVERAGE:0.5:60:744" ,
2013-10-22 09:28:56 +01:00
@ average ,
2013-01-04 08:27:05 +00:00
"RRA:MIN:0.5:1:1440" ,
"RRA:MIN:0.5:30:336" ,
"RRA:MIN:0.5:60:744" ,
2013-10-22 09:28:56 +01:00
@ min ,
2013-01-04 08:27:05 +00:00
"RRA:MAX:0.5:1:1440" ,
"RRA:MAX:0.5:30:336" ,
"RRA:MAX:0.5:60:744" ,
2013-10-22 09:28:56 +01:00
@ max ,
2013-01-04 08:27:05 +00:00
"RRA:LAST:0.5:1:1440" ,
"RRA:LAST:0.5:30:336" ,
"RRA:LAST:0.5:60:744" ,
2013-10-22 09:28:56 +01:00
@ last ,
2013-01-04 08:27:05 +00:00
) ;
} ;
my $ err = RRDs:: error ;
if ( $@ || $ err ) {
logger ( "$@" ) unless ! $@ ;
if ( $ err ) {
logger ( "ERROR: while creating $rrd: $err" ) ;
if ( $ err eq "RRDs::error" ) {
logger ( "... is the RRDtool Perl package installed?" ) ;
}
}
return ;
}
}
2017-07-28 12:02:10 +01:00
$ config - > { hptemp_hist_alerts } = ( ) ;
2013-01-04 08:27:05 +00:00
push ( @ { $ config - > { func_update } } , $ package ) ;
logger ( "$myself: Ok" ) if $ debug ;
}
2017-07-28 12:02:10 +01:00
sub hptemp_alerts {
my $ myself = ( caller ( 0 ) ) [ 3 ] ;
my $ config = ( shift ) ;
my $ sensor = ( shift ) ;
my $ val = ( shift ) ;
my $ hptemp = $ config - > { hptemp } ;
my @ al = split ( ',' , $ hptemp - > { alerts } - > { $ sensor } || "" ) ;
if ( scalar ( @ al ) ) {
my $ timeintvl = trim ( $ al [ 0 ] ) ;
my $ threshold = trim ( $ al [ 1 ] ) ;
my $ script = trim ( $ al [ 2 ] ) ;
if ( ! $ threshold || $ val < $ threshold ) {
$ config - > { hptemp_hist_alerts } - > { $ sensor } = 0 ;
} else {
if ( ! $ config - > { hptemp_hist_alerts } - > { $ sensor } ) {
$ config - > { hptemp_hist_alerts } - > { $ sensor } = time ;
}
if ( $ config - > { hptemp_hist_alerts } - > { $ sensor } > 0 && ( time - $ config - > { hptemp_hist_alerts } - > { $ sensor } ) >= $ timeintvl ) {
if ( - x $ script ) {
logger ( "$myself: alert on HP Temp ($sensor): executing script '$script'." ) ;
system ( $ script . " " . $ timeintvl . " " . $ threshold . " " . $ val ) ;
} else {
logger ( "$myself: ERROR: script '$script' doesn't exist or don't has execution permissions." ) ;
}
$ config - > { hptemp_hist_alerts } - > { $ sensor } = time ;
}
}
}
}
2013-01-04 08:27:05 +00:00
sub hptemp_update {
my $ myself = ( caller ( 0 ) ) [ 3 ] ;
my ( $ package , $ config , $ debug ) = @ _ ;
my $ rrd = $ config - > { base_lib } . $ package . ".rrd" ;
my $ hptemp = $ config - > { hptemp } ;
my @ hptemp1 ;
my @ hptemp2 ;
my @ hptemp3 ;
my $ l ;
my $ n ;
my $ rrdata = "N" ;
if ( ! open ( IN , "hplog -t |" ) ) {
logger ( "$myself: unable to execute 'hplog'. $!" ) ;
return ;
}
my @ data = <IN> ;
close ( IN ) ;
my $ str ;
for ( $ l = 0 ; $ l < scalar ( @ data ) ; $ l + + ) {
2013-01-11 11:36:25 +00:00
foreach my $ t ( split ( ',' , ( $ hptemp - > { graph_0 } || "" ) ) ) {
2013-01-04 08:27:05 +00:00
$ str = sprintf ( "%2d" , trim ( $ t ) ) ;
if ( $ data [ $ l ] =~ m/^$str / ) {
my $ temp = trim ( substr ( $ data [ $ l ] , 47 , 3 ) ) ;
chomp ( $ temp ) ;
2015-02-23 09:51:52 +00:00
$ temp =~ s/C// ;
2013-01-04 08:27:05 +00:00
push ( @ hptemp1 , map { $ _ eq "---" ? 0 : $ _ } ( $ temp ) ) ;
2017-07-28 12:02:10 +01:00
# check alerts for each sensor defined
hptemp_alerts ( $ config , $ str , $ temp ) ;
2013-01-04 08:27:05 +00:00
}
}
2013-01-11 11:36:25 +00:00
foreach my $ t ( split ( ',' , ( $ hptemp - > { graph_1 } || "" ) ) ) {
2013-01-04 08:27:05 +00:00
$ str = sprintf ( "%2d" , trim ( $ t ) ) ;
if ( $ data [ $ l ] =~ m/^$str / ) {
my $ temp = trim ( substr ( $ data [ $ l ] , 47 , 3 ) ) ;
chomp ( $ temp ) ;
2015-02-23 09:51:52 +00:00
$ temp =~ s/C// ;
2013-01-04 08:27:05 +00:00
push ( @ hptemp2 , map { $ _ eq "---" ? 0 : $ _ } ( $ temp ) ) ;
2017-07-28 12:02:10 +01:00
# check alerts for each sensor defined
hptemp_alerts ( $ config , $ str , $ temp ) ;
2013-01-04 08:27:05 +00:00
}
}
2013-01-11 11:36:25 +00:00
foreach my $ t ( split ( ',' , ( $ hptemp - > { graph_2 } || "" ) ) ) {
2013-01-04 08:27:05 +00:00
$ str = sprintf ( "%2d" , trim ( $ t ) ) ;
if ( $ data [ $ l ] =~ m/^$str / ) {
my $ temp = trim ( substr ( $ data [ $ l ] , 47 , 3 ) ) ;
chomp ( $ temp ) ;
2015-02-23 09:51:52 +00:00
$ temp =~ s/C// ;
2013-01-04 08:27:05 +00:00
push ( @ hptemp3 , map { $ _ eq "---" ? 0 : $ _ } ( $ temp ) ) ;
2017-07-28 12:02:10 +01:00
# check alerts for each sensor defined
hptemp_alerts ( $ config , $ str , $ temp ) ;
2013-01-04 08:27:05 +00:00
}
}
}
for ( $ n = 0 ; $ n < 8 ; $ n + + ) {
$ hptemp1 [ $ n ] = 0 unless $ hptemp1 [ $ n ] ;
$ rrdata . = ":$hptemp1[$n]" ;
}
for ( $ n = 0 ; $ n < 6 ; $ n + + ) {
$ hptemp2 [ $ n ] = 0 unless $ hptemp2 [ $ n ] ;
$ rrdata . = ":$hptemp2[$n]" ;
}
for ( $ n = 0 ; $ n < 6 ; $ n + + ) {
$ hptemp3 [ $ n ] = 0 unless $ hptemp3 [ $ n ] ;
$ rrdata . = ":$hptemp3[$n]" ;
}
RRDs:: update ( $ rrd , $ rrdata ) ;
logger ( "$myself: $rrdata" ) if $ debug ;
my $ err = RRDs:: error ;
logger ( "ERROR: while updating $rrd: $err" ) if $ err ;
}
sub hptemp_cgi {
my ( $ package , $ config , $ cgi ) = @ _ ;
2017-07-28 11:13:27 +01:00
my @ output ;
2013-01-04 08:27:05 +00:00
my $ hptemp = $ config - > { hptemp } ;
2014-06-18 09:08:02 +01:00
my @ rigid = split ( ',' , ( $ hptemp - > { rigid } || "" ) ) ;
my @ limit = split ( ',' , ( $ hptemp - > { limit } || "" ) ) ;
2013-01-04 08:27:05 +00:00
my $ tf = $ cgi - > { tf } ;
my $ colors = $ cgi - > { colors } ;
my $ graph = $ cgi - > { graph } ;
my $ silent = $ cgi - > { silent } ;
2013-07-29 17:03:13 +01:00
my $ zoom = "--zoom=" . $ config - > { global_zoom } ;
2014-12-30 16:19:49 +00:00
my % rrd = (
'new' = > \ & RRDs:: graphv ,
'old' = > \ & RRDs:: graph ,
) ;
my $ version = "new" ;
my $ pic ;
my $ picz ;
my $ picz_width ;
my $ picz_height ;
2013-01-04 08:27:05 +00:00
my $ u = "" ;
my $ width ;
my $ height ;
2014-06-18 09:08:02 +01:00
my @ riglim ;
2013-03-27 18:26:24 +00:00
my $ temp_scale = "Celsius" ;
2013-01-04 08:27:05 +00:00
my @ tmp ;
my @ tmpz ;
2013-03-27 18:26:24 +00:00
my @ CDEF ;
2013-01-04 08:27:05 +00:00
my $ n ;
my $ id ;
my $ str ;
my $ err ;
my @ LC = (
"#FFA500" ,
"#44EEEE" ,
"#44EE44" ,
"#4444EE" ,
"#448844" ,
"#EE4444" ,
"#EE44EE" ,
"#EEEE44" ,
) ;
2014-12-30 16:19:49 +00:00
$ version = "old" if $ RRDs:: VERSION < 1.3 ;
2013-01-04 08:27:05 +00:00
my $ rrd = $ config - > { base_lib } . $ package . ".rrd" ;
my $ title = $ config - > { graph_title } - > { $ package } ;
2016-01-25 17:35:30 +00:00
my $ IMG_DIR = $ config - > { base_dir } . "/" . $ config - > { imgs_dir } ;
my $ imgfmt_uc = uc ( $ config - > { image_format } ) ;
my $ imgfmt_lc = lc ( $ config - > { image_format } ) ;
2013-01-04 08:27:05 +00:00
$ title = ! $ silent ? $ title : "" ;
2013-03-27 18:58:09 +00:00
if ( lc ( $ config - > { temperature_scale } ) eq "f" ) {
2013-03-27 18:26:24 +00:00
$ temp_scale = "Fahrenheit" ;
}
2013-01-04 08:27:05 +00:00
open ( IN , "monitorix.hplog" ) ;
my @ hplog = <IN> ;
close ( IN ) ;
if ( ! scalar ( @ hplog ) ) {
print ( "WARNING: 'hplog' command output is empty." ) ;
}
# text mode
#
if ( lc ( $ config - > { iface_mode } ) eq "text" ) {
if ( $ title ) {
2017-07-28 11:13:27 +01:00
push ( @ output , main:: graph_header ( $ title , 2 ) ) ;
push ( @ output , " <tr>\n" ) ;
push ( @ output , " <td bgcolor='$colors->{title_bg_color}'>\n" ) ;
2013-01-04 08:27:05 +00:00
}
my ( undef , undef , undef , $ data ) = RRDs:: fetch ( "$rrd" ,
"--start=-$tf->{nwhen}$tf->{twhen}" ,
"AVERAGE" ,
"-r $tf->{res}" ) ;
$ err = RRDs:: error ;
2017-07-28 11:13:27 +01:00
push ( @ output , "ERROR: while fetching $rrd: $err\n" ) if $ err ;
2013-01-04 08:27:05 +00:00
my $ str ;
my $ line1 ;
my $ line2 ;
2017-07-28 11:13:27 +01:00
push ( @ output , " <pre style='font-size: 12px; color: $colors->{fg_color}';>\n" ) ;
2013-01-09 18:23:49 +00:00
foreach my $ t ( split ( ',' , $ hptemp - > { graph_0 } ) , split ( ',' , $ hptemp - > { graph_1 } ) , split ( ',' , $ hptemp - > { graph_2 } ) ) {
2013-01-04 08:27:05 +00:00
$ id = sprintf ( "%2d" , trim ( $ t ) ) ;
for ( $ n = 0 ; $ n < scalar ( @ hplog ) ; $ n + + ) {
$ _ = $ hplog [ $ n ] ;
if ( /^$id / ) {
$ str = substr ( $ _ , 17 , 8 ) ;
$ str = sprintf ( "%8s" , $ str ) ;
$ line1 . = " " ;
$ line1 . = $ str ;
$ line2 . = "----------" ;
}
}
}
2017-07-28 11:13:27 +01:00
push ( @ output , "Time $line1 \n" ) ;
push ( @ output , "-----$line2\n" ) ;
2013-01-04 08:27:05 +00:00
my $ line ;
my @ row ;
my $ time ;
my $ n2 ;
for ( $ n = 0 , $ time = $ tf - > { tb } ; $ n < ( $ tf - > { tb } * $ tf - > { ts } ) ; $ n + + ) {
$ line = @$ data [ $ n ] ;
$ time = $ time - ( 1 / $ tf - > { ts } ) ;
2017-07-28 11:13:27 +01:00
push ( @ output , sprintf ( " %2d$tf->{tc} " , $ time ) ) ;
2013-01-04 08:27:05 +00:00
undef ( $ line1 ) ;
undef ( @ row ) ;
2013-01-09 18:23:49 +00:00
for ( $ n2 = 0 ; $ n2 < scalar ( my @ hp = split ( ',' , $ hptemp - > { graph_0 } ) ) ; $ n2 + + ) {
2013-01-04 08:27:05 +00:00
my $ temp = @$ line [ $ n2 ] ;
2013-03-27 18:26:24 +00:00
push ( @ row , celsius_to ( $ config , $ temp ) ) ;
2013-01-04 08:27:05 +00:00
$ line1 . = " %8.0f " ;
}
2013-01-09 18:23:49 +00:00
for ( $ n2 = 0 ; $ n2 < scalar ( my @ hp = split ( ',' , $ hptemp - > { graph_1 } ) ) ; $ n2 + + ) {
2013-01-04 08:27:05 +00:00
my $ temp = @$ line [ 8 + $ n2 ] ;
2013-03-27 18:26:24 +00:00
push ( @ row , celsius_to ( $ config , $ temp ) ) ;
2013-01-04 08:27:05 +00:00
$ line1 . = " %8.0f " ;
}
2013-01-09 18:23:49 +00:00
for ( $ n2 = 0 ; $ n2 < scalar ( my @ hp = split ( ',' , $ hptemp - > { graph_2 } ) ) ; $ n2 + + ) {
2013-01-04 08:27:05 +00:00
my $ temp = @$ line [ 8 + 3 + $ n2 ] ;
2013-03-27 18:26:24 +00:00
push ( @ row , celsius_to ( $ config , $ temp ) ) ;
2013-01-04 08:27:05 +00:00
$ line1 . = " %8.0f " ;
}
2017-07-28 11:13:27 +01:00
push ( @ output , ( sprintf ( $ line1 , @ row ) ) ) ;
push ( @ output , "\n" ) ;
2013-01-04 08:27:05 +00:00
}
2017-07-28 11:13:27 +01:00
push ( @ output , " </pre>\n" ) ;
2013-01-04 08:27:05 +00:00
if ( $ title ) {
2017-07-28 11:13:27 +01:00
push ( @ output , " </td>\n" ) ;
push ( @ output , " </tr>\n" ) ;
push ( @ output , main:: graph_footer ( ) ) ;
2013-01-04 08:27:05 +00:00
}
2017-07-28 11:13:27 +01:00
push ( @ output , " <br>\n" ) ;
return @ output ;
2013-01-04 08:27:05 +00:00
}
# graph mode
#
if ( $ silent eq "yes" || $ silent eq "imagetag" ) {
$ colors - > { fg_color } = "#000000" ; # visible color for text mode
$ u = "_" ;
}
if ( $ silent eq "imagetagbig" ) {
$ colors - > { fg_color } = "#000000" ; # visible color for text mode
$ u = "" ;
}
2016-01-25 17:35:30 +00:00
my $ IMG1 = $ u . $ package . "1." . $ tf - > { when } . ".$imgfmt_lc" ;
my $ IMG2 = $ u . $ package . "2." . $ tf - > { when } . ".$imgfmt_lc" ;
my $ IMG3 = $ u . $ package . "3." . $ tf - > { when } . ".$imgfmt_lc" ;
my $ IMG1z = $ u . $ package . "1z." . $ tf - > { when } . ".$imgfmt_lc" ;
my $ IMG2z = $ u . $ package . "2z." . $ tf - > { when } . ".$imgfmt_lc" ;
my $ IMG3z = $ u . $ package . "3z." . $ tf - > { when } . ".$imgfmt_lc" ;
unlink ( "$IMG_DIR" . "$IMG1" ,
"$IMG_DIR" . "$IMG2" ,
"$IMG_DIR" . "$IMG3" ) ;
2013-01-04 08:27:05 +00:00
if ( lc ( $ config - > { enable_zoom } ) eq "y" ) {
2016-01-25 17:35:30 +00:00
unlink ( "$IMG_DIR" . "$IMG1z" ,
"$IMG_DIR" . "$IMG2z" ,
"$IMG_DIR" . "$IMG3z" ) ;
2013-01-04 08:27:05 +00:00
}
if ( $ title ) {
2017-07-28 11:13:27 +01:00
push ( @ output , main:: graph_header ( $ title , 2 ) ) ;
push ( @ output , " <tr>\n" ) ;
push ( @ output , " <td bgcolor='$colors->{title_bg_color}'>\n" ) ;
2013-01-04 08:27:05 +00:00
}
2014-06-18 09:08:02 +01:00
@ riglim = @ { setup_riglim ( $ rigid [ 0 ] , $ limit [ 0 ] ) } ;
2013-01-11 11:36:25 +00:00
if ( scalar ( my @ hptemp0 = split ( ',' , ( $ hptemp - > { graph_0 } || "" ) ) ) ) {
2013-03-27 18:26:24 +00:00
undef ( @ CDEF ) ;
2013-01-04 08:27:05 +00:00
undef ( @ tmp ) ;
undef ( @ tmpz ) ;
for ( $ n = 0 ; $ n < 8 ; $ n + + ) {
if ( $ hptemp0 [ $ n ] ) {
foreach ( @ hplog ) {
$ id = sprintf ( "%2d" , trim ( $ hptemp0 [ $ n ] ) ) ;
if ( /^$id / ) {
$ str = substr ( $ _ , 17 , 8 ) ;
$ str = sprintf ( "%-20s" , $ str ) ;
2013-03-27 18:26:24 +00:00
push ( @ tmp , "LINE2:temp_" . $ n . $ LC [ $ n ] . ":$str" ) ;
push ( @ tmp , "GPRINT:temp_" . $ n . ":LAST:Current\\: %2.0lf" ) ;
push ( @ tmp , "GPRINT:temp_" . $ n . ":AVERAGE: Average\\: %2.0lf" ) ;
push ( @ tmp , "GPRINT:temp_" . $ n . ":MIN: Min\\: %2.0lf" ) ;
push ( @ tmp , "GPRINT:temp_" . $ n . ":MAX: Max\\: %2.0lf\\n" ) ;
2013-01-04 08:27:05 +00:00
$ str =~ s/\s+$// ;
2013-03-27 18:26:24 +00:00
push ( @ tmpz , "LINE2:temp_" . $ n . $ LC [ $ n ] . ":$str" ) ;
2013-01-04 08:27:05 +00:00
last ;
}
}
} else {
push ( @ tmp , "COMMENT: \\n" ) ;
}
}
2013-03-27 18:58:09 +00:00
if ( lc ( $ config - > { temperature_scale } ) eq "f" ) {
2013-03-27 18:26:24 +00:00
push ( @ CDEF , "CDEF:temp_0=9,5,/,temp0,*,32,+" ) ;
push ( @ CDEF , "CDEF:temp_1=9,5,/,temp1,*,32,+" ) ;
push ( @ CDEF , "CDEF:temp_2=9,5,/,temp2,*,32,+" ) ;
push ( @ CDEF , "CDEF:temp_3=9,5,/,temp3,*,32,+" ) ;
push ( @ CDEF , "CDEF:temp_4=9,5,/,temp4,*,32,+" ) ;
push ( @ CDEF , "CDEF:temp_5=9,5,/,temp5,*,32,+" ) ;
push ( @ CDEF , "CDEF:temp_6=9,5,/,temp6,*,32,+" ) ;
push ( @ CDEF , "CDEF:temp_7=9,5,/,temp7,*,32,+" ) ;
} else {
push ( @ CDEF , "CDEF:temp_0=temp0" ) ;
push ( @ CDEF , "CDEF:temp_1=temp1" ) ;
push ( @ CDEF , "CDEF:temp_2=temp2" ) ;
push ( @ CDEF , "CDEF:temp_3=temp3" ) ;
push ( @ CDEF , "CDEF:temp_4=temp4" ) ;
push ( @ CDEF , "CDEF:temp_5=temp5" ) ;
push ( @ CDEF , "CDEF:temp_6=temp6" ) ;
push ( @ CDEF , "CDEF:temp_7=temp7" ) ;
}
2013-07-01 16:36:04 +01:00
if ( lc ( $ config - > { show_gaps } ) eq "y" ) {
push ( @ tmp , "AREA:wrongdata#$colors->{gap}:" ) ;
push ( @ tmpz , "AREA:wrongdata#$colors->{gap}:" ) ;
push ( @ CDEF , "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF" ) ;
}
2013-01-04 08:27:05 +00:00
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { main } ) ;
if ( $ silent =~ /imagetag/ ) {
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { remote } ) if $ silent eq "imagetag" ;
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { main } ) if $ silent eq "imagetagbig" ;
@ tmp = @ tmpz ;
}
2016-01-25 17:35:30 +00:00
$ pic = $ rrd { $ version } - > ( "$IMG_DIR" . "$IMG1" ,
2013-01-04 08:27:05 +00:00
"--title=$config->{graphs}->{_hptemp1} ($tf->{nwhen}$tf->{twhen})" ,
"--start=-$tf->{nwhen}$tf->{twhen}" ,
2016-01-25 17:35:30 +00:00
"--imgformat=$imgfmt_uc" ,
2013-03-27 18:26:24 +00:00
"--vertical-label=$temp_scale" ,
2013-01-04 08:27:05 +00:00
"--width=$width" ,
"--height=$height" ,
2014-06-18 09:08:02 +01:00
@ riglim ,
2013-07-29 17:03:13 +01:00
$ zoom ,
2013-01-04 08:27:05 +00:00
@ { $ cgi - > { version12 } } ,
@ { $ colors - > { graph_colors } } ,
"DEF:temp0=$rrd:hptemp1_1:AVERAGE" ,
"DEF:temp1=$rrd:hptemp1_2:AVERAGE" ,
"DEF:temp2=$rrd:hptemp1_3:AVERAGE" ,
"DEF:temp3=$rrd:hptemp1_4:AVERAGE" ,
"DEF:temp4=$rrd:hptemp1_5:AVERAGE" ,
"DEF:temp5=$rrd:hptemp1_6:AVERAGE" ,
"DEF:temp6=$rrd:hptemp1_7:AVERAGE" ,
"DEF:temp7=$rrd:hptemp1_8:AVERAGE" ,
2013-07-01 16:36:04 +01:00
"CDEF:allvalues=temp0,temp1,temp2,temp3,temp4,temp5,temp6,temp7,+,+,+,+,+,+,+" ,
2013-03-27 18:26:24 +00:00
@ CDEF ,
2013-01-04 08:27:05 +00:00
@ tmp ,
"COMMENT: \\n" ) ;
$ err = RRDs:: error ;
2017-07-28 11:13:27 +01:00
push ( @ output , "ERROR: while graphing $IMG_DIR" . "$IMG1: $err\n" ) if $ err ;
2013-01-04 08:27:05 +00:00
if ( lc ( $ config - > { enable_zoom } ) eq "y" ) {
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { zoom } ) ;
2016-01-25 17:35:30 +00:00
$ picz = $ rrd { $ version } - > ( "$IMG_DIR" . "$IMG1z" ,
2013-01-04 08:27:05 +00:00
"--title=$config->{graphs}->{_hptemp1} ($tf->{nwhen}$tf->{twhen})" ,
"--start=-$tf->{nwhen}$tf->{twhen}" ,
2016-01-25 17:35:30 +00:00
"--imgformat=$imgfmt_uc" ,
2013-03-27 18:26:24 +00:00
"--vertical-label=$temp_scale" ,
2013-01-04 08:27:05 +00:00
"--width=$width" ,
"--height=$height" ,
2014-06-18 09:08:02 +01:00
@ riglim ,
2014-12-30 16:19:49 +00:00
$ zoom ,
2013-01-04 08:27:05 +00:00
@ { $ cgi - > { version12 } } ,
@ { $ colors - > { graph_colors } } ,
"DEF:temp0=$rrd:hptemp1_1:AVERAGE" ,
"DEF:temp1=$rrd:hptemp1_2:AVERAGE" ,
"DEF:temp2=$rrd:hptemp1_3:AVERAGE" ,
"DEF:temp3=$rrd:hptemp1_4:AVERAGE" ,
"DEF:temp4=$rrd:hptemp1_5:AVERAGE" ,
"DEF:temp5=$rrd:hptemp1_6:AVERAGE" ,
"DEF:temp6=$rrd:hptemp1_7:AVERAGE" ,
"DEF:temp7=$rrd:hptemp1_8:AVERAGE" ,
2013-07-01 16:36:04 +01:00
"CDEF:allvalues=temp0,temp1,temp2,temp3,temp4,temp5,temp6,temp7,+,+,+,+,+,+,+" ,
2013-03-27 18:26:24 +00:00
@ CDEF ,
2013-01-04 08:27:05 +00:00
@ tmpz ) ;
$ err = RRDs:: error ;
2017-07-28 11:13:27 +01:00
push ( @ output , "ERROR: while graphing $IMG_DIR" . "$IMG1z: $err\n" ) if $ err ;
2013-01-04 08:27:05 +00:00
}
if ( $ title || ( $ silent =~ /imagetag/ && $ graph =~ /hptemp1/ ) ) {
if ( lc ( $ config - > { enable_zoom } ) eq "y" ) {
if ( lc ( $ config - > { disable_javascript_void } ) eq "y" ) {
2017-07-28 11:13:27 +01:00
push ( @ output , " <a href=\"" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG1z . "\"><img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG1 . "' border='0'></a>\n" ) ;
2015-02-12 15:27:03 +00:00
} else {
2014-12-30 16:19:49 +00:00
if ( $ version eq "new" ) {
$ picz_width = $ picz - > { image_width } * $ config - > { global_zoom } ;
$ picz_height = $ picz - > { image_height } * $ config - > { global_zoom } ;
} else {
$ picz_width = $ width + 115 ;
$ picz_height = $ height + 100 ;
}
2017-07-28 11:13:27 +01:00
push ( @ output , " <a href=\"javascript:void(window.open('" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG1z . "','','width=" . $ picz_width . ",height=" . $ picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG1 . "' border='0'></a>\n" ) ;
2013-01-04 08:27:05 +00:00
}
} else {
2017-07-28 11:13:27 +01:00
push ( @ output , " <img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG1 . "'>\n" ) ;
2013-01-04 08:27:05 +00:00
}
}
}
if ( $ title ) {
2017-07-28 11:13:27 +01:00
push ( @ output , " </td>\n" ) ;
push ( @ output , " <td valign='top' bgcolor='" . $ colors - > { title_bg_color } . "'>\n" ) ;
2013-01-04 08:27:05 +00:00
}
2014-06-18 09:11:45 +01:00
@ riglim = @ { setup_riglim ( $ rigid [ 1 ] , $ limit [ 1 ] ) } ;
2013-01-11 11:36:25 +00:00
if ( scalar ( my @ hptemp1 = split ( ',' , ( $ hptemp - > { graph_1 } || "" ) ) ) ) {
2013-03-27 18:26:24 +00:00
undef ( @ CDEF ) ;
2013-01-04 08:27:05 +00:00
undef ( @ tmp ) ;
undef ( @ tmpz ) ;
for ( $ n = 0 ; $ n < 6 ; $ n + + ) {
if ( $ hptemp1 [ $ n ] ) {
foreach ( @ hplog ) {
$ id = sprintf ( "%2d" , trim ( $ hptemp1 [ $ n ] ) ) ;
if ( /^$id / ) {
$ str = substr ( $ _ , 17 , 8 ) ;
$ str = sprintf ( "%-8s" , $ str ) ;
2013-03-27 18:26:24 +00:00
push ( @ tmp , "LINE2:temp_" . $ n . $ LC [ $ n ] . ":$str" ) ;
push ( @ tmp , "GPRINT:temp_" . $ n . ":LAST:\\: %2.0lf" ) ;
2013-01-04 08:27:05 +00:00
if ( ! ( ( $ n + 1 ) % 2 ) ) {
push ( @ tmp , "COMMENT: \\n" ) ;
} else {
push ( @ tmp , "COMMENT: " ) ;
}
$ str =~ s/\s+$// ;
2013-03-27 18:26:24 +00:00
push ( @ tmpz , "LINE2:temp_" . $ n . $ LC [ $ n ] . ":$str" ) ;
2013-01-04 08:27:05 +00:00
last ;
}
}
} else {
push ( @ tmp , "COMMENT: \\n" ) unless ( $ n + 1 ) % 2 ;
}
}
2013-03-27 18:58:09 +00:00
if ( lc ( $ config - > { temperature_scale } ) eq "f" ) {
2013-03-27 18:26:24 +00:00
push ( @ CDEF , "CDEF:temp_0=9,5,/,temp0,*,32,+" ) ;
push ( @ CDEF , "CDEF:temp_1=9,5,/,temp1,*,32,+" ) ;
push ( @ CDEF , "CDEF:temp_2=9,5,/,temp2,*,32,+" ) ;
push ( @ CDEF , "CDEF:temp_3=9,5,/,temp3,*,32,+" ) ;
push ( @ CDEF , "CDEF:temp_4=9,5,/,temp4,*,32,+" ) ;
push ( @ CDEF , "CDEF:temp_5=9,5,/,temp5,*,32,+" ) ;
} else {
push ( @ CDEF , "CDEF:temp_0=temp0" ) ;
push ( @ CDEF , "CDEF:temp_1=temp1" ) ;
push ( @ CDEF , "CDEF:temp_2=temp2" ) ;
push ( @ CDEF , "CDEF:temp_3=temp3" ) ;
push ( @ CDEF , "CDEF:temp_4=temp4" ) ;
push ( @ CDEF , "CDEF:temp_5=temp5" ) ;
}
2013-07-01 16:36:04 +01:00
if ( lc ( $ config - > { show_gaps } ) eq "y" ) {
push ( @ tmp , "AREA:wrongdata#$colors->{gap}:" ) ;
push ( @ tmpz , "AREA:wrongdata#$colors->{gap}:" ) ;
push ( @ CDEF , "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF" ) ;
}
2013-01-04 08:27:05 +00:00
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { small } ) ;
if ( $ silent =~ /imagetag/ ) {
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { remote } ) if $ silent eq "imagetag" ;
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { main } ) if $ silent eq "imagetagbig" ;
@ tmp = @ tmpz ;
}
2016-01-25 17:35:30 +00:00
$ pic = $ rrd { $ version } - > ( "$IMG_DIR" . "$IMG2" ,
2013-01-04 08:27:05 +00:00
"--title=$config->{graphs}->{_hptemp2} ($tf->{nwhen}$tf->{twhen})" ,
"--start=-$tf->{nwhen}$tf->{twhen}" ,
2016-01-25 17:35:30 +00:00
"--imgformat=$imgfmt_uc" ,
2013-03-27 18:26:24 +00:00
"--vertical-label=$temp_scale" ,
2013-01-04 08:27:05 +00:00
"--width=$width" ,
"--height=$height" ,
"--lower-limit=0" ,
2013-07-29 17:03:13 +01:00
$ zoom ,
2013-01-04 08:27:05 +00:00
@ { $ cgi - > { version12 } } ,
@ { $ cgi - > { version12_small } } ,
@ { $ colors - > { graph_colors } } ,
"DEF:temp0=$rrd:hptemp2_1:AVERAGE" ,
"DEF:temp1=$rrd:hptemp2_2:AVERAGE" ,
"DEF:temp2=$rrd:hptemp2_3:AVERAGE" ,
"DEF:temp3=$rrd:hptemp2_4:AVERAGE" ,
"DEF:temp4=$rrd:hptemp2_5:AVERAGE" ,
"DEF:temp5=$rrd:hptemp2_6:AVERAGE" ,
2013-07-01 16:36:04 +01:00
"CDEF:allvalues=temp0,temp1,temp2,temp3,temp4,temp5,+,+,+,+,+" ,
2013-03-27 18:26:24 +00:00
@ CDEF ,
2013-01-04 08:27:05 +00:00
@ tmp ) ;
$ err = RRDs:: error ;
2017-07-28 11:13:27 +01:00
push ( @ output , "ERROR: while graphing $IMG_DIR" . "$IMG2: $err\n" ) if $ err ;
2013-01-04 08:27:05 +00:00
if ( lc ( $ config - > { enable_zoom } ) eq "y" ) {
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { zoom } ) ;
2016-01-25 17:35:30 +00:00
$ picz = $ rrd { $ version } - > ( "$IMG_DIR" . "$IMG2z" ,
2013-01-04 08:27:05 +00:00
"--title=$config->{graphs}->{_hptemp2} ($tf->{nwhen}$tf->{twhen})" ,
"--start=-$tf->{nwhen}$tf->{twhen}" ,
2016-01-25 17:35:30 +00:00
"--imgformat=$imgfmt_uc" ,
2013-03-27 18:26:24 +00:00
"--vertical-label=$temp_scale" ,
2013-01-04 08:27:05 +00:00
"--width=$width" ,
"--height=$height" ,
"--lower-limit=0" ,
2014-12-30 16:19:49 +00:00
$ zoom ,
2013-01-04 08:27:05 +00:00
@ { $ cgi - > { version12 } } ,
@ { $ cgi - > { version12_small } } ,
@ { $ colors - > { graph_colors } } ,
"DEF:temp0=$rrd:hptemp2_1:AVERAGE" ,
"DEF:temp1=$rrd:hptemp2_2:AVERAGE" ,
"DEF:temp2=$rrd:hptemp2_3:AVERAGE" ,
"DEF:temp3=$rrd:hptemp2_4:AVERAGE" ,
"DEF:temp4=$rrd:hptemp2_5:AVERAGE" ,
"DEF:temp5=$rrd:hptemp2_6:AVERAGE" ,
2013-07-01 16:36:04 +01:00
"CDEF:allvalues=temp0,temp1,temp2,temp3,temp4,temp5,+,+,+,+,+" ,
2013-03-27 18:26:24 +00:00
@ CDEF ,
2013-01-04 08:27:05 +00:00
@ tmpz ) ;
$ err = RRDs:: error ;
2017-07-28 11:13:27 +01:00
push ( @ output , "ERROR: while graphing $IMG_DIR" . "$IMG2z: $err\n" ) if $ err ;
2013-01-04 08:27:05 +00:00
}
if ( $ title || ( $ silent =~ /imagetag/ && $ graph =~ /hptemp2/ ) ) {
if ( lc ( $ config - > { enable_zoom } ) eq "y" ) {
if ( lc ( $ config - > { disable_javascript_void } ) eq "y" ) {
2017-07-28 11:13:27 +01:00
push ( @ output , " <a href=\"" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG2z . "\"><img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG2 . "' border='0'></a>\n" ) ;
2015-02-12 15:27:03 +00:00
} else {
2014-12-30 16:19:49 +00:00
if ( $ version eq "new" ) {
$ picz_width = $ picz - > { image_width } * $ config - > { global_zoom } ;
$ picz_height = $ picz - > { image_height } * $ config - > { global_zoom } ;
} else {
$ picz_width = $ width + 115 ;
$ picz_height = $ height + 100 ;
}
2017-07-28 11:13:27 +01:00
push ( @ output , " <a href=\"javascript:void(window.open('" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG2z . "','','width=" . $ picz_width . ",height=" . $ picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG2 . "' border='0'></a>\n" ) ;
2013-01-04 08:27:05 +00:00
}
} else {
2017-07-28 11:13:27 +01:00
push ( @ output , " <img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG2 . "'>\n" ) ;
2013-01-04 08:27:05 +00:00
}
}
}
2014-06-18 09:11:45 +01:00
@ riglim = @ { setup_riglim ( $ rigid [ 2 ] , $ limit [ 2 ] ) } ;
2013-01-11 11:36:25 +00:00
if ( scalar ( my @ hptemp2 = split ( ',' , ( $ hptemp - > { graph_2 } || "" ) ) ) ) {
2013-03-27 18:26:24 +00:00
undef ( @ CDEF ) ;
2013-01-04 08:27:05 +00:00
undef ( @ tmp ) ;
undef ( @ tmpz ) ;
for ( $ n = 0 ; $ n < 6 ; $ n + + ) {
if ( $ hptemp2 [ $ n ] ) {
foreach ( @ hplog ) {
$ id = sprintf ( "%2d" , trim ( $ hptemp2 [ $ n ] ) ) ;
if ( /^$id / ) {
$ str = substr ( $ _ , 17 , 8 ) ;
$ str = sprintf ( "%-8s" , $ str ) ;
2013-03-27 18:26:24 +00:00
push ( @ tmp , "LINE2:temp_" . $ n . $ LC [ $ n ] . ":$str" ) ;
push ( @ tmp , "GPRINT:temp_" . $ n . ":LAST:\\: %2.0lf" ) ;
2013-01-04 08:27:05 +00:00
if ( ! ( ( $ n + 1 ) % 2 ) ) {
push ( @ tmp , "COMMENT: \\n" ) ;
} else {
push ( @ tmp , "COMMENT: " ) ;
}
$ str =~ s/\s+$// ;
2013-03-27 18:26:24 +00:00
push ( @ tmpz , "LINE2:temp_" . $ n . $ LC [ $ n ] . ":$str" ) ;
2013-01-04 08:27:05 +00:00
last ;
}
}
} else {
push ( @ tmp , "COMMENT: \\n" ) unless ( $ n + 1 ) % 2 ;
}
}
2013-03-27 18:58:09 +00:00
if ( lc ( $ config - > { temperature_scale } ) eq "f" ) {
2013-03-27 18:26:24 +00:00
push ( @ CDEF , "CDEF:temp_0=9,5,/,temp0,*,32,+" ) ;
push ( @ CDEF , "CDEF:temp_1=9,5,/,temp1,*,32,+" ) ;
push ( @ CDEF , "CDEF:temp_2=9,5,/,temp2,*,32,+" ) ;
push ( @ CDEF , "CDEF:temp_3=9,5,/,temp3,*,32,+" ) ;
push ( @ CDEF , "CDEF:temp_4=9,5,/,temp4,*,32,+" ) ;
push ( @ CDEF , "CDEF:temp_5=9,5,/,temp5,*,32,+" ) ;
} else {
push ( @ CDEF , "CDEF:temp_0=temp0" ) ;
push ( @ CDEF , "CDEF:temp_1=temp1" ) ;
push ( @ CDEF , "CDEF:temp_2=temp2" ) ;
push ( @ CDEF , "CDEF:temp_3=temp3" ) ;
push ( @ CDEF , "CDEF:temp_4=temp4" ) ;
push ( @ CDEF , "CDEF:temp_5=temp5" ) ;
}
2013-07-01 16:36:04 +01:00
if ( lc ( $ config - > { show_gaps } ) eq "y" ) {
push ( @ tmp , "AREA:wrongdata#$colors->{gap}:" ) ;
push ( @ tmpz , "AREA:wrongdata#$colors->{gap}:" ) ;
push ( @ CDEF , "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF" ) ;
}
2013-01-04 08:27:05 +00:00
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { small } ) ;
if ( $ silent =~ /imagetag/ ) {
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { remote } ) if $ silent eq "imagetag" ;
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { main } ) if $ silent eq "imagetagbig" ;
@ tmp = @ tmpz ;
}
2016-01-25 17:35:30 +00:00
$ pic = $ rrd { $ version } - > ( "$IMG_DIR" . "$IMG3" ,
2013-01-04 08:27:05 +00:00
"--title=$config->{graphs}->{_hptemp3} ($tf->{nwhen}$tf->{twhen})" ,
"--start=-$tf->{nwhen}$tf->{twhen}" ,
2016-01-25 17:35:30 +00:00
"--imgformat=$imgfmt_uc" ,
2013-03-27 18:26:24 +00:00
"--vertical-label=$temp_scale" ,
2013-01-04 08:27:05 +00:00
"--width=$width" ,
"--height=$height" ,
"--lower-limit=0" ,
2013-07-29 17:03:13 +01:00
$ zoom ,
2013-01-04 08:27:05 +00:00
@ { $ cgi - > { version12 } } ,
@ { $ cgi - > { version12_small } } ,
@ { $ colors - > { graph_colors } } ,
"DEF:temp0=$rrd:hptemp3_1:AVERAGE" ,
"DEF:temp1=$rrd:hptemp3_2:AVERAGE" ,
"DEF:temp2=$rrd:hptemp3_3:AVERAGE" ,
"DEF:temp3=$rrd:hptemp3_4:AVERAGE" ,
"DEF:temp4=$rrd:hptemp3_5:AVERAGE" ,
"DEF:temp5=$rrd:hptemp3_6:AVERAGE" ,
2013-07-01 16:36:04 +01:00
"CDEF:allvalues=temp0,temp1,temp2,temp3,temp4,temp5,+,+,+,+,+" ,
2013-03-27 18:26:24 +00:00
@ CDEF ,
2013-01-04 08:27:05 +00:00
@ tmp ) ;
$ err = RRDs:: error ;
2017-07-28 11:13:27 +01:00
push ( @ output , "ERROR: while graphing $IMG_DIR" . "$IMG3: $err\n" ) if $ err ;
2013-01-04 08:27:05 +00:00
if ( lc ( $ config - > { enable_zoom } ) eq "y" ) {
( $ width , $ height ) = split ( 'x' , $ config - > { graph_size } - > { zoom } ) ;
2016-01-25 17:35:30 +00:00
$ picz = $ rrd { $ version } - > ( "$IMG_DIR" . "$IMG3z" ,
2013-01-04 08:27:05 +00:00
"--title=$config->{graphs}->{_hptemp3} ($tf->{nwhen}$tf->{twhen})" ,
"--start=-$tf->{nwhen}$tf->{twhen}" ,
2016-01-25 17:35:30 +00:00
"--imgformat=$imgfmt_uc" ,
2013-03-27 18:26:24 +00:00
"--vertical-label=$temp_scale" ,
2013-01-04 08:27:05 +00:00
"--width=$width" ,
"--height=$height" ,
"--lower-limit=0" ,
2014-12-30 16:19:49 +00:00
$ zoom ,
2013-01-04 08:27:05 +00:00
@ { $ cgi - > { version12 } } ,
@ { $ cgi - > { version12_small } } ,
@ { $ colors - > { graph_colors } } ,
"DEF:temp0=$rrd:hptemp3_1:AVERAGE" ,
"DEF:temp1=$rrd:hptemp3_2:AVERAGE" ,
"DEF:temp2=$rrd:hptemp3_3:AVERAGE" ,
"DEF:temp3=$rrd:hptemp3_4:AVERAGE" ,
"DEF:temp4=$rrd:hptemp3_5:AVERAGE" ,
"DEF:temp5=$rrd:hptemp3_6:AVERAGE" ,
2013-07-01 16:36:04 +01:00
"CDEF:allvalues=temp0,temp1,temp2,temp3,temp4,temp5,+,+,+,+,+" ,
2013-03-27 18:26:24 +00:00
@ CDEF ,
2013-01-04 08:27:05 +00:00
@ tmpz ) ;
$ err = RRDs:: error ;
2017-07-28 11:13:27 +01:00
push ( @ output , "ERROR: while graphing $IMG_DIR" . "$IMG3z: $err\n" ) if $ err ;
2013-01-04 08:27:05 +00:00
}
if ( $ title || ( $ silent =~ /imagetag/ && $ graph =~ /hptemp3/ ) ) {
if ( lc ( $ config - > { enable_zoom } ) eq "y" ) {
if ( lc ( $ config - > { disable_javascript_void } ) eq "y" ) {
2017-07-28 11:13:27 +01:00
push ( @ output , " <a href=\"" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG3z . "\"><img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG3 . "' border='0'></a>\n" ) ;
2015-02-12 15:27:03 +00:00
} else {
2014-12-30 16:19:49 +00:00
if ( $ version eq "new" ) {
$ picz_width = $ picz - > { image_width } * $ config - > { global_zoom } ;
$ picz_height = $ picz - > { image_height } * $ config - > { global_zoom } ;
} else {
$ picz_width = $ width + 115 ;
$ picz_height = $ height + 100 ;
}
2017-07-28 11:13:27 +01:00
push ( @ output , " <a href=\"javascript:void(window.open('" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG3z . "','','width=" . $ picz_width . ",height=" . $ picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG3 . "' border='0'></a>\n" ) ;
2013-01-04 08:27:05 +00:00
}
} else {
2017-07-28 11:13:27 +01:00
push ( @ output , " <img src='" . $ config - > { url } . "/" . $ config - > { imgs_dir } . $ IMG3 . "'>\n" ) ;
2013-01-04 08:27:05 +00:00
}
}
}
if ( $ title ) {
2017-07-28 11:13:27 +01:00
push ( @ output , " </td>\n" ) ;
push ( @ output , " </tr>\n" ) ;
push ( @ output , main:: graph_footer ( ) ) ;
2013-01-04 08:27:05 +00:00
}
2017-07-28 11:13:27 +01:00
push ( @ output , " <br>\n" ) ;
return @ output ;
2013-01-04 08:27:05 +00:00
}
1 ;