From 6257cba2694fad77371004bd22d9d5b4b22b77f6 Mon Sep 17 00:00:00 2001 From: maniacikarus Date: Tue, 5 Feb 2008 19:22:05 +0000 Subject: [PATCH] Made some nicer graphs and fixes Changed ast package from Peter git-svn-id: http://svn.ipfire.org/svn/ipfire/branches/2.1/trunk@1184 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8 --- config/asterisk/wakeup/source/536.call | 8 + config/asterisk/wakeup/source/bsp.call.tpl | 8 + config/asterisk/wakeup/wakeup.sh | 40 ++++ config/cfgroot/graphs.pl | 259 +++++++++++++-------- doc/language_issues.de | 1 + doc/language_issues.en | 1 + html/cgi-bin/asterisk/status.cgi | 22 +- langs/de/cgi-bin/de.pl | 1 + langs/en/cgi-bin/en.pl | 7 +- lfs/asterisk | 1 + 10 files changed, 246 insertions(+), 102 deletions(-) create mode 100644 config/asterisk/wakeup/source/536.call create mode 100644 config/asterisk/wakeup/source/bsp.call.tpl create mode 100644 config/asterisk/wakeup/wakeup.sh diff --git a/config/asterisk/wakeup/source/536.call b/config/asterisk/wakeup/source/536.call new file mode 100644 index 0000000000..6b2862c270 --- /dev/null +++ b/config/asterisk/wakeup/source/536.call @@ -0,0 +1,8 @@ +ktiv;Mon;Tue;Wed;Thu;Fri;;;05:00 +Channel: SIP/536 +MaxRetries: 3 +RetryTime: 45 +WaitTime: 30 +Context: service +Extension: 609 +Callerid: WakeUP <536> diff --git a/config/asterisk/wakeup/source/bsp.call.tpl b/config/asterisk/wakeup/source/bsp.call.tpl new file mode 100644 index 0000000000..c5b2ab1544 --- /dev/null +++ b/config/asterisk/wakeup/source/bsp.call.tpl @@ -0,0 +1,8 @@ +Aktiv;Mon;Tue;Wed;Thu;Fri;Sat;Sun;05:00 +Channel: SIP/536 +MaxRetries: 3 +RetryTime: 45 +WaitTime: 30 +Context: service +Extension: 609 +Callerid: WakeUP <536> diff --git a/config/asterisk/wakeup/wakeup.sh b/config/asterisk/wakeup/wakeup.sh new file mode 100644 index 0000000000..25d7362136 --- /dev/null +++ b/config/asterisk/wakeup/wakeup.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +CALL_P=/var/spool/asterisk/outgoing/ +SOURCE=/var/ipfire/asterisk/wakeup/source/ +TMP=/var/ipfire/asterisk/wakeup/tmp/ +EXT=".call" +DAY=$(/bin/date '+%a') +NOW=$(/bin/date '+%H:%M') + +for f in $(/bin/find ${SOURCE} -type f -name "*${EXT}") +do + if $(/bin/head -1 $f | /bin/egrep -i -q "aktiv") + then + if [ "${1}#" = "debug#" ]; then echo "File Aktiv"; fi + BASEN=$(/usr/bin/basename $f) + if $(/bin/head -1 $f | /bin/egrep -i -q "${DAY}") + then + if [ "${1}#" = "debug#" ]; then echo "Tag vorhanden in ${BASEN}"; fi + NOW2=$(cat $f | head -1 | sed 's/.*;//g' | sed 's/\r//g') + if test "${NOW}#" = "${NOW2}#" + then + if [ "${1}#" = "debug#" ]; then echo "Weckruf wird gestartet"; fi + LAENG=$(wc -l $f) + if [ "${1}#" = "debug#" ]; then echo "/usr/bin/tail -n$(( ${LAENG%% *}-1 )) $f >${TMP}${BASEN}"; else /usr/bin/tail -n$(( ${LAENG%% *}-1 )) $f >${TMP}${BASEN}; fi + if [ "${1}#" = "debug#" ]; then echo /bin/mv ${TMP}${BASEN} ${CALL_P}; else /bin/mv ${TMP}${BASEN} ${CALL_P}; fi + else if [ "${1}#" = "debug#" ]; then echo "Tag ok aber Zeit noch nicht #${NOW}!=${NOW2}#"; fi + fi + else if [ "${1}#" = "debug#" ]; then echo "Tag nicht vorhanden in ${f}"; fi + fi + else if [ "${1}#" = "debug#" ]; then echo "File ${f} nicht aktiv"; fi + fi +done + +# /usr/bin/logger -t ipfire Asterisk Wakeup Run + +# wenn als erster Parameter debug mit gegeben wird, wird alles nur via echo behandelt +# Infos unter: http://www.das-asterisk-buch.de/unstable/call-file.html +# oder: http://www.voip-info.org/wiki-Asterisk+auto-dial+out + +##EOF## diff --git a/config/cfgroot/graphs.pl b/config/cfgroot/graphs.pl index a58b8f33b8..d3063929a8 100644 --- a/config/cfgroot/graphs.pl +++ b/config/cfgroot/graphs.pl @@ -17,13 +17,22 @@ my $rrdlog = "/var/log/rrd"; my $graphs = "/srv/web/ipfire/html/graphs"; $ENV{PATH}="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"; +# Read the global settings files to get the current theme and after this load +# colors for this theme + my %color = (); my %mainsettings = (); my %mbmonsettings = (); &General::readhash("${General::swroot}/main/settings", \%mainsettings); - &General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color); + +# If the collection deamon is working and collecting mbmon data there will be +# some data source named after a common scheme, with the mbmonsettingsfile +# the user is able to deactivate some of this parameters, in case not to show +# false collected value´s may be disable. The user has the ability to enter +# custom graph names in order to change temp0 to cpu or motherboad + my $key; my $value; my @args = (); @@ -55,39 +64,69 @@ if ((${Lang::language} eq 'el') || %tr=%Lang::tr; # use translated version for other languages } +# Generate the CPU Graph for the current period of time for values given by +# collectd atm only cpu average is displayed and only 1 or 2 cpu´s is working sub updatecpugraph { - my $period = $_[0]; - - RRDs::graph ("$graphs/cpu-$period.png", - "--start", "-1$period", "-aPNG", "-i", "-z", "-W www.ipfire.org",, "-v $Lang::tr{'percentage'}", - "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-u 100", "-r", + my $period = $_[0]; + my @command = ("$graphs/cpu-$period.png", + "--start", "-1$period", "-aPNG", "-i", "-z", "-W www.ipfire.org", "-v $Lang::tr{'percentage'}", + "--alt-y-grid", "-w 600", "-h 125", "-l 0", "-u 100", "-r", "--color", "SHADEA".$color{"color19"}, "--color", "SHADEB".$color{"color19"}, "--color", "BACK".$color{"color21"}, - "-t $Lang::tr{'cpu usage per'} $Lang::tr{$period}", - "DEF:iowait=$rrdlog/collectd/localhost/cpu-0/cpu-wait.rrd:value:AVERAGE", - "DEF:nice=$rrdlog/collectd/localhost/cpu-0/cpu-nice.rrd:value:AVERAGE", - "DEF:interrupt=$rrdlog/collectd/localhost/cpu-0/cpu-interrupt.rrd:value:AVERAGE", - "DEF:steal=$rrdlog/collectd/localhost/cpu-0/cpu-steal.rrd:value:AVERAGE", - "DEF:user=$rrdlog/collectd/localhost/cpu-0/cpu-user.rrd:value:AVERAGE", - "DEF:system=$rrdlog/collectd/localhost/cpu-0/cpu-system.rrd:value:AVERAGE", - "DEF:idle=$rrdlog/collectd/localhost/cpu-0/cpu-idle.rrd:value:AVERAGE", - "DEF:irq=$rrdlog/collectd/localhost/cpu-0/cpu-softirq.rrd:value:AVERAGE", - "CDEF:total=user,system,idle,iowait,irq,nice,interrupt,steal,+,+,+,+,+,+,+", - "CDEF:userpct=100,user,total,/,*", - "CDEF:nicepct=100,nice,total,/,*", - "CDEF:interruptpct=100,interrupt,total,/,*", - "CDEF:stealpct=100,steal,total,/,*", - "CDEF:systempct=100,system,total,/,*", - "CDEF:idlepct=100,idle,total,/,*", - "CDEF:iowaitpct=100,iowait,total,/,*", - "CDEF:irqpct=100,irq,total,/,*", - "COMMENT:".sprintf("%-29s",$Lang::tr{'caption'}), - "COMMENT:$Lang::tr{'maximal'}", - "COMMENT:$Lang::tr{'average'}", - "COMMENT:$Lang::tr{'minimal'}", - "COMMENT:$Lang::tr{'current'}\\j", + "-t $Lang::tr{'cpu usage per'} $Lang::tr{$period}"); + + if ( -e "/var/log/rrd/collectd/localhost/cpu-1/" ){ + push(@command,"DEF:iowait0=$rrdlog/collectd/localhost/cpu-0/cpu-wait.rrd:value:AVERAGE", + "DEF:nice0=$rrdlog/collectd/localhost/cpu-0/cpu-nice.rrd:value:AVERAGE", + "DEF:interrupt0=$rrdlog/collectd/localhost/cpu-0/cpu-interrupt.rrd:value:AVERAGE", + "DEF:steal0=$rrdlog/collectd/localhost/cpu-0/cpu-steal.rrd:value:AVERAGE", + "DEF:user0=$rrdlog/collectd/localhost/cpu-0/cpu-user.rrd:value:AVERAGE", + "DEF:system0=$rrdlog/collectd/localhost/cpu-0/cpu-system.rrd:value:AVERAGE", + "DEF:idle0=$rrdlog/collectd/localhost/cpu-0/cpu-idle.rrd:value:AVERAGE", + "DEF:irq0=$rrdlog/collectd/localhost/cpu-0/cpu-softirq.rrd:value:AVERAGE"); + push(@command,"DEF:iowait1=$rrdlog/collectd/localhost/cpu-1/cpu-wait.rrd:value:AVERAGE", + "DEF:nice1=$rrdlog/collectd/localhost/cpu-1/cpu-nice.rrd:value:AVERAGE", + "DEF:interrupt1=$rrdlog/collectd/localhost/cpu-1/cpu-interrupt.rrd:value:AVERAGE", + "DEF:steal1=$rrdlog/collectd/localhost/cpu-1/cpu-steal.rrd:value:AVERAGE", + "DEF:user1=$rrdlog/collectd/localhost/cpu-1/cpu-user.rrd:value:AVERAGE", + "DEF:system1=$rrdlog/collectd/localhost/cpu-1/cpu-system.rrd:value:AVERAGE", + "DEF:idle1=$rrdlog/collectd/localhost/cpu-1/cpu-idle.rrd:value:AVERAGE", + "DEF:irq1=$rrdlog/collectd/localhost/cpu-1/cpu-softirq.rrd:value:AVERAGE"); + push(@command,"CDEF:user=user0,user1,+", + "CDEF:nice=nice0,nice1,+", + "CDEF:interrupt=interrupt0,interrupt1,+", + "CDEF:steal=steal0,steal1,+", + "CDEF:system=system0,system1,+", + "CDEF:idle=idle0,idle1,+", + "CDEF:iowait=iowait0,iowait1,+", + "CDEF:irq=irq0,irq1,+"); + } + else { + push(@command,"DEF:iowait=$rrdlog/collectd/localhost/cpu-0/cpu-wait.rrd:value:AVERAGE", + "DEF:nice=$rrdlog/collectd/localhost/cpu-0/cpu-nice.rrd:value:AVERAGE", + "DEF:interrupt=$rrdlog/collectd/localhost/cpu-0/cpu-interrupt.rrd:value:AVERAGE", + "DEF:steal=$rrdlog/collectd/localhost/cpu-0/cpu-steal.rrd:value:AVERAGE", + "DEF:user=$rrdlog/collectd/localhost/cpu-0/cpu-user.rrd:value:AVERAGE", + "DEF:system=$rrdlog/collectd/localhost/cpu-0/cpu-system.rrd:value:AVERAGE", + "DEF:idle=$rrdlog/collectd/localhost/cpu-0/cpu-idle.rrd:value:AVERAGE", + "DEF:irq=$rrdlog/collectd/localhost/cpu-0/cpu-softirq.rrd:value:AVERAGE"); + } + push(@command,"CDEF:total=user,system,idle,iowait,irq,nice,interrupt,steal,+,+,+,+,+,+,+", + "CDEF:userpct=100,user,total,/,*", + "CDEF:nicepct=100,nice,total,/,*", + "CDEF:interruptpct=100,interrupt,total,/,*", + "CDEF:stealpct=100,steal,total,/,*", + "CDEF:systempct=100,system,total,/,*", + "CDEF:idlepct=100,idle,total,/,*", + "CDEF:iowaitpct=100,iowait,total,/,*", + "CDEF:irqpct=100,irq,total,/,*", + "COMMENT:".sprintf("%-29s",$Lang::tr{'caption'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'maximal'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'average'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'minimal'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'current'})."\\j", "AREA:iowaitpct".$color{"color14"}.":".sprintf("%-25s",$Lang::tr{'cpu iowait usage'}), "GPRINT:iowaitpct:MAX:%3.2lf%%", "GPRINT:iowaitpct:AVERAGE:%3.2lf%%", @@ -128,28 +167,32 @@ sub updatecpugraph { "GPRINT:idlepct:AVERAGE:%3.2lf%%", "GPRINT:idlepct:MIN:%3.2lf%%", "GPRINT:idlepct:LAST:%3.2lf%%\\j"); + + RRDs::graph (@command); $ERROR = RRDs::error; print "Error in RRD::graph for cpu: $ERROR\n" if $ERROR; } +# Generate the Load Graph for the current period of time for values given by collecd + sub updateloadgraph { my $period = $_[0]; RRDs::graph ("$graphs/load-$period.png", "--start", "-1$period", "-aPNG", - "-w 600", "-h 100", "-i", "-z", "-W www.ipfire.org", "-l 0", "-r", "--alt-y-grid", - "-t Load Average $Lang::tr{'graph per'} $Lang::tr{$period}", + "-w 600", "-h 125", "-i", "-z", "-W www.ipfire.org", "-l 0", "-r", "--alt-y-grid", + "-t Load Average $Lang::tr{'graph per'} $Lang::tr{$period}", "-v $Lang::tr{'processes'}", "--color", "SHADEA".$color{"color19"}, "--color", "SHADEB".$color{"color19"}, "--color", "BACK".$color{"color21"}, "DEF:load1=$rrdlog/collectd/localhost/load/load.rrd:shortterm:AVERAGE", "DEF:load5=$rrdlog/collectd/localhost/load/load.rrd:midterm:AVERAGE", "DEF:load15=$rrdlog/collectd/localhost/load/load.rrd:longterm:AVERAGE", - "AREA:load1".$color{"color13"}."A0:1 Minute, letzter:", + "AREA:load1".$color{"color13"}."A0:1 Minute:", "GPRINT:load1:LAST:%5.2lf", - "AREA:load5".$color{"color18"}."A0:5 Minuten, letzter:", + "AREA:load5".$color{"color18"}."A0:5 Minuten:", "GPRINT:load5:LAST:%5.2lf", - "AREA:load15".$color{"color14"}."A0:15 Minuten, letzter:", + "AREA:load15".$color{"color14"}."A0:15 Minuten:", "GPRINT:load15:LAST:%5.2lf\\j", "LINE1:load5".$color{"color13"}, "LINE1:load1".$color{"color18"}); @@ -157,12 +200,14 @@ sub updateloadgraph { print "Error in RRD::graph for load: $ERROR\n" if $ERROR; } +# Generate the Memory and Swap Graph for the current period of time for values given by collecd + sub updatememgraph { my $period = $_[0]; RRDs::graph ("$graphs/memory-$period.png", "--start", "-1$period", "-aPNG", "-i", "-z", "-W www.ipfire.org", "-v $Lang::tr{'percentage'}", - "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-u 100", "-r", + "--alt-y-grid", "-w 600", "-h 125", "-l 0", "-u 100", "-r", "--color", "SHADEA".$color{"color19"}, "--color", "SHADEB".$color{"color19"}, "--color", "BACK".$color{"color21"}, @@ -176,11 +221,11 @@ sub updatememgraph { "CDEF:bufferpct=buffer,total,/,100,*", "CDEF:cachepct=cache,total,/,100,*", "CDEF:freepct=free,total,/,100,*", - "COMMENT:".sprintf("%-29s",$Lang::tr{'caption'}), - "COMMENT:$Lang::tr{'maximal'}", - "COMMENT:$Lang::tr{'average'}", - "COMMENT:$Lang::tr{'minimal'}", - "COMMENT:$Lang::tr{'current'}\\j", + "COMMENT:".sprintf("%-29s",$Lang::tr{'caption'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'maximal'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'average'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'minimal'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'current'})."\\j", "AREA:usedpct".$color{"color11"}."A0:".sprintf("%-25s",$Lang::tr{'used memory'}), "GPRINT:usedpct:MAX:%3.2lf%%", "GPRINT:usedpct:AVERAGE:%3.2lf%%", @@ -206,7 +251,7 @@ sub updatememgraph { RRDs::graph ("$graphs/swap-$period.png", "--start", "-1$period", "-aPNG", "-i", "-z", "-W www.ipfire.org", "-v $Lang::tr{'percentage'}", - "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-u 100", "-r", + "--alt-y-grid", "-w 600", "-h 125", "-l 0", "-u 100", "-r", "--color", "SHADEA".$color{"color19"}, "--color", "SHADEB".$color{"color19"}, "--color", "BACK".$color{"color21"}, @@ -218,11 +263,11 @@ sub updatememgraph { "CDEF:usedpct=100,used,total,/,*", "CDEF:freepct=100,free,total,/,*", "CDEF:cachedpct=100,cached,total,/,*", - "COMMENT:".sprintf("%-29s",$Lang::tr{'caption'}), - "COMMENT:$Lang::tr{'maximal'}", - "COMMENT:$Lang::tr{'average'}", - "COMMENT:$Lang::tr{'minimal'}", - "COMMENT:$Lang::tr{'current'}\\j", + "COMMENT:".sprintf("%-29s",$Lang::tr{'caption'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'maximal'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'average'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'minimal'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'current'})."\\j", "AREA:usedpct".$color{"color11"}."A0:".sprintf("%-25s",$Lang::tr{'used swap'}), "GPRINT:usedpct:MAX:%3.2lf%%", "GPRINT:usedpct:AVERAGE:%3.2lf%%", @@ -242,13 +287,15 @@ sub updatememgraph { print "Error in RRD::graph for swap: $ERROR\n" if $ERROR; } +# Generate the Disk Graph for the current period of time for values given by collecd + sub updatediskgraph { my $period = $_[0]; my $disk = $_[1]; RRDs::graph ("$graphs/disk-$disk-$period.png", "--start", "-1$period", "-aPNG", "-i", "-W www.ipfire.org", "-v $Lang::tr{'bytes per second'}", - "--alt-y-grid", "-w 600", "-h 100", "-r", "-z", + "--alt-y-grid", "-w 600", "-h 125", "-r", "-z", "--color", "SHADEA".$color{"color19"}, "--color", "SHADEB".$color{"color19"}, "--color", "BACK".$color{"color21"}, @@ -258,11 +305,11 @@ sub updatediskgraph { "CDEF:writen=write,-1,*", "DEF:standby=$rrdlog/hddshutdown-$disk.rrd:standby:AVERAGE", "CDEF:st=standby,INF,*", - "COMMENT:$Lang::".sprintf("%-25s",$Lang::tr{'caption'}), - "COMMENT:$Lang::tr{'maximal'}", - "COMMENT:$Lang::tr{'average'}", - "COMMENT:$Lang::tr{'minimal'}", - "COMMENT:$Lang::tr{'current'}\\j", + "COMMENT:".sprintf("%-25s",$Lang::tr{'caption'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'maximal'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'average'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'minimal'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'current'})."\\j", "AREA:st".$color{"color20"}."A0:standby\\j", "AREA:read".$color{"color12"}."A0:".sprintf("%-25s",$Lang::tr{'read bytes'}), "GPRINT:read:MAX:%8.1lf %sBps", @@ -278,13 +325,15 @@ sub updatediskgraph { print "Error in RRD::graph for disk: $ERROR\n" if $ERROR; } +# Generate the Interface Graph for the current period of time for values given by collecd + sub updateifgraph { my $interface = $_[0]; my $period = $_[1]; RRDs::graph ("$graphs/$interface-$period.png", "--start", "-1$period", "-aPNG", "-i", "-W www.ipfire.org", "-v $Lang::tr{'bytes per second'}", - "--alt-y-grid", "-w 600", "-h 100", "-z", "-r", + "--alt-y-grid", "-w 600", "-h 125", "-z", "-r", "--color", "SHADEA".$color{"color19"}, "--color", "SHADEB".$color{"color19"}, "--color", "BACK".$color{"color21"}, @@ -293,17 +342,17 @@ sub updateifgraph { "DEF:incoming=$rrdlog/collectd/localhost/interface/if_octets-$interface.rrd:rx:AVERAGE", "DEF:outgoing=$rrdlog/collectd/localhost/interface/if_octets-$interface.rrd:tx:AVERAGE", "CDEF:outgoingn=outgoing,-1,*", - "COMMENT:$Lang::".sprintf("%-20s",$Lang::tr{'caption'}), - "COMMENT:$Lang::tr{'maximal'}", - "COMMENT:$Lang::tr{'average'}", - "COMMENT:$Lang::tr{'minimal'}", - "COMMENT:$Lang::tr{'current'}\\j", - "AREA:incoming".$color{"color12"}."A0:$Lang::tr{'incoming traffic in bytes per second'}", + "COMMENT:".sprintf("%-20s",$Lang::tr{'caption'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'maximal'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'average'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'minimal'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'current'})."\\j", + "AREA:incoming".$color{"color12"}."A0:".sprintf("%-20s",$Lang::tr{'incoming traffic in bytes per second'}), "GPRINT:incoming:MAX:%8.1lf %sBps", "GPRINT:incoming:AVERAGE:%8.1lf %sBps", "GPRINT:incoming:MIN:%8.1lf %sBps", "GPRINT:incoming:LAST:%8.1lf %sBps\\j", - "AREA:outgoingn".$color{"color13"}."A0:$Lang::tr{'outgoing traffic in bytes per second'}", + "AREA:outgoingn".$color{"color13"}."A0:".sprintf("%-20s",$Lang::tr{'outgoing traffic in bytes per second'}), "GPRINT:outgoing:MAX:%8.1lf %sBps", "GPRINT:outgoing:AVERAGE:%8.1lf %sBps", "GPRINT:outgoing:MIN:%8.1lf %sBps", @@ -312,11 +361,13 @@ sub updateifgraph { print "Error in RRD::graph for $interface: $ERROR\n" if $ERROR; } +# Generate the Firewall Graph for the current period of time for values given by collecd + sub updatefwhitsgraph { my $period = $_[0]; RRDs::graph ("$graphs/fwhits-$period.png", "--start", "-1$period", "-aPNG", "-i", "-z", "-W www.ipfire.org", - "--alt-y-grid", "-w 600", "-h 100", "-r", "-v $Lang::tr{'bytes per second'}", + "--alt-y-grid", "-w 600", "-h 125", "-r", "-v $Lang::tr{'bytes per second'}", "--color", "SHADEA".$color{"color19"}, "--color", "SHADEB".$color{"color19"}, "--color", "BACK".$color{"color21"}, @@ -326,11 +377,11 @@ sub updatefwhitsgraph { "DEF:newnotsyn=$rrdlog/collectd/localhost/iptables-filter-NEWNOTSYN/ipt_bytes-DROP_NEWNOTSYN.rrd:value:AVERAGE", "DEF:portscan=$rrdlog/collectd/localhost/iptables-filter-PSCAN/ipt_bytes-DROP_PScan.rrd:value:AVERAGE", "CDEF:amount=output,input,newnotsyn,+,+", - "COMMENT:$Lang::".sprintf("%-20s",$Lang::tr{'caption'}), - "COMMENT:$Lang::tr{'maximal'}", - "COMMENT:$Lang::tr{'average'}", - "COMMENT:$Lang::tr{'minimal'}", - "COMMENT:$Lang::tr{'current'}\\j", + "COMMENT:".sprintf("%-20s",$Lang::tr{'caption'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'maximal'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'average'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'minimal'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'current'})."\\j", "AREA:amount".$color{"color24"}."A0:".sprintf("%-20s",$Lang::tr{'firewallhits'}), "GPRINT:amount:MAX:%8.1lf %sBps", "GPRINT:amount:AVERAGE:%8.1lf %sBps", @@ -342,14 +393,16 @@ sub updatefwhitsgraph { "GPRINT:portscan:AVERAGE:%8.1lf %sBps", "GPRINT:portscan:LAST:%8.1lf %sBps\\j"); $ERROR = RRDs::error; - print "Error in RRD::graph for Firewallhits: $ERROR\n" if $ERROR; + print "Error in RRD::graph for Firewallhits: $ERROR\n" if $ERROR; } +# Generate the Line Quality Graph for the current period of time for values given by collecd + sub updatelqgraph { my $period = $_[0]; RRDs::graph ("$graphs/lq-$period.png", "--start", "-1$period", "-aPNG", "-i", "-W www.ipfire.org", - "--alt-y-grid", "-w 600", "-h 100", "-l 0", "-r", "-v ms", + "--alt-y-grid", "-w 600", "-h 125", "-l 0", "-r", "-v ms", "-t $Lang::tr{'linkq'} $Lang::tr{'graph per'} $Lang::tr{$period}", "--color", "SHADEA".$color{"color19"}, "--color", "SHADEB".$color{"color19"}, @@ -366,10 +419,10 @@ sub updatelqgraph { "AREA:r2".$color{"color14"}."A0:70-150 ms", "AREA:r1".$color{"color17"}."A0:30-70 ms", "AREA:r0".$color{"color12"}."A0:<30 ms\\j", - "COMMENT:$Lang::tr{'maximal'}", - "COMMENT:$Lang::tr{'average'}", - "COMMENT:$Lang::tr{'minimal'}", - "COMMENT:$Lang::tr{'current'}\\j", + "COMMENT:".sprintf("%15s",$Lang::tr{'maximal'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'average'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'minimal'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'current'})."\\j", "LINE1:roundtrip#707070:", "GPRINT:roundtrip:MAX:%3.2lf ms", "GPRINT:roundtrip:AVERAGE:%3.2lf ms", @@ -379,6 +432,8 @@ sub updatelqgraph { print "Error in RRD::graph for Link Quality: $ERROR\n" if $ERROR; } +# Generate the Hdd Graph for the current period of time for values given by collecd + sub updatehddgraph { my $disk = $_[0]; @@ -386,7 +441,7 @@ sub updatehddgraph { RRDs::graph ("$graphs/hddtemp-$disk-$period.png", "--start", "-1$period", "-aPNG", "-i", "-z", "-W www.ipfire.org", - "--alt-y-grid", "-w 600", "-h 100", + "--alt-y-grid", "-w 600", "-h 125", "--color", "SHADEA".$color{"color19"}, "--color", "SHADEB".$color{"color19"}, "--color", "BACK".$color{"color21"}, @@ -409,6 +464,8 @@ sub updatehddgraph { print "Error in RRD::graph for hdd-$disk: $ERROR\n" if $ERROR; } +# Generate the QoS Graph for the current period of time + sub overviewgraph { my $period = $_[0]; @@ -436,15 +493,15 @@ sub overviewgraph { my $color="#000000"; my @command=("/srv/web/ipfire/html/graphs/qos-graph-$qossettings{'DEV'}-$period.png", "--start", $periodstring, "-aPNG", "-i", "-z", "-W www.ipfire.org", - "--alt-y-grid", "-w 600", "-h 100", "-r", + "--alt-y-grid", "-w 600", "-h 125", "-r", "-v $Lang::tr{'bytes per second'}", "--color", "SHADEA".$color{"color19"}, "--color", "SHADEB".$color{"color19"}, "--color", "BACK".$color{"color21"}, - "COMMENT:$Lang::tr{'caption'}\\t\\t\\t\\t ", - "COMMENT:$Lang::tr{'maximal'}", - "COMMENT:$Lang::tr{'average'}", - "COMMENT:$Lang::tr{'minimal'}", - "COMMENT:$Lang::tr{'current'}\\j", + "COMMENT:".sprintf("%-28s",$Lang::tr{'caption'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'maximal'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'average'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'minimal'}), + "COMMENT:".sprintf("%15s",$Lang::tr{'current'})."\\j", $description ); open( FILE, "< $classfile" ) or die "Unable to read $classfile"; @@ -464,10 +521,10 @@ sub overviewgraph { push(@command, "STACK:$classline[1]$color:Klasse $classline[1] -".sprintf("%15s",$classline[8])); } - push(@command, "GPRINT:$classline[1]:MAX:%5.2lf"); - push(@command, "GPRINT:$classline[1]:AVERAGE:%5.2lf"); - push(@command, "GPRINT:$classline[1]:MIN:%5.2lf"); - push(@command, "GPRINT:$classline[1]:LAST:%5.2lf\\j"); + push(@command, "GPRINT:$classline[1]:MAX:%8.1lf %sBps"); + push(@command, "GPRINT:$classline[1]:AVERAGE:%8.1lf %sBps"); + push(@command, "GPRINT:$classline[1]:MIN:%8.1lf %sBps"); + push(@command, "GPRINT:$classline[1]:LAST:%8.1lf %sBps\\j"); $count++; } } @@ -476,14 +533,7 @@ sub overviewgraph { print "$ERROR"; } -sub random_hex_color { - my $size = shift; - $size = 6 if $size !~ /^3|6$/; - my @hex = ( 0 .. 9, 'a' .. 'f' ); - my @color; - push @color, @hex[rand(@hex)] for 1 .. $size; - return join('', '#', @color); -} +# Generate the Temperature Graph for the current period of time for values given by collecd and mbmon sub updatehwtempgraph { @@ -491,7 +541,7 @@ sub updatehwtempgraph { my @command = ("$graphs/mbmon-hwtemp-$period.png", "--start", "-1$period", "-aPNG", "-i", "-W www.ipfire.org", - "--alt-y-grid", "-w 600", "-h 100", + "--alt-y-grid", "-w 600", "-h 125", "--color", "SHADEA".$color{"color19"},"--color", "SHADEB".$color{"color19"},"--color", "BACK".$color{"color21"}, @@ -502,7 +552,7 @@ sub updatehwtempgraph { if ( $_ =~ /temperature/ ) {my @name=split(/\./,$_);if ( $mbmonsettings{'LINE-'.$name[0]} eq "off" ){next;}push(@command,"DEF:".$mbmonsettings{'LABEL-'.$name[0]}."=$rrdlog/collectd/localhost/mbmon/".$_.":value:AVERAGE"); } } - push(@command,"COMMENT:".sprintf("%-29s",$Lang::tr{'caption'}),"COMMENT:$Lang::tr{'maximal'}","COMMENT:$Lang::tr{'average'}","COMMENT:$Lang::tr{'minimal'}","COMMENT:$Lang::tr{'current'}\\j"); + push(@command,"COMMENT:".sprintf("%-29s",$Lang::tr{'caption'}),"COMMENT:".sprintf("%-20s",$Lang::tr{'caption'}),"COMMENT:".sprintf("%15s",$Lang::tr{'maximal'}),"COMMENT:".sprintf("%15s",$Lang::tr{'average'}),"COMMENT:".sprintf("%15s",$Lang::tr{'minimal'}),"COMMENT:".sprintf("%15s",$Lang::tr{'current'})."\\j"); foreach(@mbmongraphs){ chomp($_); if ( $_ =~ /temperature/ ) {my @name=split(/\./,$_);if ( $mbmonsettings{'LINE-'.$name[0]} eq "off" ){next;}push(@command,"LINE3:".$mbmonsettings{'LABEL-'.$name[0]}.random_hex_color(6)."A0:".sprintf("%-25s",$mbmonsettings{'LABEL-'.$name[0]}), @@ -513,13 +563,15 @@ sub updatehwtempgraph { print "$ERROR"; } +# Generate the Voltage Graph for the current period of time for values given by collecd and mbmon + sub updatehwvoltgraph { my $period = $_[0]; my @command = ("$graphs/mbmon-hwvolt-$period.png", "--start", "-1$period", "-aPNG", "-i", "-W www.ipfire.org", - "--alt-y-grid", "-w 600", "-h 100", + "--alt-y-grid", "-w 600", "-h 125", "--color", "SHADEA".$color{"color19"},"--color", "SHADEB".$color{"color19"},"--color", "BACK".$color{"color21"}, @@ -529,7 +581,7 @@ sub updatehwvoltgraph { chomp($_); if ( $_ =~ /voltage/ ) {my @name=split(/\./,$_);if ( $mbmonsettings{'LINE-'.$name[0]} eq "off" ){next;}push(@command,"DEF:".$mbmonsettings{'LABEL-'.$name[0]}."=$rrdlog/collectd/localhost/mbmon/".$_.":value:AVERAGE");} } - push(@command,"COMMENT:".sprintf("%-29s",$Lang::tr{'caption'}),"COMMENT:$Lang::tr{'maximal'}","COMMENT:$Lang::tr{'average'}","COMMENT:$Lang::tr{'minimal'}","COMMENT:$Lang::tr{'current'}\\j"); + push(@command,"COMMENT:".sprintf("%-29s",$Lang::tr{'caption'}),"COMMENT:".sprintf("%-20s",$Lang::tr{'caption'}),"COMMENT:".sprintf("%15s",$Lang::tr{'maximal'}),"COMMENT:".sprintf("%15s",$Lang::tr{'average'}),"COMMENT:".sprintf("%15s",$Lang::tr{'minimal'}),"COMMENT:".sprintf("%15s",$Lang::tr{'current'})."\\j"); foreach(@mbmongraphs){ chomp($_); if ( $_ =~ /voltage/ ) {my @name=split(/\./,$_);if ( $mbmonsettings{'LINE-'.$name[0]} eq "off" ){next;}push(@command,"LINE3:".$mbmonsettings{'LABEL-'.$name[0]}.random_hex_color(6)."A0:".sprintf("%-25s",$mbmonsettings{'LABEL-'.$name[0]}), @@ -540,13 +592,15 @@ sub updatehwvoltgraph { print "$ERROR"; } +# Generate the Load Graph for the current period of time for values given by collecd and mbmon + sub updatehwfangraph { my $period = $_[0]; my @command = ("$graphs/mbmon-hwfan-$period.png", "--start", "-1$period", "-aPNG", "-i", "-W www.ipfire.org", - "--alt-y-grid", "-w 600", "-h 100", + "--alt-y-grid", "-w 600", "-h 125", "--color", "SHADEA".$color{"color19"},"--color", "SHADEB".$color{"color19"},"--color", "BACK".$color{"color21"}, @@ -556,7 +610,7 @@ sub updatehwfangraph { chomp($_); if ( $_ =~ /fanspeed/ ) {my @name=split(/\./,$_);if ( $mbmonsettings{'LINE-'.$name[0]} eq "off" ){next;}push(@command,"DEF:".$mbmonsettings{'LABEL-'.$name[0]}."=$rrdlog/collectd/localhost/mbmon/".$_.":value:AVERAGE");} } - push(@command,"COMMENT:".sprintf("%-29s",$Lang::tr{'caption'}),"COMMENT:$Lang::tr{'maximal'}","COMMENT:$Lang::tr{'average'}","COMMENT:$Lang::tr{'minimal'}","COMMENT:$Lang::tr{'current'}\\j"); + push(@command,"COMMENT:".sprintf("%-29s",$Lang::tr{'caption'}),"COMMENT:".sprintf("%-20s",$Lang::tr{'caption'}),"COMMENT:".sprintf("%15s",$Lang::tr{'maximal'}),"COMMENT:".sprintf("%15s",$Lang::tr{'average'}),"COMMENT:".sprintf("%15s",$Lang::tr{'minimal'}),"COMMENT:".sprintf("%15s",$Lang::tr{'current'})."\\j"); foreach(@mbmongraphs){ chomp($_); if ( $_ =~ /fanspeed/ ) {my @name=split(/\./,$_);if ( $mbmonsettings{'LINE-'.$name[0]} eq "off" ){next;}push(@command,"LINE3:".$mbmonsettings{'LABEL-'.$name[0]}.random_hex_color(6)."A0:".sprintf("%-25s",$mbmonsettings{'LABEL-'.$name[0]}), @@ -566,3 +620,14 @@ sub updatehwfangraph { $ERROR = RRDs::error; print "$ERROR"; } + +# Generate a random color, used by Qos Graph to be independent from the amount of values + +sub random_hex_color { + my $size = shift; + $size = 6 if $size !~ /^3|6$/; + my @hex = ( 0 .. 9, 'a' .. 'f' ); + my @color; + push @color, @hex[rand(@hex)] for 1 .. $size; + return join('', '#', @color); +} diff --git a/doc/language_issues.de b/doc/language_issues.de index e64532bee7..4f425b496e 100644 --- a/doc/language_issues.de +++ b/doc/language_issues.de @@ -323,6 +323,7 @@ WARNING: translation string unused: squid fix cache WARNING: translation string unused: ssh access tip WARNING: translation string unused: ssnetwork status WARNING: translation string unused: sspasswords +WARNING: translation string unused: ssproxy graphs WARNING: translation string unused: sssystem status WARNING: translation string unused: sstraffic graphs WARNING: translation string unused: subject test diff --git a/doc/language_issues.en b/doc/language_issues.en index ba59472f67..400482dc21 100644 --- a/doc/language_issues.en +++ b/doc/language_issues.en @@ -355,6 +355,7 @@ WARNING: translation string unused: squid fix cache WARNING: translation string unused: ssh access tip WARNING: translation string unused: ssnetwork status WARNING: translation string unused: sspasswords +WARNING: translation string unused: ssproxy graphs WARNING: translation string unused: sssystem status WARNING: translation string unused: sstraffic graphs WARNING: translation string unused: subject test diff --git a/html/cgi-bin/asterisk/status.cgi b/html/cgi-bin/asterisk/status.cgi index 12c4c9feae..adfceb1db8 100644 --- a/html/cgi-bin/asterisk/status.cgi +++ b/html/cgi-bin/asterisk/status.cgi @@ -6,6 +6,9 @@ require "${General::swroot}/header.pl"; &Header::showhttpheaders(); +#use warnings; +#use CGI::Carp 'fatalsToBrowser'; + my %asterisksettings; &Header::getcgihash(\%asterisksettings); @@ -42,8 +45,23 @@ if ($asterisksettings{'ACTION'} eq "$Lang::tr{'reload'} IAX") system("/etc/init.d/asterisk remod iax >/dev/null 2>&1"); } -$checked{'ENABLE_AST'}{'status'} = system("/etc/init.d/asterisk status >/dev/null 2>&1"); -if ($checked{'ENABLE_AST'}{'status'}) { + my $pid = ''; + my $testcmd = ''; + my $exename; + my @memory; + + if (open(FILE, "/var/run/asterisk.pid")){ + $pid = ; chomp $pid; + close FILE; + if (open(FILE, "/proc/${pid}/status")){ + while (){ + if (/^Name:\W+(.*)/) {$testcmd = $1;} + } + close FILE; + } + } + +if ($testcmd !~ /asterisk/) { $checked{'ENABLE_AST'}{'status_s'}=" $Lang::tr{'not running'}"; $checked{'ENABLE_AST'}{'status_b'}=""; } else { diff --git a/langs/de/cgi-bin/de.pl b/langs/de/cgi-bin/de.pl index 602c2bbea4..ec7b6164c9 100644 --- a/langs/de/cgi-bin/de.pl +++ b/langs/de/cgi-bin/de.pl @@ -1306,6 +1306,7 @@ 'printing' => 'Printing', 'printing options' => 'Druckeroptionen', 'priority' => 'Priorität', +'processes' => 'Prozesse', 'profile' => 'Profil', 'profile deleted' => 'Profil gelöscht: ', 'profile has errors' => 'Profil fehlerhaft', diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl index 06b0c88d61..ce923600a7 100644 --- a/langs/en/cgi-bin/en.pl +++ b/langs/en/cgi-bin/en.pl @@ -833,7 +833,7 @@ 'hangup string' => 'Hangup:', 'harddisk temperature' => 'Harddisk temperature', 'harddisk temperature graphs' => 'hdd temperature graphs', -'hardware graphs' => 'hardware graphs', +'hardware graphs' => 'Hardware Graphs', 'hdd temperature in' => 'Harddisk temperature in', 'help' => 'Help', 'high' => 'High', @@ -1150,8 +1150,8 @@ 'network configuration' => 'Network Configuration', 'network internal' => 'Network (internal)', 'network options' => 'Network Options', -'network other' => 'network (other)', -'network red' => 'network (external)', +'network other' => 'Network (other)', +'network red' => 'Network (external)', 'network removed' => 'Custom Network removed', 'network status information' => 'Network Status Information', 'network time' => 'Use a Network Time Server:', @@ -1334,6 +1334,7 @@ 'printing' => 'Printing', 'printing options' => 'printing options', 'priority' => 'Priority', +'processes' => 'Processes', 'profile' => 'Profile', 'profile deleted' => 'Profile deleted: ', 'profile has errors' => 'Profile has errors', diff --git a/lfs/asterisk b/lfs/asterisk index 6dadd0ca68..b02a6e62a8 100644 --- a/lfs/asterisk +++ b/lfs/asterisk @@ -112,5 +112,6 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) -mkdir -p /var/ipfire/asterisk cp -vrf $(DIR_SRC)/config/asterisk/* /var/ipfire/asterisk/ chmod o+w /var/ipfire/asterisk + chown nobody:nobody -R /var/ipfire/asterisk ln -f -s /var/ipfire/asterisk/wakeup/wakeup.sh /etc/fcron.minutely/wakeup.sh @$(POSTBUILD) -- 2.39.2