Feature Request: PINGGRAPH Zeitfenster variabel anzeigen

You would like to contribute something for IPFire?
Post Reply
neobiker
Posts: 39
Joined: April 17th, 2011, 8:48 pm
Contact:

Feature Request: PINGGRAPH Zeitfenster variabel anzeigen

Post by neobiker » March 11th, 2017, 10:41 am

Hallo,
ich würde das Zeitfenster des 'updatepinggraph' variabel benötigen, anstatt FIX wie es derzeit eingestellt ist.
Grund:
Um die Qualität der Provideranbindung zu dokumentieren - um sie dem Provider um die Ohren zu hauen - wäre es notwendig, den Startzeitpunkt weiter als 1 Monat / Woche zurück setzen zu können, und entweder die Anzahl oder das Ende zusätzlich zu definieren. Dann kann man ganz einfach <x> Wochen oder Monate graphisch anzeigen.

In graphs.pl ist fix der Startzeitpunkt definiert mit "-1<Period>" (hour,day,month,year).

Code: Select all

# Generate the Line Quality Graph for the current period of time for values given by collecd

sub updatepinggraph {
        my $period    = $_[1];
        my $host    = $_[0];
        RRDs::graph(
                "-",
                "--start",
                "-1".$period,
Vorschlag: Man könnte einen (Period-)Zeitversatz und die (Period-)Anzahl übergeben, mit z.B.

Code: Select all

# Generate the Line Quality Graph for the current period of time for values given by collecd

sub updatepinggraph {
        my ($host,$period,$periodshift,$periodcount) = @_;
        $periodshift = '0' unless defined $_[2];
        $periodcount = '1' unless defined $_[3];
        RRDs::graph(
                "-",
                "--start",
                "-".($periodshift+$periodcount).$period,
                "--end",
                "-".$periodshift.$period,
Mit dieser Änderung kann ich schonmal jedes Zeitfenster darstellen.

Im WebGui könnte man z.B. mit ' < >' die Periode verschieben, und mit ' + - ' die Anzahl ändern.
Was meint Ihr?

Wenn ich folgenden Link verwende, z.B. die letzten 7 Monate bis Januar (ich habe mal einfach das cgi kopiert und geändert)
"https://firewall:444/cgi-bin/netother2. ... ?month?1?7"
Attachments
netother2.png

neobiker
Posts: 39
Joined: April 17th, 2011, 8:48 pm
Contact:

Re: Feature Request: PINGGRAPH Zeitfenster variabel anzeigen

Post by neobiker » March 11th, 2017, 6:41 pm

Habe für mich mal die beiden files modifiziert:
  • /var/ipfire/graphs2.pl
  • /srv/web/ipfire/cgi-bin/netother2.cgi
Zum blättern '<<' nach links/zurück und '>>' nach rechts/vorwärts
sowie Zoom-Out / Zoom-In mit '++' und '--'
Attachments
Network-Other_Variabel.png

Hellfire
Posts: 475
Joined: November 8th, 2015, 8:54 am

Re: Feature Request: PINGGRAPH Zeitfenster variabel anzeigen

Post by Hellfire » August 1st, 2017, 4:42 pm

Hi neobiker,

ich würde dies auch gerne so einbauen, allerdings habe ich noch so meine Zweifel wo was zu modifizieren ist.

In der graphs.pl ausschließlich dieser Teil?

Code: Select all

# Generate the Line Quality Graph for the current period of time for values given by collecd

sub updatepinggraph {
        my ($host,$period,$periodshift,$periodcount) = @_;
        $periodshift = '0' unless defined $_[2];
        $periodcount = '1' unless defined $_[3];
        RRDs::graph(
                "-",
                "--start",
                "-".($periodshift+$periodcount).$period,
                "--end",
                "-".$periodshift.$period,
Und in der Datei /srv/web/ipfire/cgi-bin/netother.cgi ist was zu tun?

Danke und Grüße,
Michael
Image

neobiker
Posts: 39
Joined: April 17th, 2011, 8:48 pm
Contact:

Re: Feature Request: PINGGRAPH Zeitfenster variabel anzeigen

Post by neobiker » August 1st, 2017, 6:17 pm

File '/srv/web/ipfire/cgi-bin/netother2.cgi'

Code: Select all

[root@firewall cgi-bin]# diff netother2.cgi netother.cgi
31c31
< require "${General::swroot}/graphs2.pl";
---
> require "${General::swroot}/graphs.pl";
41,44c41,42
< $querry[0] = '' unless defined $querry[0];     # Host
< $querry[1] = 'day' unless defined $querry[1];  # Period
< $querry[2] = '1' unless defined $querry[2];    # Count
< $querry[3] = '0' unless defined $querry[3];    # Shift
---
> $querry[0] = '' unless defined $querry[0];
> $querry[1] = 'hour' unless defined $querry[1];
49,51c47,48
<       #        updatefwhitsgraph(period   , count    , shift );
<       &Graphs::updatefwhitsgraph($querry[1],$querry[2],$querry[3]);
< }elsif ( $querry[0] ne "" && $querry[0] ne "ping"){
---
>       &Graphs::updatefwhitsgraph($querry[1]);
> }elsif ( $querry[0] ne ""){
54,55c51
<       #        updatepinggraph( host     , period   , count    , shift );
<       &Graphs::updatepinggraph($querry[0],$querry[1],$querry[2],$querry[3]);
---
>       &Graphs::updatepinggraph($querry[0],$querry[1]);
70,71c66
<               #        makegraphbox( cgi         ,host,period,height, count, shift );
<               &Graphs::makegraphbox("netother2.cgi",$_,$querry[1],"",$querry[2],$querry[3]);
---
>               &Graphs::makegraphbox("netother.cgi",$_,"day");
76,77c71
<       #        makegraphbox(   cgi         ,host,     period ,height, count, shift );
<       &Graphs::makegraphbox("netother2.cgi","fwhits",$querry[1],"",$querry[2],$querry[3]);
---
>       &Graphs::makegraphbox("netother.cgi","fwhits","day");
96c90
< }
---
> }
[root@firewall cgi-bin]#

Dieses DIFF ist jetzt leider etwas grösser, denke wegen dem letztem update.

File '/var/ipfire/graphs2.pl'

Code: Select all

[root@firewall ipfire]# diff graphs2.pl graphs.pl
33a34,57
> my @GRAPH_ARGS = (
>       # Output format
>       "--imgformat", "PNG",
>
>       # No border
>       "--border", "0",
>
>       # For a more 'organic' look
>       "--slope-mode",
>
>       # HxW define the size of the output image
>       "--full-size-mode",
>
>       # Watermark
>       "-W www.ipfire.org",
>
>       # Default size
>       "-w 910",
>       "-h 300",
>
>       # Use alternative grid
>       "--alt-y-grid",
> );
>
80,91d103
<       my $height = 285;
<       my $width = 700;
<
<       my $period = 'day';
<       my $periodcount = '1';
<       my $periodshift = '0';
<
<       if ( $_[2] ne "" ){ $period = $_[2]; }
<       if ( $_[3] ne "" ){ $height = $_[3]; }
<       if ( $_[4] ne "" ){ $periodcount = $_[4]; }
<       if ( $_[5] ne "" ){ $periodshift = $_[5]; }
<
93,97c105
<       print "<a href='".$_[0]."??".$period."?".$periodcount."?".($periodshift+1)."'><b>&lt;&lt; </b></a>";
<       print "&nbsp;&nbsp;&nbsp;";
<       print "<a href='".$_[0]."??".$period."?".$periodcount."?".($periodshift-1)."'><b>&gt;&gt; </b></a>" if $periodshift ge 1;
<       print "&nbsp;&nbsp; || ";
<       print "<a href='".$_[0]."??hour?".$periodcount."?".$periodshift."'><b>".$Lang::tr{'hour'}."</b></a>";
---
>       print "<a href='".$_[0]."?".$_[1]."?hour' target='".$_[1]."box'><b>".$Lang::tr{'hour'}."</b></a>";
99c107
<       print "<a href='".$_[0]."??day?".$periodcount."?".$periodshift."'><b>".$Lang::tr{'day'}."</b></a>";
---
>       print "<a href='".$_[0]."?".$_[1]."?day' target='".$_[1]."box'><b>".$Lang::tr{'day'}."</b></a>";
101c109
<       print "<a href='".$_[0]."??week?".$periodcount."?".$periodshift."'><b>".$Lang::tr{'week'}."</b></a>";
---
>       print "<a href='".$_[0]."?".$_[1]."?week' target='".$_[1]."box'><b>".$Lang::tr{'week'}."</b></a>";
103c111
<       print "<a href='".$_[0]."??month?".$periodcount."?".$periodshift."'><b>".$Lang::tr{'month'}."</b></a>";
---
>       print "<a href='".$_[0]."?".$_[1]."?month' target='".$_[1]."box'><b>".$Lang::tr{'month'}."</b></a>";
105,109c113
<       print "<a href='".$_[0]."??year?".$periodcount."?".$periodshift."''><b>".$Lang::tr{'year'}."</b></a>";
<       print " || &nbsp;&nbsp;";
<       print "<a href='".$_[0]."??".$period."?".($periodcount-1)."?".$periodshift."'><b> -- </b></a>" if $periodcount gt 1;
<       print "&nbsp;&nbsp;&nbsp;";
<       print "<a href='".$_[0]."??".$period."?".($periodcount+1)."?".$periodshift."'><b> ++ </b></a>";
---
>       print "<a href='".$_[0]."?".$_[1]."?year' target='".$_[1]."box'><b>".$Lang::tr{'year'}."</b></a>";
111c115
<       print "<iframe src='".$_[0]."?".$_[1]."?".$period."?".$periodcount."?".$periodshift."' width='".$width."' height='".$height."' scrolling='no' frameborder='no' marginheight='0' name='".$_[1]."box'></iframe>";
---
>       print "<iframe class='graph' src='".$_[0]."?".$_[1]."?".$_[2]."' scrolling='no' frameborder='no' marginheight='0' name='".$_[1]."box'></iframe>";
120a125
>               @GRAPH_ARGS,
124,130d128
<               "-aPNG",
<               "-i",
<               "-z",
<               "-W www.ipfire.org",
<               "--alt-y-grid",
<               "-w 600",
<               "-h 125",
254a253
>               @GRAPH_ARGS,
258,264d256
<               "-aPNG",
<               "-i",
<               "-z",
<               "-W www.ipfire.org",
<               "--alt-y-grid",
<               "-w 600",
<               "-h 125",
292a285
>               @GRAPH_ARGS,
296,302d288
<               "-aPNG",
<               "-i",
<               "-z",
<               "-W www.ipfire.org",
<               "--alt-y-grid",
<               "-w 600",
<               "-h 125",
354a341
>               @GRAPH_ARGS,
358,364d344
<               "-aPNG",
<               "-i",
<               "-z",
<               "-W www.ipfire.org",
<               "--alt-y-grid",
<               "-w 600",
<               "-h 125",
412a393
>               @GRAPH_ARGS,
416,422d396
<               "-aPNG",
<               "-i",
<               "-z",
<               "-W www.ipfire.org",
<               "--alt-y-grid",
<               "-w 600",
<               "-h 125",
465a440
>               @GRAPH_ARGS,
469,475d443
<               "-aPNG",
<               "-i",
<               "-z",
<               "-W www.ipfire.org",
<               "--alt-y-grid",
<               "-w 600",
<               "-h 125",
515a484
>               @GRAPH_ARGS,
519,525d487
<               "-aPNG",
<               "-i",
<               "-z",
<               "-W www.ipfire.org",
<               "--alt-y-grid",
<               "-w 600",
<               "-h 125",
565a528
>               @GRAPH_ARGS,
569,575d531
<               "-aPNG",
<               "-i",
<               "-z",
<               "-W www.ipfire.org",
<               "--alt-y-grid",
<               "-w 600",
<               "-h 125",
608a565
>               @GRAPH_ARGS,
612,618d568
<               "-aPNG",
<               "-i",
<               "-z",
<               "-W www.ipfire.org",
<               "--alt-y-grid",
<               "-w 600",
<               "-h 125",
651a602
>               @GRAPH_ARGS,
655,661d605
<               "-aPNG",
<               "-i",
<               "-z",
<               "-W www.ipfire.org",
<               "--alt-y-grid",
<               "-w 600",
<               "-h 125",
720,723c664
<       my ($period,$periodcount,$periodshift) = @_;
<       $period      = 'day' if $period eq "";
<       $periodcount = '1'   if $periodcount eq "";
<       $periodshift = '0'   if $periodshift eq "";
---
>       my $period    = $_[0];
724a666
>               @GRAPH_ARGS,
727,736c669
<               "-".($periodshift+$periodcount).$period,
<               "--end",
<               "-".$periodshift.$period,
<               "-aPNG",
<               "-i",
<               "-z",
<               "-W www.ipfire.org",
<               "--alt-y-grid",
<               "-w 600",
<               "-h 125",
---
>               "-1".$period,
786,789c719,720
<       my ($host,$period,$periodcount,$periodshift) = @_;
<       $period      = 'day' if $period eq "";
<       $periodcount = '1'   if $periodcount eq "";
<       $periodshift = '0'   if $periodshift eq "";
---
>       my $period    = $_[1];
>       my $host    = $_[0];
790a722
>               @GRAPH_ARGS,
793,802c725
<               "-".($periodshift+$periodcount).$period,
<               "--end",
<               "-".$periodshift.$period,
<               "-aPNG",
<               "-i",
<               "-z",
<               "-W www.ipfire.org",
<               "--alt-y-grid",
<               "-w 600",
<               "-h 125",
---
>               "-1".$period,
838a762
>               @GRAPH_ARGS,
842,848d765
<               "-aPNG",
<               "-i",
<               "-z",
<               "-W www.ipfire.org",
<               "--alt-y-grid",
<               "-w 600",
<               "-h 125",
881a799
>               @GRAPH_ARGS,
885,891d802
<               "-aPNG",
<               "-i",
<               "-z",
<               "-W www.ipfire.org",
<               "--alt-y-grid",
<               "-w 600",
<               "-h 125",
921a833
>               @GRAPH_ARGS,
925,931d836
<               "-aPNG",
<               "-i",
<               "-z",
<               "-W www.ipfire.org",
<               "--alt-y-grid",
<               "-w 600",
<               "-h 125",
974a880
>               @GRAPH_ARGS,
978,984d883
<               "-aPNG",
<               "-i",
<               "-z",
<               "-W www.ipfire.org",
<               "--alt-y-grid",
<               "-w 600",
<               "-h 125",
1027a927
>               @GRAPH_ARGS,
1031,1037d930
<               "-aPNG",
<               "-i",
<               "-z",
<               "-W www.ipfire.org",
<               "--alt-y-grid",
<               "-w 600",
<               "-h 125",
1100a994
>               @GRAPH_ARGS,
1104,1110d997
<               "-aPNG",
<               "-i",
<               "-z",
<               "-W www.ipfire.org",
<               "--alt-y-grid",
<               "-w 600",
<               "-h 125",
1159a1047
>               @GRAPH_ARGS,
1163,1169d1050
<               "-aPNG",
<               "-i",
<               "-z",
<               "-W www.ipfire.org",
<               "--alt-y-grid",
<               "-w 600",
<               "-h 125",
1204a1086
>               @GRAPH_ARGS,
1208,1214d1089
<               "-aPNG",
<               "-i",
<               "-z",
<               "-W www.ipfire.org",
<               "--alt-y-grid",
<               "-w 600",
<               "-h 125",
1263a1139
>               @GRAPH_ARGS,
1267,1273d1142
<               "-aPNG",
<               "-i",
<               "-z",
<               "-W www.ipfire.org",
<               "--alt-y-grid",
<               "-w 600",
<               "-h 225",
1285a1155
>               "--color=BACK".$color{"color21"},
[root@firewall ipfire]# ls -l graphs2.pl graphs.pl
-rw-r--r-- 1 root root 46929 Mar 11 19:31 graphs2.pl
-rw-r--r-- 1 root root 44343 Jun 10 09:17 graphs.pl
[root@firewall ipfire]#
Attachments
graphs2.zip
(8.47 KiB) Downloaded 36 times
Gruss neobiker

Image

Hellfire
Posts: 475
Joined: November 8th, 2015, 8:54 am

Re: Feature Request: PINGGRAPH Zeitfenster variabel anzeigen

Post by Hellfire » August 2nd, 2017, 7:15 am

Hi und Danke für die beiden Dateien.

Sind diese für den aktuellen Core 111 vorgesehen?

Die Dateien im Zipfile haben aber andere Namen als deren Original. Muss ich die dann umbenennen oder einfach parallel mit den bereits vorhandenen nutzen?

Grüße,
Michael
Image

neobiker
Posts: 39
Joined: April 17th, 2011, 8:48 pm
Contact:

Re: Feature Request: PINGGRAPH Zeitfenster variabel anzeigen

Post by neobiker » August 2nd, 2017, 3:03 pm

Parallel dazu, damit Versionsunabhängig.
Dann im Browser zum Aufruf einfach die 2 an netother.cgi einfügen, das zieht dann implizit graphs2.pl statt dem Original.
Gruss neobiker

Image

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest