Projet

Général

Profil

« Précédent | Suivant » 

Révision 57627d9f

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
}
......
329 330
	$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
330 331
	$graphcmd .= "--start $start --end $end --step $step --vertical-label \"bits/sec\" ";
331 332
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
332
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
333
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
333 334
	$graphcmd .= "--height 200 --width 620 ";
334 335
	$graphcmd .= "DEF:$curif-in_bytes_pass=$rrddbpath$curdatabase:inpass:AVERAGE:step=$step ";
335 336
	$graphcmd .= "DEF:$curif-out_bytes_pass=$rrddbpath$curdatabase:outpass:AVERAGE:step=$step ";
......
474 475
	$graphcmd .= "GPRINT:\"$curif-out6_bits_block:LAST:%7.2lf %Sb/s\" ";
475 476
	$graphcmd .= "GPRINT:\"$curif-bytes_out6_t_block:AVERAGE:%7.2lf %sB o\" ";
476 477
	$graphcmd .= "COMMENT:\"\\n\" ";
477
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
478
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
478 479
}
479 480
elseif(strstr($curdatabase, "-throughput.rrd")) {
480 481
	/* define graphcmd for throughput stats */
......
483 484
	$graphcmd .= "--start $start --end $end --step $step ";
484 485
	$graphcmd .= "--vertical-label \"bits/sec\" ";
485 486
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
486
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
487
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
487 488
	$graphcmd .= "--height 200 --width 620 ";
488 489

  
489 490
	$iflist = get_configured_interface_list();
......
602 603
	$graphcmd .= "GPRINT:\"tput-out_bits_block:LAST:%7.2lf %Sb/s\" ";
603 604
	$graphcmd .= "GPRINT:\"tput-bytes_out_t_block:AVERAGE:%7.2lf %sB o\" ";
604 605
	$graphcmd .= "COMMENT:\"\\n\" ";
605
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
606
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
606 607
}
607 608
elseif((strstr($curdatabase, "-packets.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
608 609
	/* define graphcmd for packets stats */
......
610 611
	$graphcmd .= "--start $start --end $end --step $step ";
611 612
	$graphcmd .= "--vertical-label \"packets/sec\" ";
612 613
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
613
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
614
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
614 615
	$graphcmd .= "--height 200 --width 620 ";
615 616
	$graphcmd .= "DEF:\"$curif-in_pps_pass=$rrddbpath$curdatabase:inpass:AVERAGE:step=$step\" ";
616 617
	$graphcmd .= "DEF:\"$curif-out_pps_pass=$rrddbpath$curdatabase:outpass:AVERAGE:step=$step\" ";
......
728 729
	$graphcmd .= "GPRINT:\"$curif-out6_pps_block:LAST:%7.2lf %S pps\" ";
729 730
	$graphcmd .= "GPRINT:\"$curif-pps_out6_t_block:AVERAGE:%7.2lf %s pkts\" ";
730 731
	$graphcmd .= "COMMENT:\"\\n\" ";
731
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
732
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
732 733
}
733 734
elseif((strstr($curdatabase, "-wireless.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
734 735
	/* define graphcmd for packets stats */
......
736 737
	$graphcmd .= "--start $start --end $end --step $step ";
737 738
	$graphcmd .= "--vertical-label \"snr/channel/rate\" ";
738 739
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
739
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
740
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
740 741
	$graphcmd .= "--height 200 --width 620 ";
741 742
	$graphcmd .= "DEF:\"$curif-snr=$rrddbpath$curdatabase:snr:AVERAGE:step=$step\" ";
742 743
	$graphcmd .= "DEF:\"$curif-rate=$rrddbpath$curdatabase:rate:AVERAGE:step=$step\" ";
......
761 762
	$graphcmd .= "GPRINT:\"$curif-channel:AVERAGE:%7.2lf      \" ";
762 763
	$graphcmd .= "GPRINT:\"$curif-channel:LAST:%7.2lf\" ";
763 764
	$graphcmd .= "COMMENT:\"\\n\" ";
764
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
765
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
765 766
}
766 767
elseif((strstr($curdatabase, "-vpnusers.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
767 768
	/* define graphcmd for vpn users stats */
......
769 770
	$graphcmd .= "--start $start --end $end --step $step ";
770 771
	$graphcmd .= "--vertical-label \"users\" ";
771 772
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
772
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
773
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
773 774
	$graphcmd .= "--height 200 --width 620 ";
774 775
	$graphcmd .= "DEF:\"$curif-users=$rrddbpath$curdatabase:users:AVERAGE:step=$step\" ";
775 776
	$graphcmd .= "LINE2:\"$curif-users#{$colorvpnusers[0]}:$curif-users\" ";
......
780 781
	$graphcmd .= "GPRINT:\"$curif-users:AVERAGE:%7.2lf      \" ";
781 782
	$graphcmd .= "GPRINT:\"$curif-users:LAST:%7.2lf \" ";
782 783
	$graphcmd .= "COMMENT:\"\\n\" ";
783
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
784
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
784 785
}
785 786
elseif((strstr($curdatabase, "-states.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
786 787
	/* define graphcmd for states stats */
......
788 789
	$graphcmd .= "--start -$seconds -e -$average --step $step ";
789 790
	$graphcmd .= "--vertical-label \"states, ip\" ";
790 791
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
791
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
792
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
792 793
	$graphcmd .= "--height 200 --width 620 ";
793 794
	$graphcmd .= "DEF:\"$curif-pfrate=$rrddbpath$curdatabase:pfrate:AVERAGE:step=$step\" ";
794 795
	$graphcmd .= "DEF:\"$curif-pfstates=$rrddbpath$curdatabase:pfstates:AVERAGE:step=$step\" ";
......
834 835
	$graphcmd .= "GPRINT:\"$curif-dstip:MAX:%7.2lf %s    \" ";
835 836
	$graphcmd .= "GPRINT:\"$curif-dstip:LAST:%7.2lf %s    \" ";
836 837
	$graphcmd .= "COMMENT:\"\\n\" ";
837
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
838
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
838 839
}
839 840
elseif((strstr($curdatabase, "-processor.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
840 841
	/* define graphcmd for processor stats */
......
842 843
	$graphcmd .= "--start $start --end $end --step $step ";
843 844
	$graphcmd .= "--vertical-label \"utilization, number\" ";
844 845
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
845
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
846
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
846 847
	$graphcmd .= "--height 200 --width 620 ";
847 848
	$graphcmd .= "DEF:\"user=$rrddbpath$curdatabase:user:AVERAGE:step=$step\" ";
848 849
	$graphcmd .= "DEF:\"nice=$rrddbpath$curdatabase:nice:AVERAGE:step=$step\" ";
......
886 887
	$graphcmd .= "GPRINT:\"processes:MAX:%7.2lf %s    \" ";
887 888
	$graphcmd .= "GPRINT:\"processes:LAST:%7.2lf %s    \" ";
888 889
	$graphcmd .= "COMMENT:\"\\n\" ";
889
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
890
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
890 891
}
891 892
elseif((strstr($curdatabase, "-memory.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
892 893
	/* define graphcmd for memory usage stats */
......
894 895
	$graphcmd .= "--start $start --end $end --step $step ";
895 896
	$graphcmd .= "--vertical-label \"utilization, percent\" ";
896 897
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
897
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
898
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
898 899
	$graphcmd .= "--height 200 --width 620 ";
899 900
	$graphcmd .= "DEF:\"active=$rrddbpath$curdatabase:active:AVERAGE:step=$step\" ";
900 901
	$graphcmd .= "DEF:\"inactive=$rrddbpath$curdatabase:inactive:AVERAGE:step=$step\" ";
......
938 939
	$graphcmd .= "GPRINT:\"wire:MAX:%7.2lf %s    \" ";
939 940
	$graphcmd .= "GPRINT:\"wire:LAST:%7.2lf %S    \" ";
940 941
	$graphcmd .= "COMMENT:\"\\n\" ";
941
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
942
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
942 943
}
943 944
elseif((strstr($curdatabase, "-mbuf.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
944 945
	/* define graphcmd for mbuf usage stats */
......
946 947
	$graphcmd .= "--start $start --end $end --step $step ";
947 948
	$graphcmd .= "--vertical-label \"utilization, percent\" ";
948 949
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
949
	$graphcmd .= "--title \"`hostname` - {$prettydb} clusters - {$hperiod} - {$havg} average\" ";
950
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} clusters - {$hperiod} - {$havg} average\" ";
950 951
	$graphcmd .= "--height 200 --width 620 ";
951 952
	$graphcmd .= "DEF:\"current=$rrddbpath$curdatabase:current:AVERAGE:step=$step\" ";
952 953
	$graphcmd .= "DEF:\"cache=$rrddbpath$curdatabase:cache:AVERAGE:step=$step\" ";
......
982 983
	$graphcmd .= "GPRINT:\"max:MAX:%7.2lf %s    \" ";
983 984
	$graphcmd .= "GPRINT:\"max:LAST:%7.2lf %S    \" ";
984 985
	$graphcmd .= "COMMENT:\"\\n\" ";
985
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
986
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
986 987
}
987 988
elseif((strstr($curdatabase, "-queues.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
988 989
	/* define graphcmd for queue stats */
......
990 991
	$graphcmd .= "--start $start --end $end --step $step ";
991 992
	$graphcmd .= "--vertical-label \"bits/sec\" ";
992 993
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
993
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
994
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
994 995
	$graphcmd .= "--height 200 --width 620 ";
995 996
	if ($altq) {
996 997
		$a_queues =& $altq->get_queue_list();
......
1011 1012
		if($t > 7) { $t = 0; }
1012 1013
	}
1013 1014
	$graphcmd .= "COMMENT:\"\\n\" ";
1014
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
1015
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
1015 1016
}
1016 1017
elseif((strstr($curdatabase, "-queuedrops.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
1017 1018
	/* define graphcmd for queuedrop stats */
......
1019 1020
	$graphcmd .= "--start $start --end $end --step $step ";
1020 1021
	$graphcmd .= "--vertical-label \"drops / sec\" ";
1021 1022
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
1022
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
1023
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
1023 1024
	$graphcmd .= "--height 200 --width 620 ";
1024 1025
	if ($altq) {
1025 1026
		$a_queues =& $altq->get_queue_list();
......
1041 1042
		if($t > 7) { $t = 0; }
1042 1043
	}
1043 1044
	$graphcmd .= "COMMENT:\"\\n\" ";
1044
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
1045
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
1045 1046
}
1046 1047
elseif((strstr($curdatabase, "-quality.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
1047 1048
	/* make a link quality graphcmd, we only have WAN for now, others too follow */
1048 1049
	$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png \\
1049 1050
		--start $start --end $end --step $step  \\
1050
		--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" \\
1051
		--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" \\
1051 1052
		--color SHADEA#eeeeee --color SHADEB#eeeeee \\
1052 1053
		--vertical-label \"ms / %\" \\
1053 1054
		--height 200 --width 620 \\
......
1077 1078
		GPRINT:loss:LAST:\"\tLast\: %3.1lf %%\\n\" \\
1078 1079
		AREA:loss10#$colorqualityloss:\"Packet loss\\n\" \\
1079 1080
		LINE1:delay#$colorqualityrtt[5]:\"Delay average\\n\" \\
1080
		COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\"";
1081
		COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\"";
1081 1082
}
1082 1083
elseif((strstr($curdatabase, "spamd.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
1083 1084
	/* graph a spamd statistics graph */
1084 1085
	$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png \\
1085 1086
		--start $start --end $end --step $step \\
1086
		--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" \\
1087
		--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" \\
1087 1088
		--color SHADEA#eeeeee --color SHADEB#eeeeee \\
1088 1089
		--vertical-label=\"Conn / Time, sec.\" \\
1089 1090
		--height 200 --width 620 --no-gridfit \\
......
1116 1117
		GPRINT:consmin:MIN:\"Min\\:%6.2lf\\t\" \\
1117 1118
		GPRINT:consavg:AVERAGE:\"Avg\\:%6.2lf\\t\" \\
1118 1119
		GPRINT:consmax:MAX:\"Max\\:%6.2lf\\n\" \\
1119
		COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
1120
		COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
1120 1121
}
1121 1122
elseif((strstr($curdatabase, "-cellular.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
1122 1123
	$graphcmd = "$rrdtool graph $rrdtmppath$curdatabase-$curgraph.png ";
1123 1124
	$graphcmd .= "--start $start --end $end --step $step ";
1124 1125
	$graphcmd .= "--vertical-label \"signal\" ";
1125 1126
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
1126
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
1127
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
1127 1128
	$graphcmd .= "--height 200 --width 620 ";
1128 1129
	$graphcmd .= "DEF:\"$curif-rssi=$rrddbpath$curdatabase:rssi:AVERAGE:step=$step\" ";
1129 1130
	$graphcmd .= "LINE2:\"$curif-rssi#{$colorwireless[0]}:$curif-rssi\" ";
......
1134 1135
	$graphcmd .= "GPRINT:\"$curif-rssi:AVERAGE:%7.2lf     \" ";
1135 1136
	$graphcmd .= "GPRINT:\"$curif-rssi:LAST:%7.2lf \" ";
1136 1137
	$graphcmd .= "COMMENT:\"\\n\" ";
1137
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";
1138
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";
1138 1139
}
1139 1140
elseif((strstr($curdatabase, "-loggedin.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
1140 1141
	/* define graphcmd for online Captive Portal users stats */
......
1145 1146
	$graphcmd .= "--base=1000 ";
1146 1147
	$graphcmd .= "--lower-limit=0 ";
1147 1148
	$graphcmd .= "--slope-mode ";
1148
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
1149
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
1149 1150
	$graphcmd .= "--height 200 --width 620 ";
1150 1151
	$graphcmd .= "DEF:\"$curif-loggedinusers=$rrddbpath$curdatabase:loggedinusers:AVERAGE:step=$step\" ";
1151 1152
	$graphcmd .= "CDEF:\"$curif-totalusers_t=PREV,UN,0,PREV,IF,$curif-loggedinusers,+\" ";
......
1153 1154
	$graphcmd .= "AREA:\"$curif-totalusers_d#{$colorcaptiveportalusers[0]}:Total logged in users\" ";
1154 1155
	$graphcmd .= "GPRINT:\"$curif-totalusers_d:MAX:%8.0lf \\n\" ";
1155 1156
	$graphcmd .= "COMMENT:\"\\n\" ";
1156
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";	
1157
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";	
1157 1158
}
1158 1159
elseif((strstr($curdatabase, "-concurrent.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
1159 1160
	/* define graphcmd for online Captive Portal users stats */
......
1161 1162
	$graphcmd .= "--start $start --end $end --step $step ";
1162 1163
	$graphcmd .= "--vertical-label \"Captive Portal Users\" ";
1163 1164
	$graphcmd .= "--color SHADEA#eeeeee --color SHADEB#eeeeee ";
1164
	$graphcmd .= "--title \"`hostname` - {$prettydb} - {$hperiod} - {$havg} average\" ";
1165
	$graphcmd .= "--title \"" . php_uname('n') . " - {$prettydb} - {$hperiod} - {$havg} average\" ";
1165 1166
	$graphcmd .= "--base=1000 ";
1166 1167
	$graphcmd .= "--lower-limit=0 ";
1167 1168
	$graphcmd .= "--slope-mode ";
......
1175 1176
	$graphcmd .= "GPRINT:\"$curif-concurrentusers:AVERAGE:%8.0lf      \" ";
1176 1177
	$graphcmd .= "GPRINT:\"$curif-concurrentusers:MAX:%8.0lf \" ";
1177 1178
	$graphcmd .= "COMMENT:\"\\n\" ";
1178
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t`date +\"%b %d %H\:%M\:%S %Y\"`\" ";	
1179
	$graphcmd .= "COMMENT:\"\t\t\t\t\t\t\t\t\t\t\t\t\t" . strftime('%b %d %H\:%M\:%S %Y') . "\" ";	
1179 1180
}
1180 1181
elseif((strstr($curdatabase, "ntpd.rrd")) && (file_exists("$rrddbpath$curdatabase"))) {
1181 1182
	/* define graphcmd for ntpd (was: mbuf) usage stats */
......
1230 1231
if (file_exists("$rrdtmppath$curdatabase-$curgraph.png")) {
1231 1232
	if((time() - filemtime("$rrdtmppath$curdatabase-$curgraph.png")) >= 15 ) {
1232 1233
		if($data)
1233
			exec("$graphcmd 2>&1", $graphcmdoutput, $graphcmdreturn);
1234
			$_gb = exec("$graphcmd 2>&1", $graphcmdoutput, $graphcmdreturn);
1234 1235
			$graphcmdoutput = implode(" ", $graphcmdoutput) . $graphcmd;
1235 1236
			flush();
1236 1237
			usleep(500);
1237 1238
	}			
1238 1239
} else {
1239 1240
	if($data)
1240
		exec("$graphcmd 2>&1", $graphcmdoutput, $graphcmdreturn);
1241
		$_gb = exec("$graphcmd 2>&1", $graphcmdoutput, $graphcmdreturn);
1241 1242
		$graphcmdoutput = implode(" ", $graphcmdoutput) . $graphcmd;
1242 1243
		flush();
1243 1244
		usleep(500);

Formats disponibles : Unified diff