Projet

Général

Profil

« Précédent | Suivant » 

Révision 6b71ebb7

Ajouté par Renato Botelho il y a presque 10 ans

Fix status_rrd_graph_img.php and also improve it:

- Remove escapeshellarg that broke command line
- Only remove dangerous chars to avoid command injection
- Replace all `hostname` calls by php_uname('n')
- Replace all `date` calls by strftime()
- Add $_gb to collect possibly garbage from exec return

Voir les différences:

usr/local/www/status_rrd_graph_img.php
43 43
$pgtitle = array(gettext("System"),gettext("RRD Graphs"),gettext("Image viewer"));
44 44

  
45 45
if ($_GET['database']) {
46
	$curdatabase = escapeshellarg(basename($_GET['database']));
46
	$curdatabase = basename($_GET['database']);
47
	$curdatabase = str_replace(array("<", ">", ";", "&", "'", '"'), "", htmlspecialchars_decode($curdatabase, ENT_QUOTES | ENT_HTML401));
47 48
} else {
48 49
	$curdatabase = "wan-traffic.rrd";
49 50
}
......
56 57

  
57 58
/* this is used for temp name */
58 59
if ($_GET['graph']) {
59
	$curgraph = escapeshellarg($_GET['graph']);
60
	$curgraph = str_replace(array("<", ">", ";", "&", "'", '"'), "", htmlspecialchars_decode($_GET['graph'], ENT_QUOTES | ENT_HTML401));
60 61
} else {
61 62
	$curgraph = "custom";
62 63
}
......
326 327
	$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
327 328
	$graphcmd .= "--start $start --end $end --step $step --vertical-label \"bits/sec\" ";
328 329
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
329
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
330
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
330 331
	$graphcmd .= "--height 200 --width 620 ";
331 332
	$graphcmd .= "DEF:$curif-in_bytes_pass=$rrddbpath$curdatabase:inpass:AVERAGE:step=$step ";
332 333
	$graphcmd .= "DEF:$curif-out_bytes_pass=$rrddbpath$curdatabase:outpass:AVERAGE:step=$step ";
......
471 472
	$graphcmd .= "GPRINT:\"$curif-out6_bits_block:LAST:%7.2lf %Sb/s\" ";
472 473
	$graphcmd .= "GPRINT:\"$curif-bytes_out6_t_block:AVERAGE:%7.2lf %sB o\" ";
473 474
	$graphcmd .= "COMMENT:\"\\n\" ";
