From patchwork Sun Jun 28 10:47:01 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephan Feddersen X-Patchwork-Id: 3228 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 49vnPY4TbHz3x34 for ; Sun, 28 Jun 2020 10:47:13 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail02.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 49vnPY1zPcz1XW; Sun, 28 Jun 2020 10:47:13 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 49vnPY0sSMz2yPM; Sun, 28 Jun 2020 10:47:13 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) client-signature ECDSA (P-384)) (Client CN "mail01.haj.ipfire.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 49vnPW13X4z2yNV for ; Sun, 28 Jun 2020 10:47:11 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (Client did not present a certificate) by mail01.ipfire.org (Postfix) with ESMTPSA id 49vnPV2bhqz1XW; Sun, 28 Jun 2020 10:47:10 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1593341230; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc; bh=Y5VFOnCEz+MxEZrwl4HsEIUEmATOrrOJq8BMziiRvKk=; b=UJ/YuY+IemX3xLn6x9aamY89PLrYb9J8H6/8gTFJthffKX8s9+DuyGFrZi80t6KilN82N/ DLjYmaPRm1PzG7DQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1593341230; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc; bh=Y5VFOnCEz+MxEZrwl4HsEIUEmATOrrOJq8BMziiRvKk=; b=qNWdy37S+gQOrg1lbHRzdjQhiCwAd/I+plVNGU1Jx0DoGviNLjGwzqQ89mCL12/WEwxKYt 1NyQgIVa86Jnxi75oj/feTOmTq4Aa2Ph4tBRBAIwwzKn0CQpdRwjWvrbBlr5kV5Q5xAxit ff6xq1W6u2Qyv3tPZuN0GWRx2o1p1/B/GgoEwHB17sGO8XwldWDwP/RqRWqDc4OZilDgcq nPe0vJYUq5o23PFr9RkeOOs1XvUbqTSRRSbSNUycXbvwfl3H98Dq0jGjHgBhAAIq7BGfT+ gqldBxWRHM6iRzpF/rZ8Aqp/mgXx/kyx37sT4RaHCYkPWvv2Td5Miywk4E/MjQ== From: Stephan Feddersen To: development@lists.ipfire.org Subject: [PATCH] WIO - shutdown function removed, adjustments to IPsec status display Date: Sun, 28 Jun 2020 12:47:01 +0200 Message-Id: <20200628104701.28739-1-sfeddersen@ipfire.org> Authentication-Results: mail01.ipfire.org; auth=pass smtp.mailfrom=sfeddersen@ipfire.org X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stephan Feddersen Errors-To: development-bounces@lists.ipfire.org Sender: "Development" --- src/wio/wio-graphs.pl | 97 ++++++++++++++----------------------------- 1 file changed, 32 insertions(+), 65 deletions(-) diff --git a/src/wio/wio-graphs.pl b/src/wio/wio-graphs.pl index af5c52062..0cfac20d6 100644 --- a/src/wio/wio-graphs.pl +++ b/src/wio/wio-graphs.pl @@ -3,7 +3,7 @@ ############################################################################### # # # IPFire.org - A linux based firewall # -# Copyright (C) 2017-2018 Stephan Feddersen # +# Copyright (C) 2017-2020 Stephan Feddersen # # All Rights Reserved. # # # # This program is free software: you can redistribute it and/or modify # @@ -21,9 +21,9 @@ # # ############################################################################### # -# Version: 2017/07/11 21:32:23 +# Version: 2020/05/26 10:34:23 # -# This wio-graphs.pl is based on the Code from the IPCop WIO Addon +# This wio-graphs.pl is based on the code from the IPCop WIO Addon # and is extremly adapted to work with IPFire. # # Autor: Stephan Feddersen @@ -45,18 +45,35 @@ require '/var/ipfire/lang.pl'; my ( %mainsettings, %color ) = (); &General::readhash('/var/ipfire/main/settings', \%mainsettings); -&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); +&General::readhash('/srv/web/ipfire/html/themes/'.$mainsettings{'THEME'}.'/include/colors.txt', \%color); -sub wio { - my $hostid = $_[0]; - my $hostname = $_[1]; - my $period = $_[2]; +sub wiograph { + my $hostid = $_[0]; + my $host = $_[1]; + my $period = $_[2]; + + my $title = "$host ($Lang::tr{$period})\n"; my @rrd = (); push @rrd, ("-"); - push @rrd, @{&header($period, "$hostname ($Lang::tr{$period})")}; - push @rrd, @{&body($hostid)}; + push @rrd, ("--title", "$title"); + push @rrd, ("--start", "-1$period", "-aPNG", "-i", "-z"); + push @rrd, ("--border", "0"); + push @rrd, ("--full-size-mode"); + push @rrd, ("--slope-mode"); + push @rrd, ("--pango-markup"); + push @rrd, ("--alt-y-grid", "-w 910", "-h 300"); + if ( $period eq 'day' ) { push @rrd, ("--x-grid", "MINUTE:30:HOUR:1:HOUR:2:0:%H:%M"); } + push @rrd, ("--color", "SHADEA".$color{"color19"}); + push @rrd, ("--color", "SHADEB".$color{"color19"}); + push @rrd, ("--color", "BACK".$color{"color21"}); + push @rrd, "DEF:mode=/var/log/rrd/wio/$hostid.rrd:mode:AVERAGE"; + push @rrd, "CDEF:online=mode,UN,0,mode,IF,50,GT,100,0,IF"; + push @rrd, "CDEF:offline=mode,UN,100,mode,IF,50,LT,100,0,IF"; + push @rrd, "AREA:online".$color{"color12"}.":$Lang::tr{'wio up'}\\j"; + push @rrd, "AREA:offline".$color{"color13"}.":$Lang::tr{'wio down'}\\j"; + push @rrd, "-W www.ipfire.org"; RRDs::graph (@rrd); @@ -64,64 +81,14 @@ sub wio { print "Error in RRD::graph for Who Is Online: $error\n" if $error; } -sub body { - my $hostid = shift; - my $result = []; - - push @$result, "DEF:mode=/var/log/rrd/wio/$hostid.rrd:mode:AVERAGE"; - push @$result, "CDEF:online=mode,UN,0,mode,IF,50,GT,100,0,IF"; - push @$result, "CDEF:offline=mode,UN,100,mode,IF,50,LT,100,0,IF"; - push @$result, "AREA:online".$color{"color12"}.":$Lang::tr{'wio up'}\\j"; - push @$result, "AREA:offline".$color{"color13"}.":$Lang::tr{'wio down'}\\j"; - push @$result, "COMMENT:\r$Lang::tr{'wio_last_update'}\\: ". lastupdate(scalar localtime()) ."\\r"; - - return $result; -} - -sub lastupdate { - my $text = shift; - - return undef if not defined $text; - $text =~ s/\\/\\\\/g; - $text =~ s/:/\\:/g; - - return $text; -} - -sub header { - my $period = shift; - my $title = shift; - my $result = []; - - push @$result, ("--title", "$title"); - push @$result, ("--start", "-1$period", "-aPNG", "-i", "-z"); - push @$result, ("--border", "0"); - push @$result, ("--full-size-mode"); - push @$result, ("--slope-mode"); - push @$result, ("--pango-markup"); - push @$result, ("--alt-y-grid", "-w 910", "-h 300"); - if ( $period eq 'day' ) { push @$result, ("--x-grid", "MINUTE:30:HOUR:1:HOUR:2:0:%H:%M"); } - push @$result, ("--color", "SHADEA".$color{"color19"}); - push @$result, ("--color", "SHADEB".$color{"color19"}); - push @$result, ("--color", "BACK".$color{"color21"}); - - return $result; -} - sub wiographbox { - print "
"; - print ""; - print ""; - print ""; + print "
".$Lang::tr{'hour'}."
"; + print ""; print ""; print ""; print ""; - print ""; - print ""; - print "
".$Lang::tr{'hour'}."".$Lang::tr{'day'}."".$Lang::tr{'week'}."".$Lang::tr{'month'}."".$Lang::tr{'year'}."
"; - print ""; - print ""; - print ""; + print ""; + print ""; + print ""; print "
 
".$Lang::tr{'year'}."
 
"; - print "
"; }