---
+++
@@ -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"
---
+++
@@ -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