ngrapher
  • Overview
  • Repository
  • Tickets
  • Statistics
  • Projects

Repository

Add titles to ngtools

Parent commits : 41561c521d6a73097cc630cb98036d32bbdbdbcc,
Children commits : 8d601f0ef661406894f1021cf91b3994ce0fb634,

By Laurent Defert on 2013-03-03 11:24:04
Add titles to ngtools

Browse content
Difference with parent commit 41561c521d6a73097cc630cb98036d32bbdbdbcc
Files modified:
bin/ngtools.sh
--- 
+++ 
@@ -5,10 +5,16 @@
 
 case $COMMAND in
 	"load")
-		(while true ; do sed -e 's/\(.* .* .*\) .* .*/\1/' < /proc/loadavg ; sleep 5;done)  | $NGRAPHER
+		(echo Load_1$'\t'Load_5$'\t'Load_15
+		while true
+		do
+			sed -e 's/\(.*\) \(.*\) \(.*\) .* .*/\1\t\2\t\3/' < /proc/loadavg
+			sleep 5
+		done) | $NGRAPHER
 		;;
 	"ping")
-		(while true
+		(echo $@
+		while true
 		do
 			first=true
 			for host in  $@
@@ -19,17 +25,32 @@
 				else
 					first=false
 				fi
-				ping -c 1 $host | grep time= | sed -e 's/.*time=\([^ ]*\) ms/\1/g' | tr -d $'\n'
+				ping -c 1 -W 5 $host | grep time= | sed -e 's/.*time=\([^ ]*\) ms/\1/g' | tr -d $'\n'
 			done
 			echo
 			sleep 1
 		done) | $NGRAPHER
 		;;
 	"pmem")
-		(while true; do grep ^VmSize: /proc/$1/status | sed -e 's/[^0-9]//g' ; sleep 1; done) | $NGRAPHER
+		MEM_FILE=/proc/$1/status
+		(echo "Process_memory(kB)"
+		while true
+		do
+			if [ ! -e "$MEM_FILE" ]
+			then
+				break
+			fi
+			grep ^VmSize: "$MEM_FILE" | sed -e 's/[^0-9]//g'
+			sleep 1
+		done) | $NGRAPHER
 	;;
 	"pcpu")
-		(while true; do ps -p $1 -o '%cpu' h ; sleep 1; done) | $NGRAPHER
+		(echo "Process_cpu(%)"
+		while true
+		do
+			ps -p $1 -o '%cpu' h
+			sleep 1
+		done) | $NGRAPHER
 		;;
 	*)
 		echo "Unknown command $1"

ngrapher.c
--- 
+++ 
@@ -27,8 +27,9 @@
 
 const char* help[] = {"h - Move graph to the left",
 			"l - Move graph to the right",
-			"q - Quit",
-			"? - Show this help"};
+			"t - Show/hide the legend",
+			"? - Show/hide this help",
+			"q - Quit"};
 
 static void finish(int sig)
 {

Generated with KisssPM