474
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
475
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
475 476
}
476 477
elseif(strstr($curdatabase, "-throughput.rrd")) {
477 478
	/* define graphcmd for throughput stats */
......
480 481
	$graphcmd .= "--start $start --end $end --step $step ";
481 482
	$graphcmd .= "--vertical-label \"bits/sec\" ";
482 483
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
483
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
484
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
484 485
	$graphcmd .= "--height 200 --width 620 ";
485 486

  
486 487
	$iflist = get_configured_interface_list();
......
599 600
	$graphcmd .= "GPRINT:\"tput-out_bits_block:LAST:%7.2lf %Sb/s\" ";
600 601
	$graphcmd .= "GPRINT:\"tput-bytes_out_t_block:AVERAGE:%7.2lf %sB o\" ";
601 602
	$graphcmd .= "COMMENT:\"\\n\" ";
602
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
603
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
603 604
}
604 605
elseif((strstr($curdatabase, "-packets.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
605 606
	/* define graphcmd for packets stats */
......
607 608
	$graphcmd .= "--start $start --end $end --step $step ";
608 609
	$graphcmd .= "--vertical-label \"packets/sec\" ";
609 610
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
610
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
611
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
611 612
	$graphcmd .= "--height 200 --width 620 ";
612 613
	$graphcmd .= "DEF:\"$curif-in_pps_pass=$rrddbpath$curdatabase:inpass:AVERAGE:step=$step\" ";
613 614
	$graphcmd .= "DEF:\"$curif-out_pps_pass=$rrddbpath$curdatabase:outpass:AVERAGE:step=$step\" ";
......
725 726
	$graphcmd .= "GPRINT:\"$curif-out6_pps_block:LAST:%7.2lf %S pps\" ";
726 727
	$graphcmd .= "GPRINT:\"$curif-pps_out6_t_block:AVERAGE:%7.2lf %s pkts\" ";
727 728
	$graphcmd .= "COMMENT:\"\\n\" ";
728
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
729
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
729 730
}
730 731
elseif((strstr($curdatabase, "-wireless.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
731 732
	/* define graphcmd for packets stats */
......
733 734
	$graphcmd .= "--start $start --end $end --step $step ";
734 735
	$graphcmd .= "--vertical-label \"snr/channel/rate\" ";
735 736
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
736
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
737
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
737 738
	$graphcmd .= "--height 200 --width 620 ";
738 739
	$graphcmd .= "DEF:\"$curif-snr=$rrddbpath$curdatabase:snr:AVERAGE:step=$step\" ";
739 740
	$graphcmd .= "DEF:\"$curif-rate=$rrddbpath$curdatabase:rate:AVERAGE:step=$step\" ";
......
758 759
	$graphcmd .= "GPRINT:\"$curif-channel:AVERAGE:%7.2lf      \" ";
759 760
	$graphcmd .= "GPRINT:\"$curif-channel:LAST:%7.2lf\" ";
760 761
	$graphcmd .= "COMMENT:\"\\n\" ";
761
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
762
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
762 763
}
763 764
elseif((strstr($curdatabase, "-vpnusers.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
764 765
	/* define graphcmd for vpn users stats */
......
766 767
	$graphcmd .= "--start $start --end $end --step $step ";
767 768
	$graphcmd .= "--vertical-label \"users\" ";
768 769
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
769
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
770
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
770 771
	$graphcmd .= "--height 200 --width 620 ";
771 772
	$graphcmd .= "DEF:\"$curif-users=$rrddbpath$curdatabase:users:AVERAGE:step=$step\" ";
772 773
	$graphcmd .= "LINE2:\"$curif-users#{$colorvpnusers[0]}:$curif-users\" ";
......
777 778
	$graphcmd .= "GPRINT:\"$curif-users:AVERAGE:%7.2lf      \" ";
778 779
	$graphcmd .= "GPRINT:\"$curif-users:LAST:%7.2lf \" ";
779 780
	$graphcmd .= "COMMENT:\"\\n\" ";
780
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
781
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
781 782
}
782 783
elseif((strstr($curdatabase, "-states.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
783 784
	/* define graphcmd for states stats */
......
785 786
	$graphcmd .= "--start -$seconds -e -$average --step $step ";
786 787
	$graphcmd .= "--vertical-label \"states, ip\" ";
787 788
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
788
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
789
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
789 790
	$graphcmd .= "--height 200 --width 620 ";
790 791
	$graphcmd .= "DEF:\"$curif-pfrate=$rrddbpath$curdatabase:pfrate:AVERAGE:step=$step\" ";
791 792
	$graphcmd .= "DEF:\"$curif-pfstates=$rrddbpath$curdatabase:pfstates:AVERAGE:step=$step\" ";
......
831 832
	$graphcmd .= "GPRINT:\"$curif-dstip:MAX:%7.2lf %s    \" ";
832 833
	$graphcmd .= "GPRINT:\"$curif-dstip:LAST:%7.2lf %s    \" ";
833 834
	$graphcmd .= "COMMENT:\"\\n\" ";
834
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
835
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
835 836
}
836 837
elseif((strstr($curdatabase, "-processor.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
837 838
	/* define graphcmd for processor stats */
......
839 840
	$graphcmd .= "--start $start --end $end --step $step ";
840 841
	$graphcmd .= "--vertical-label \"utilization, number\" ";
841 842
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
842
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
843
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
843 844
	$graphcmd .= "--height 200 --width 620 ";
844 845
	$graphcmd .= "DEF:\"user=$rrddbpath$curdatabase:user:AVERAGE:step=$step\" ";
845 846
	$graphcmd .= "DEF:\"nice=$rrddbpath$curdatabase:nice:AVERAGE:step=$step\" ";
......
883 884
	$graphcmd .= "GPRINT:\"processes:MAX:%7.2lf %s    \" ";
884 885
	$graphcmd .= "GPRINT:\"processes:LAST:%7.2lf %s    \" ";
885 886
	$graphcmd .= "COMMENT:\"\\n\" ";
886
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
887
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
887 888
}
888 889
elseif((strstr($curdatabase, "-memory.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
889 890
	/* define graphcmd for memory usage stats */
......
891 892
	$graphcmd .= "--start $start --end $end --step $step ";
892 893
	$graphcmd .= "--vertical-label \"utilization, percent\" ";
893 894
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
894
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
895
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
895 896
	$graphcmd .= "--height 200 --width 620 ";
896 897
	$graphcmd .= "DEF:\"active=$rrddbpath$curdatabase:active:AVERAGE:step=$step\" ";
897 898
	$graphcmd .= "DEF:\"inactive=$rrddbpath$curdatabase:inactive:AVERAGE:step=$step\" ";
......
935 936
	$graphcmd .= "GPRINT:\"wire:MAX:%7.2lf %s    \" ";
936 937
	$graphcmd .= "GPRINT:\"wire:LAST:%7.2lf %S    \" ";
937 938
	$graphcmd .= "COMMENT:\"\\n\" ";
938
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
939
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
939 940
}
940 941
elseif((strstr($curdatabase, "-mbuf.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
941 942
	/* define graphcmd for mbuf usage stats */
......
943 944
	$graphcmd .= "--start $start --end $end --step $step ";
944 945
	$graphcmd .= "--vertical-label \"utilization, percent\" ";
945 946
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
946
	$graphcmd .= "--title \"`hostname` - {$prettydb} clusters - {$hperiod} - {$havg} average\" ";
947
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} clusters - {$hperiod} - {$havg} average\" ";
947 948
	$graphcmd .= "--height 200 --width 620 ";
948 949
	$graphcmd .= "DEF:\"current=$rrddbpath$curdatabase:current:AVERAGE:step=$step\" ";
949 950
	$graphcmd .= "DEF:\"cache=$rrddbpath$curdatabase:cache:AVERAGE:step=$step\" ";
......
979 980
	$graphcmd .= "GPRINT:\"max:MAX:%7.2lf %s    \" ";
980 981
	$graphcmd .= "GPRINT:\"max:LAST:%7.2lf %S    \" ";
981 982
	$graphcmd .= "COMMENT:\"\\n\" ";
982
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
983
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
983 984
}
984 985
elseif((strstr($curdatabase, "-queues.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
985 986
	/* define graphcmd for queue stats */
......
987 988
	$graphcmd .= "--start $start --end $end --step $step ";
988 989
	$graphcmd .= "--vertical-label \"bits/sec\" ";
989 990
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
990
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
991
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
991 992
	$graphcmd .= "--height 200 --width 620 ";
992 993
	if ($altq) {
993 994
		$a_queues =& $altq->get_queue_list();
......
1008 1009
		if($t > 7) { $t = 0; }
1009 1010
	}
1010 1011
	$graphcmd .= "COMMENT:\"\\n\" ";
1011
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
1012
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
1012 1013
}
1013 1014
elseif((strstr($curdatabase, "-queuedrops.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
1014 1015
	/* define graphcmd for queuedrop stats */
......
1016 1017
	$graphcmd .= "--start $start --end $end --step $step ";
1017 1018
	$graphcmd .= "--vertical-label \"drops / sec\" ";
1018 1019
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
1019
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
1020
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
1020 1021
	$graphcmd .= "--height 200 --width 620 ";
1021 1022
	if ($altq) {
1022 1023
		$a_queues =& $altq->get_queue_list();
......
1038 1039
		if($t > 7) { $t = 0; }
1039 1040
	}
1040 1041
	$graphcmd .= "COMMENT:\"\\n\" ";
1041
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
1042
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
1042 1043
}
1043 1044
elseif((strstr($curdatabase, "-quality.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
1044 1045
	/* make a link quality graphcmd, we only have WAN for now, others too follow */
1045 1046
	$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png \\
1046 1047
		--start $start --end $end --step $step  \\
1047
		--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" \\
1048
		--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" \\
1048 1049
		--color SHADEA#eeeeee --color SHADEB#eeeeee \\
1049 1050
		--vertical-label \"ms / %\" \\
1050 1051
		--height 200 --width 620 \\
......
1074 1075
		GPRINT:loss:LAST:\"\tLast\: %3.1lf %%\\n\" \\
1075 1076
		AREA:loss10#$colorqualityloss:\"Packet loss\\n\" \\
1076 1077
		LINE1:delay#$colorqualityrtt[5]:\"Delay average\\n\" \\
1077
		COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\"";
1078
		COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\"";
1078 1079
}
1079 1080
elseif((strstr($curdatabase, "spamd.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
1080 1081
	/* graph a spamd statistics graph */
1081 1082
	$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png \\
1082 1083
		--start $start --end $end --step $step \\
1083
		--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" \\
1084
		--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" \\
1084 1085
		--color SHADEA#eeeeee --color SHADEB#eeeeee \\
1085 1086
		--vertical-label=\"Conn / Time, sec.\" \\
1086 1087
		--height 200 --width 620 --no-gridfit \\
......
1113 1114
		GPRINT:consmin:MIN:\"Min\\:%6.2lf\\t\" \\
1114 1115
		GPRINT:consavg:AVERAGE:\"Avg\\:%6.2lf\\t\" \\
1115 1116
		GPRINT:consmax:MAX:\"Max\\:%6.2lf\\n\" \\
1116
		COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
1117
		COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
1117 1118
}
1118 1119
elseif((strstr($curdatabase, "-cellular.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
1119 1120
	$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
1120 1121
	$graphcmd .= "--start $start --end $end --step $step ";
1121 1122
	$graphcmd .= "--vertical-label \"signal\" ";
1122 1123
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
1123
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
1124
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
1124 1125
	$graphcmd .= "--height 200 --width 620 ";
1125 1126
	$graphcmd .= "DEF:\"$curif-rssi=$rrddbpath$curdatabase:rssi:AVERAGE:step=$step\" ";
1126 1127
	$graphcmd .= "LINE2:\"$curif-rssi#{$colorwireless[0]}:$curif-rssi\" ";
......
1131 1132
	$graphcmd .= "GPRINT:\"$curif-rssi:AVERAGE:%7.2lf     \" ";
1132 1133
	$graphcmd .= "GPRINT:\"$curif-rssi:LAST:%7.2lf \" ";
1133 1134
	$graphcmd .= "COMMENT:\"\\n\" ";
1134
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
1135
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
1135 1136
}
1136 1137
elseif((strstr($curdatabase, "-loggedin.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
1137 1138
	/* define graphcmd for online Captive Portal users stats */
......
1142 1143
	$graphcmd .= "--base=1000 ";
1143 1144
	$graphcmd .= "--lower-limit=0 ";
1144 1145
	$graphcmd .= "--slope-mode ";
1145
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
1146
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
1146 1147
	$graphcmd .= "--height 200 --width 620 ";
1147 1148
	$graphcmd .= "DEF:\"$curif-loggedinusers=$rrddbpath$curdatabase:loggedinusers:AVERAGE:step=$step\" ";
1148 1149
	$graphcmd .= "CDEF:\"$curif-totalusers_t=PREV,UN,0,PREV,IF,$curif-loggedinusers,+\" ";
......
1150 1151
	$graphcmd .= "AREA:\"$curif-totalusers_d#{$colorcaptiveportalusers[0]}:Total logged in users\" ";
1151 1152
	$graphcmd .= "GPRINT:\"$curif-totalusers_d:MAX:%8.0lf \\n\" ";
1152 1153
	$graphcmd .= "COMMENT:\"\\n\" ";
1153
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";	
1154
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";	
1154 1155
}
1155 1156
elseif((strstr($curdatabase, "-concurrent.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
1156 1157
	/* define graphcmd for online Captive Portal users stats */
......
1158 1159
	$graphcmd .= "--start $start --end $end --step $step ";
1159 1160
	$graphcmd .= "--vertical-label \"Captive Portal Users\" ";
1160 1161
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
1161
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
1162
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
1162 1163
	$graphcmd .= "--base=1000 ";
1163 1164
	$graphcmd .= "--lower-limit=0 ";
1164 1165
	$graphcmd .= "--slope-mode ";
......
1172 1173
	$graphcmd .= "GPRINT:\"$curif-concurrentusers:AVERAGE:%8.0lf      \" ";
1173 1174
	$graphcmd .= "GPRINT:\"$curif-concurrentusers:MAX:%8.0lf \" ";
1174 1175
	$graphcmd .= "COMMENT:\"\\n\" ";
1175
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";	
1176
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";	
1176 1177
}
1177 1178
else {
1178 1179
	$data = false;
......
1183 1184
if (file_exists("$rrdtmppath$curdatabase-$curgraph.png")) {
1184 1185
	if((time() - filemtime("$rrdtmppath$curdatabase-$curgraph.png")) >= 15 ) {
1185 1186
		if($data)
1186
			exec("$graphcmd 2>&1", $graphcmdoutput, $graphcmdreturn);
1187
			$_gb = exec("$graphcmd 2>&1", $graphcmdoutput, $graphcmdreturn);
1187 1188
			$graphcmdoutput = implode(" ", $graphcmdoutput) . $graphcmd;
1188 1189
			flush();
1189 1190
			usleep(500);
1190 1191
	}			
1191 1192
} else {
1192 1193
	if($data)
1193
		exec("$graphcmd 2>&1", $graphcmdoutput, $graphcmdreturn);
1194
		$_gb = exec("$graphcmd 2>&1", $graphcmdoutput, $graphcmdreturn);
1194 1195
		$graphcmdoutput = implode(" ", $graphcmdoutput) . $graphcmd;
1195 1196
		flush();
1196 1197
		usleep(500);

Formats disponibles : Unified diff