Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules
*.log
*/linuxDash.min.js.map
temp
package-lock.json
30 changes: 30 additions & 0 deletions app/server/linux_json_api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,43 @@ CAT=$(type -P cat)
HEAD=$(type -P head)
CUT=$(type -P cut)
PS=$(type -P ps)
IOSTAT=$(type -p iostat)
WC=$(type -p wc)
TAIL=$(type -p tail)

_parseAndPrint() {
while read data; do
$ECHO -n "$data" | $SED -r 's/\\//g' | $TR -d "\n";
done;
}

rt_iostat() {
num=$($CAT /proc/diskstats | $GREP -E "vd. |sd. |dm|hd. " | $WC -l)
data=$($IOSTAT -dxm 1 2 | $GREP -E "sd. |dm|hd. |vd. " | $TAIL -n ${num} | $AWK '{printf $0"\n"}')
IFSOLD=$IFS
IFS=$'\n'

result=$(
for line in ${data}
do
$ECHO $line | $AWK '{print \
"{ \
\"Device\": \""$1"\", \
\"r/s\": "$4", \
\"w/s\": "$5", \
\"rMB/s\": "$6", \
\"wMB/s\": "$7", \
\"await\": "$10", \
\"%util\": "$14" \
},"}'
done
)

IFS=$IFSOLD

$ECHO -e "[\n""${result}""\n]" | $SED 'N;$s/,\n/\n/;P;D' | _parseAndPrint
}

arp_cache() {
local arpCommand=$(type -P arp)

Expand Down
1 change: 1 addition & 0 deletions src/js/core/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function routesFn($routeProvider) {
'<disk-space sortablejs-id="disk-space"></disk-space> ',
'<swap-usage sortablejs-id="swap-usage"></swap-usage> ',
'<docker-processes sortablejs-id="docker"></docker-processes> ',
'<rt-iostat sortablejs-id="rt-iostat"></rt-iostat> ',
].join(''),
})

Expand Down
7 changes: 6 additions & 1 deletion src/js/plugins/simple-table-data-plugins.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ var simpleTableModules = [
{
name: 'cronHistory',
template: '<table-data heading="Cron Job History" module-name="cron_history" info="Crons which have run recently."></table-data>'
}
},
{
name: 'rtIostat',
template: '<table-data heading="Disk realTime iostat" module-name="rt_iostat" info="real time iostat value."></table-data>'
},

]

simpleTableModules.forEach(function(module, key) {
Expand Down