Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 2 commits
  • 3 files changed
  • 0 commit comments
  • 1 contributor
View
6 network/network.py
@@ -1,5 +1,9 @@
#!/usr/bin/python
-import netifaces, sys
+try:
+ import netifaces, sys
+except ImportError:
+ print '{ "version": 1, "title": "Network", "type":"status", "status":"error", "message":"Please install the netifaces Python module to use this script" }'
+ exit()
def command_from_interface(intf):
return '{ "name" : "' + intf + '", "value" : "'+ netifaces.ifaddresses(intf)[netifaces.AF_INET][0]["addr"] + '", "command" : ".pilotssh/network/network.py ' + intf + '" }'
View
4 process/process.sh
@@ -6,14 +6,14 @@ pids=(/proc/[0-9]*)
pid=`basename ${pids[0]}`
data=`awk '/(Name:|VmRSS)/{print \$2 \$3}' ${pids[0]}/status`
array=($data)
-result=$result"{\"name\" : \"${array[0]}\", \"value\":\"${array[1]} ${array[2]}\", \"command\":\".pilotssh/process/process_kill.sh $pid ${array[0]}\"}"
+result=$result"{\"name\" : \"${array[0]}\", \"value\":\"${array[1]} ${array[2]}\", \"command\":\".pilotssh/process/process_info.sh $pid ${array[0]}\"}"
for i in ${pids[*]:1}
do
pid=`basename $i`
data=`awk '/(Name|VmRSS)/{print \$2 \$3}' $i/status`
array=($data)
- result=$result", {\"name\" : \"${array[0]}\", \"value\":\"${array[1]} ${array[2]}\", \"command\":\".pilotssh/process/process_kill.sh $pid ${array[0]}\"}"
+ result=$result", {\"name\" : \"${array[0]}\", \"value\":\"${array[1]} ${array[2]}\", \"command\":\".pilotssh/process/process_info.sh $pid ${array[0]}\"}"
done
result=$result"]}"
View
20 process/process_info.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+result="{ \"version\": 1, \"title\": \"$2\", \"type\":\"commands\", \"values\" : [ "
+
+pid=$1
+name=$2
+#cwd=`readlink /proc/$pid/cwd`
+cmdline=`ps eho command -p $pid`
+cpu=`ps eho %cpu -p $pid`
+mem=`ps eho %mem -p $pid`
+
+result=$result"{\"name\" : \"PID\", \"value\":\"$pid\", \"command\":\"\"},"
+#result=$result"{\"name\" : \"CWD\", \"value\":\"$cwd\", \"command\":\"\"},"
+result=$result"{\"name\" : \"CMD\", \"value\":\"$cmdline\", \"command\":\"\"},"
+result=$result"{\"name\" : \"CPU\", \"value\":\"$cpu\", \"command\":\"\"},"
+result=$result"{\"name\" : \"MEM\", \"value\":\"$mem\", \"command\":\"\"},"
+result=$result"{\"name\" : \"Kill -9\", \"value\":\"\", \"command\":\".pilotssh/process/process_kill.sh $pid $name\"}"
+result=$result" ] }"
+
+echo $result

No commit comments for this range

Something went wrong with that request. Please try again.