]>
git.ipfire.org Git - ipfire-2.x.git/blob - src/wio/wio-graphs.pl
3 ###############################################################################
5 # IPFire.org - A linux based firewall #
6 # Copyright (C) 2017-2020 Stephan Feddersen <sfeddersen@ipfire.org> #
7 # All Rights Reserved. #
9 # This program is free software: you can redistribute it and/or modify #
10 # it under the terms of the GNU General Public License as published by #
11 # the Free Software Foundation, either version 3 of the License, or #
12 # (at your option) any later version. #
14 # This program is distributed in the hope that it will be useful, #
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17 # GNU General Public License for more details. #
19 # You should have received a copy of the GNU General Public License #
20 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
22 ###############################################################################
24 # Version: 2020/05/26 10:34:23
26 # This wio-graphs.pl is based on the code from the IPCop WIO Addon
27 # and is extremly adapted to work with IPFire.
29 # Autor: Stephan Feddersen
30 # Co-Autor: Alexander Marx
37 # enable only the following on debugging purpose
42 require '/var/ipfire/general-functions.pl';
43 require '/var/ipfire/lang.pl';
45 my ( %mainsettings, %color ) = ();
47 &General
::readhash
('/var/ipfire/main/settings', \
%mainsettings);
48 &General
::readhash
('/srv/web/ipfire/html/themes/ipfire/include/colors.txt', \
%color);
55 my $title = "$host ($Lang::tr{$period})\n";
60 push @rrd, ("--title", "$title");
61 push @rrd, ("--start", "-1$period", "-aPNG", "-i", "-z");
62 push @rrd, ("--border", "0");
63 push @rrd, ("--full-size-mode");
64 push @rrd, ("--slope-mode");
65 push @rrd, ("--pango-markup");
66 push @rrd, ("--alt-y-grid", "-w 910", "-h 300");
67 if ( $period eq 'day' ) { push @rrd, ("--x-grid", "MINUTE:30:HOUR:1:HOUR:2:0:%H:%M"); }
68 push @rrd, ("--color", "SHADEA".$color{"color19"});
69 push @rrd, ("--color", "SHADEB".$color{"color19"});
70 push @rrd, ("--color", "BACK".$color{"color21"});
71 push @rrd, "DEF:mode=/var/log/rrd/wio/$hostid.rrd:mode:AVERAGE";
72 push @rrd, "CDEF:online=mode,UN,0,mode,IF,50,GT,100,0,IF";
73 push @rrd, "CDEF:offline=mode,UN,100,mode,IF,50,LT,100,0,IF";
74 push @rrd, "AREA:online".$color{"color12"}.":$Lang::tr{'wio up'}\\j";
75 push @rrd, "AREA:offline".$color{"color13"}.":$Lang::tr{'wio down'}\\j";
76 push @rrd, "-W www.ipfire.org";
80 my $error = RRDs
::error
;
81 print "Error in RRD::graph for Who Is Online: $error\n" if $error;
85 print "<table width='100%' align='center' cellspacing='0' border='0'>";
86 print "<tr><td align='center' bgcolor='".$color{"color20"}."'><a href='".$_[0]."?".$_[1]."?hour?".$_[3]."' target='".$_[1]."box'><b>".$Lang::tr
{'hour'}."</b></a></td>";
87 print "<td align='center' bgcolor='".$color{"color20"}."'><a href='".$_[0]."?".$_[1]."?day?".$_[3]."' target='".$_[1]."box'><b>".$Lang::tr
{'day'}."</b></a></td>";
88 print "<td align='center' bgcolor='".$color{"color20"}."'><a href='".$_[0]."?".$_[1]."?week?".$_[3]."' target='".$_[1]."box'><b>".$Lang::tr
{'week'}."</b></a></td>";
89 print "<td align='center' bgcolor='".$color{"color20"}."'><a href='".$_[0]."?".$_[1]."?month?".$_[3]."' target='".$_[1]."box'><b>".$Lang::tr
{'month'}."</b></a></td>";
90 print "<td align='center' bgcolor='".$color{"color20"}."'><a href='".$_[0]."?".$_[1]."?year?".$_[3]."' target='".$_[1]."box'><b>".$Lang::tr
{'year'}."</b></a></td></tr>";
91 print "<tr><td colspan='5' align='center'> </td></tr>";
92 print "<tr><td colspan='5' align='center'><iframe height='300px' width='940px' src='".$_[0]."?".$_[1]."?".$_[2]."?".$_[3]."' scrolling='no' marginheight='0' frameborder='no' name='".$_[1]."box'></iframe></td></tr>";