diff options
Diffstat (limited to 'remote')
-rw-r--r--[-rwxr-xr-x] | remote/adei.sh | 5 | ||||
-rw-r--r--[-rwxr-xr-x] | remote/darksoft.sh | 6 | ||||
-rw-r--r--[-rwxr-xr-x] | remote/ipeserv.sh (renamed from remote/ipe.sh) | 4 | ||||
-rw-r--r--[-rwxr-xr-x] | remote/kaas.sh | 4 | ||||
-rwxr-xr-x | remote/kit.sh | 9 | ||||
-rw-r--r-- | remote/lib/parameters.sh | 3 | ||||
-rw-r--r-- | remote/lib/print.sh | 8 | ||||
-rw-r--r-- | remote/lib/report.sh | 43 | ||||
-rw-r--r-- | remote/lib/run.sh | 13 | ||||
-rw-r--r-- | remote/lib/status.sh | 17 | ||||
-rw-r--r-- | remote/lib/support.lua | 669 | ||||
-rwxr-xr-x | remote/overview.sh | 12 |
12 files changed, 98 insertions, 695 deletions
diff --git a/remote/adei.sh b/remote/adei.sh index d5325a6..0b5c42d 100755..100644 --- a/remote/adei.sh +++ b/remote/adei.sh @@ -1,6 +1,6 @@ #! /bin/bash -. lib/status.sh +[ -z $report ] && source lib/status.sh function check_adei { check "KaaS" "kaas" "check_service adei <host> adei-katrin.kaas.kit.edu/adei 'db_server=fpd&db_name=katrin_rep&db_group=0'" @@ -9,5 +9,6 @@ function check_adei { check "CRD" "crd" "check_service adei <host> adei.crd.yerphi.am/adei" } + print "ADEI\n" -standart_report "check_adei" +report "check_adei" diff --git a/remote/darksoft.sh b/remote/darksoft.sh index 5c75d7c..f8f6949 100755..100644 --- a/remote/darksoft.sh +++ b/remote/darksoft.sh @@ -1,13 +1,13 @@ #! /bin/bash -. lib/status.sh +[ -z $report ] && source lib/status.sh function check_darksoft { - check "DarkSoft" "darksoft.org" "check_server_status <host> vpn/192.168.21.1" "check_server_ traffic <host> 20 5" + check "DarkSoft" "darksoft.org" "check_server_status <host> vpn/192.168.21.1" "check_server_ traffic <host> 20 50" check "Suren.me" "suren.me" "check_server_status <host>" check "Serv4" "serv4.suren.me" "check_server_status <host> vpn/192.168.24.1" "check_server_ traffic <host> 5 10" check "Suren/KIT" "suren.data.kit.edu:24" "check_server_status <host> vpn/192.168.15.1" "check_server_ traffic <host> 50 100" } print "DarkSoft Systems\n" -standart_report "check_darksoft" # "cat | print_table | column -t -o ' ' | decorate_table" +report "check_darksoft" # "cat | print_table | column -t -o ' ' | decorate_table" diff --git a/remote/ipe.sh b/remote/ipeserv.sh index 8ef7a2a..9f314a1 100755..100644 --- a/remote/ipe.sh +++ b/remote/ipeserv.sh @@ -1,6 +1,6 @@ #! /bin/bash -. lib/status.sh +[ -z $report ] && source lib/status.sh function check_ipe { check "katrin" "katrin.kit.edu" "check_server_status <host>" @@ -12,4 +12,4 @@ function check_ipe { } print "IPE Servers\n" -standart_report "check_ipe" " print_table | sed 's/,/,#/g' | column -t -s '#' -o '' | decorate_table" +report "check_ipe" " print_table | sed 's/,/,#/g' | column -t -s '#' -o '' | decorate_table" diff --git a/remote/kaas.sh b/remote/kaas.sh index 436ee30..5fc1b4a 100755..100644 --- a/remote/kaas.sh +++ b/remote/kaas.sh @@ -1,6 +1,6 @@ #! /bin/bash -. lib/status.sh +[ -z $report ] && source lib/status.sh function check_kaas { @@ -9,4 +9,4 @@ function check_kaas { } print "KaaS Cluster\n" -standart_report "check_kaas" "print_table | column -t -s '/' -o '/' | decorate_table" +report "check_kaas" "print_table | column -t -s '/' -o '/' | decorate_table" diff --git a/remote/kit.sh b/remote/kit.sh new file mode 100755 index 0000000..9bdbeae --- /dev/null +++ b/remote/kit.sh @@ -0,0 +1,9 @@ +#! /bin/bash + +. lib/status.sh + +run kaas.sh +run adei.sh +run ipeserv.sh + +wait diff --git a/remote/lib/parameters.sh b/remote/lib/parameters.sh index 8ff033e..c172415 100644 --- a/remote/lib/parameters.sh +++ b/remote/lib/parameters.sh @@ -1,8 +1,9 @@ # Configurable timeout=2 fold=120 -#palete='blue' +palete='blue' parallel=0 +report="standart_report" # Helpers diff --git a/remote/lib/print.sh b/remote/lib/print.sh index 465fce5..a0fdcbe 100644 --- a/remote/lib/print.sh +++ b/remote/lib/print.sh @@ -73,13 +73,14 @@ function configure_palete { foreground="white" ;; *) - # Yellow is invisible on white + # Lightgray and Yellow are almost invisible on white colors[yellow]=${colors[orange]} + colors[white]=${colors[black]} + colors[lightgray]=${colors[gray]} colors[cyan]=${colors[blue]} ;; esac - clear set_background reset_color } @@ -164,5 +165,4 @@ function print_status { echo -n " " } - -configure_palete "$palete" +clear diff --git a/remote/lib/report.sh b/remote/lib/report.sh index d808cc2..e6766a4 100644 --- a/remote/lib/report.sh +++ b/remote/lib/report.sh @@ -1,16 +1,51 @@ -function standart_report { +function simple_report { local generator="$1" - local filter="${2:-print_table | decorate_table}" + local filter="${2:-cat}" { - - #check_darksoft 12>/dev/fd/12 | print_table #| column -t -o " " eval "$generator 12>/dev/fd/12 | $filter" report=$(cat<&12) } 12<<EOF EOF wait +} + + +function short_report { + local generator="$1" + local filter="${2:-print_table | decorate_table}" + + configure_palete "$palete" + simple_report "$generator" "$filter" + finish +} + + +function standart_report { + local generator="$1" + local filter="${2:-print_table | decorate_table}" + + configure_palete "$palete" + simple_report "$generator" "$filter" print "$report" echo finish } + + +function report { + # Eval breaks output for some reason + case $report in + simple_report) + simple_report "$@" + ;; + short_report) + short_report "$@" + ;; + standart_report) + standart_report "$@" + ;; + default) + echo "Report is not implemented" + esac +} diff --git a/remote/lib/run.sh b/remote/lib/run.sh new file mode 100644 index 0000000..fdd7311 --- /dev/null +++ b/remote/lib/run.sh @@ -0,0 +1,13 @@ +function run_ { + local output=$(eval source "$@") + + flock -x $0 echo -e "$output" +} + +function run { + if [ $parallel -gt 0 ]; then + run_ "$@" & + else + run_ "$@" + fi +} diff --git a/remote/lib/status.sh b/remote/lib/status.sh index 644f20a..95e7bbb 100644 --- a/remote/lib/status.sh +++ b/remote/lib/status.sh @@ -1,6 +1,7 @@ . lib/parameters.sh . lib/print.sh . lib/report.sh +. lib/run.sh function check_server_traffic { local result="$1" @@ -97,7 +98,7 @@ function check_server_status { service_status=${BASH_REMATCH[1]} service_output=$(sed "1 d" <<< "$service_output") if [ -n "${BASH_REMATCH[2]}" ]; then - service_header=$(sed -r "s/\\$\{color\s+([^}]*)\}/$(set_color \\1)/g" <<< "${BASH_REMATCH[2]}") #" + service_header=$(sed -r "s/\\$\{color\s+([^}]*)\}/\$(set_color \\1)/g" <<< "${BASH_REMATCH[2]}") #" headers="$headers $service_header" fi else @@ -144,21 +145,21 @@ function check_service { health=${BASH_REMATCH[2]} header=${BASH_REMATCH[3]} - output=$(sed '$ d' <<< $ouput) + output=$(sed '$ d' <<< "$output") fi print_status "$online" print_status "$health" - headers=$(sed -r "s/\\$\{color\s+([^}]*)\}/$(set_color \\1)/g" <<< "$header") # " - print " ::: ${headers}" + header=$(sed -r "s/\\$\{color\s+([^}]*)\}/\$(set_color \\1)/g" <<< "$header") # " + print " ::: ${header}" - important=$(grep "^\*" <<< $output) - messages=$(grep -v "^\*" <<< $output) + important=$(grep "^\*" <<< "$output") + messages=$(grep -v "^\*" <<< "$output") if [ -n "$output" ]; then - output="\n$(decorate "$service:$id" "cyan" "u")\n$(set_color white)$important\n$(reset_color)$messages\n" + output="\n$(decorate "$service:$id" "cyan" "u")\n$important\n$(set_color gray)$messages$(reset_color)\n" flock -x $0 echo "${output}" >&12 fi } @@ -170,7 +171,7 @@ function check__ { read -ra args <<< "$1" && shift local host=${args[0]}; - print "$(decorate $title "purple") ::: " | sed -r "s/\\$\{color\s+([^}]*)\}/$(set_color \\1)/g; " + print "$(decorate $title "purple") ::: " | sed -r "s/\\$\{color\s+([^}]*)\}/\$(set_color \\1)/g; " local service for service in "$@"; do diff --git a/remote/lib/support.lua b/remote/lib/support.lua deleted file mode 100644 index 984d677..0000000 --- a/remote/lib/support.lua +++ /dev/null @@ -1,669 +0,0 @@ -require "luarocks.require" -require "md5" -require "lfs" - -home = os.getenv( "HOME" ) - -os.execute("mkdir -p " .. home .. "/.conky/requests"); -os.execute("mkdir -p " .. home .. "/.conky/info"); -c_timer_init = -1 - -do - function conky_eval(...) - return conky_parse(table.concat(arg, " ")) - end - - function conky_multiply_line(times, ...) - local str = table.concat(arg, " ") - local tbl = {} - for i=1,times,1 do - tbl[i] = string.gsub(str,"@i@", i-1) - end - local res = table.concat(tbl,"\n") - return res; - end - - function split(delimiter, text) - local list = {} - local pos = 1 - if string.find("", delimiter, 1) then -- this would result in endless loops - error("delimiter matches empty string!") - end - while 1 do - local first, last = string.find(text, delimiter, pos) - if first then -- found? - table.insert(list, string.sub(text, pos, first-1)) - pos = last+1 - else - table.insert(list, string.sub(text, pos)) - break - end - end - return list - end - - function conky_filter_real_ip(iface) - local req = string.format('${addrs %s}', iface) - local ips = conky_parse(req); ---[[ - print(ips) ---]] - local list = split(",", ips) - for i, item in ipairs(list) do - if (string.match(item, "141\.52\.64")) then - return item - end - end - return "Unknown" - end - - user = split('/', home) - user = user[#user] - - result_check_server_status = {} - result_check_adei_source = {} - result_check_server_ = {} - result_check_service_ = {} - online = {} - status = {} - tested = {} - c_timer = c_timer_init - width = 80 - update_time = 0 - outdate_time = 0 - timeout = 2 - - function conky_set_width (w) - width = tonumber(w) - return "" - end - - function conky_set_timeout (t) - timeout = tonumber(t) - return "" - end - - function cmd_popen(server, port, cmd) - if (c_timer_init == 0) then - return io.popen(cmd) - else - local cmd_md5 = md5.sumhexa(cmd) - local fn = string.format("%s/.conky/info/%s:%s-%s.srv", home, server, port, cmd_md5) - stat = lfs.attributes(fn) - if (stat == nil) then - return nil - end - - local since = os.difftime(stat['modification'], update_time) - if (since < 0) then - return nil - end - since = os.difftime(outdate_time, os.time()) - if (since < 0) then - return nil - end - return io.open(fn, "r") - end - end - - function conky_check_server_status(server, port, ...) - port = port or 22 - local name = string.format("%s:%i", server, port); - - if (c_timer < 0) then - if (c_timer == -1) then - local fn = string.format("%s/.conky/requests/%s:%i.srv", home, server, port) - - tested[string.format("%s:%i", server, port)] = false; - - local f = assert(io.open(fn, "w")) - - local cmd = string.format("/etc/conky/scripts/ping.pl %s:%i %i", server, port, timeout) - f:write(cmd .. "\n") - - if (arg[1] ~= "-") then - cmd = string.format("ssh -x -p %i -o ConnectTimeout=%i root@%s /opt/scripts/check_server_status.sh 2>&1 | fold -w %i", port, timeout, server, width) - f:write(cmd .. "\n") - - for i, service in ipairs(arg) - do - cmd = string.format("ssh -x -p %i -o ConnectTimeout=%i root@%s /opt/scripts/check_%s_status.sh 2>&1 | fold -w %i", port, timeout, server, service, width) - f:write(cmd .. "\n") - end - end - f:close() - end - if (result_check_server_status[name] == nil) then - local res - if (math.abs(c_timer)%2 > 0) then - res = "${color yellow}?${color}" - else - res = "${color yellow}.${color}" - end - - if (arg[1] ~= "-") then - res = res .. " " - for i, service in ipairs(arg) do - res = res .. " " - end - end - --result_check_server_status[server] = res - --status[server] = false - return res - end - elseif (c_timer == 0) then - result_check_server_status[name] = check_server_status(server, port, arg) - end - - return result_check_server_status[name]; - end - - function check_server_status(server, port, additional) - port = port or 22 - - local res - local cmd = string.format("/etc/conky/scripts/ping.pl %s:%i %i", server, port, timeout) - local cmdf = cmd_popen(server, port, cmd) - if (cmdf == nil) then - res = -1 - else - local data = cmdf:read("*a") - res = tonumber(data) - cmdf:close() - end - - if (additional[1] == "-") then - if (res > 0) then - online[server] = true - return "${color green}*" - elseif (res < 0) then - return "${color red}?" - else - online[server] = false - return "${color red}*" - end - end - - if (res > 0) then - online[server] = true - - local output - - cmd = string.format("ssh -x -p %i -o ConnectTimeout=%i root@%s /opt/scripts/check_server_status.sh 2>&1 | fold -w %i", port, timeout, server, width) - cmdf = cmd_popen(server, port, cmd) - if (cmdf == nil) then - output = string.format("${color green}* ${color red}?") - else - local res = {} - local line = cmdf:read("*l") - while line do - local m1 = string.match(line, "^\(.*[^%s]\)%s*$") - if (m1) then - table.insert(res, m1) - end - line = cmdf:read("*l") - end --- res = cmdf:read("*a") - cmdf:close() - - res = table.concat(res, "\n") - - if (string.match(res, "[%a%d]")) then - table.insert(status, string.format("${color yellow}%s:%i${color gray}\n%s", server, port, res)) - output = string.format("${color green}* ${color red}*") - else - output = string.format("${color green}* *") - end - end - - for i, service in ipairs(additional) - do - cmd = string.format("ssh -x -p %i -o ConnectTimeout=%i root@%s /opt/scripts/check_%s_status.sh 2>&1 | fold -w %i", port, timeout, server, service, width) - cmdf = cmd_popen(server, port, cmd) - if (cmdf == nil) then - output = output .. string.format(" ${color red}?") - else - local res = {} - local line = cmdf:read("*l") - while line do - local m1 = string.match(line, "^\(.*[^%s]\)%s*$") - if (m1) then - table.insert(res, m1) - end - line = cmdf:read("*l") - end - cmdf:close() - - if (res[1]) then - local info = table.remove(res) - local s = 0 - local extra = "" - - local m1, m2 = string.match(info, "^\(%d+\)\(%s.+\)$") - if (m1 == nil) then - m1 = string.match(info, "^\%d+$"); - end - if (m1 == nil) then - table.insert(res, info) - else - s = tonumber(m1) - if (m2 ~= nil) then - extra = string.sub(m2,2) - end - end - - if (res[1]) then - res = table.concat(res, "\n") - table.insert(status, string.format("${color yellow}%s:%i:%s${color gray}\n%s", server, port, service, res)) - end - if (s == 0) then - output = output .. string.format(" ${color red}*") - elseif (s == 1) then - output = output .. string.format(" ${color green}*") - else - output = output .. string.format(" ${color yellow}*") - end - output=output .. " ${color white}" .. extra; - else - output = output .. string.format(" ${color green}*") - end - end - end - - return output - else - if (res < 0) then - res = string.format("${color red}? ") - else - online[server] = false - res = string.format("${color red}* ") - end - for i, service in ipairs(additional) do - res = res .. " " - end - - return res - end - end - - function conky_check_adei_source(server, port, config, setup, db_server, db_name, ignore_list) - port = port or 22 - local name = string.format("%s:%i__%s__%s", server, port, db_server, db_name) - if (c_timer < 0) then - if (c_timer == -1) then - ignore_list = ignore_list or "" - - local fn = string.format("%s/.conky/requests/%s:%i.srv", home, server, port) - - local f = assert(io.open(fn, "a+")) - local cmd = string.format('ssh -x -p %i -o ConnectTimeout=%i root@%s /opt/scripts/check_adei_source.sh %s %s %s %s "%s" 2>&1', port, timeout, server, config, setup, db_server, db_name, ignore_list) - f:write(cmd .. "\n") - f:close() - end - - if (result_check_adei_source[name] == nil) then - return "${color yellow}?${color}" - else - if (online[server]) then - return result_check_adei_source[name]; - else - return "${color red}?${color}" - end - end - elseif (online[server]) then - if (c_timer == 0) then - result_check_adei_source[name] = check_adei_source(server, port, config, setup, db_server, db_name, ignore_list) - end - return result_check_adei_source[name]; - else - return "${color red}?${color}" - end - end - - function check_adei_source(server, port, config, setup, db_server, db_name, ignore_list) - ignore_list = ignore_list or "" - cmd = string.format('ssh -x -p %i -o ConnectTimeout=%i root@%s /opt/scripts/check_adei_source.sh %s %s %s %s "%s" 2>&1', port, timeout, server, config, setup, db_server, db_name, ignore_list) - cmdf = cmd_popen(server, port, cmd) - if (cmdf == nil) then - return "${color red}?" - end - - local res = {} - line = cmdf:read("*l") - while line do - local m1 = string.match(line, "^\(.*[^%s]\)%s*$") - if (m1) then - table.insert(res, m1) - end - line = cmdf:read("*l") - end - cmdf:close() - - local info = table.remove(res) - - local t1, t2, t3 = string.match(info, "^\(%d+\)%s+\(%d+\)%s+\(%d+\)") - - local s = tonumber(t1) - if (s == nil) then - table.insert(res, info) - s = 0 - end - - res = table.concat(res, "\n") - - local output - if (s == 1) then - output="${color green}*" - else ---[[ - table.insert(status, string.format("${color yellow}%s -- %s${color gray}\n%s\n", db_server, db_name, res)) ---]] - if (s == 0) then output="${color red}*" - else output="${color yellow}*" end - end - --- if (s ~= 0) then - local groups = tonumber(t2) - if (groups) then - output = output .. string.format("${color white} %i groups", groups); - else - output = output .. string.format("${color red} ? groups"); - end - - local size = tonumber(t3) - if (groups and size) then - output = output .. string.format("${color white}, %i GB", size); - else - output = output .. string.format("${color red}, ? GB"); - end --- end - - if (string.match(res, "[%a%d]")) then - output = output .. "${color gray}\n ${font Bitstream Vera Sans Mono:size=7}" .. string.gsub(res,"\n", "${font}\n ${font Bitstream Vera Sans Mono:size=7}") .. "${font}${color white}" - end - - return output - end - - function conky_check_server_(service, server, port, ...) - port = port or 22 - local name = string.format("%s:%i:%s", server, port, service) - if (c_timer < 0) then - if (c_timer == -1) then - ignore_list = ignore_list or "" - - local fn = string.format("%s/.conky/requests/%s:%i.srv", home, server, port) - - local f = assert(io.open(fn, "a+")) - local cmd = string.format("ssh -x -p %i -o ConnectTimeout=%i root@%s /opt/scripts/check_server_%s.sh 2>&1", port, timeout, server, service) - f:write(cmd .. "\n") - f:close() - end - - if (result_check_server_[name] == nil) then - return "${color yellow}?${color}" - else - if (online[server]) then - return result_check_server_[name]; - else - return "${color red}?${color}" - end - end - elseif (online[server]) then - if (c_timer == 0) then - result_check_server_[name] = check_server_(service, server, port, arg) - end - return result_check_server_[name]; - else - return "${color red}?${color}" - end - end - - function conky_check_service_(service, id, ...) - local name = string.format("%s:%s", service, id) - if (c_timer < 0) then - if (c_timer == -1) then - ignore_list = ignore_list or "" - - tested[string.format("%s:%s", service, id)] = false; - - local fn = string.format("%s/.conky/requests/%s:%s.srv", home, service, id) - - local f = assert(io.open(fn, "a+")) - local cmd = string.format("/etc/conky/service/check_%s.sh %s %s 2>&1", service, id, table.concat(arg, " ")) - f:write(cmd .. "\n") - f:close() - end - - if (result_check_server_[name] == nil) then - return "${color yellow}?${color}" - else - return result_check_server_[name]; - end - else - if (c_timer == 0) then - result_check_server_[name] = check_service_(service, id, arg) - end - return result_check_server_[name]; - end - end - - - function format_traffic(value, yellow, red) - yellow = yellow or 100 - red = red or 1000 - - local value = math.floor(tonumber(value) / 1073741824) - - local res - if (value > red) then res="${color red}" - elseif (value > yellow) then res="${color yellow}" - else res="${color white}" end - - if (value < 10) then res = res .. " " .. value - elseif (value < 100) then res = res .. " " .. value - else res = res .. value end - - return res .. " GB${color gray}" - end - - function check_server_(service, server, port, opts) - port = port or 22 - local cmd = string.format("ssh -x -p %i -o ConnectTimeout=%i root@%s /opt/scripts/check_server_%s.sh 2>&1", port, timeout, server, service) - cmdf = cmd_popen(server, port, cmd) - if (cmdf == nil) then - return "${color red}?" - end - - local res = {} - line = cmdf:read("*l") - while line do - local m1 = string.match(line, "^\(.*[^%s]\)%s*$") - if (m1) then - table.insert(res, m1) - end - line = cmdf:read("*l") - end - cmdf:close() - - if (service == "traffic") then - if (res[1]) then - local t1, t2, t3 = string.match(res[1], "^\(%d+\)%s+\(%d+\)%s+\(%d+\)") - - if (t1 and t2 and t3) then - if ((opts) and (opts[1])) then yellow = tonumber(opts[1]) - else yellow = nil end - if ((opts) and (opts[2])) then red = tonumber(opts[2]) - else red = nil end - - t1=format_traffic(t1,yellow,red) - t2=format_traffic(t2,yellow,red) - t3=format_traffic(t3,yellow,red) - return string.format("${color gray}i: %s, o: %s, f: %s", t1, t2, t3) - else - return "${color red}" .. res[1] - end - end - end - - - return "" - end - - - function check_service_(service, id, opts) - local cmd = string.format("/etc/conky/service/check_%s.sh %s %s 2>&1", service, id, table.concat(opts, " ")) - cmdf = cmd_popen(service, id, cmd) - if (cmdf == nil) then - return "${color red}?" - end - - local res = {} - local local_res = {} - line = cmdf:read("*l") - while line do - local t, m1 = string.match(line, "^\(\*?\)\(.*[^%s]\)%s*$") - if (m1) then - if (t == nil) or (t == '') then - table.insert(res, m1) - else - table.insert(local_res, string.sub(m1,1)) - end - end - line = cmdf:read("*l") - end - cmdf:close() - - local output - local info = table.remove(res) - local t1 = 0 - local t2 = nil - local msg = '' - - if (info) then - t1, t2, msg = string.match(info, "^\(%d+\)%s+\(%d+\)\(.*\)") - end - - local s = tonumber(t1) - if (s == nil) then - table.insert(res, info) - s = 0 - end - - if (s == 1) then - output="${color green}*" - else - if (s == 0) then output="${color red}*" - else output="${color yellow}*" end - end - - s = tonumber(t2) - if (s == nil) then - s = 0 - else - if (s == 1) then - output=output .. " ${color green}*" - else - if (s == 0) then output=output .. " ${color red}*" - else output=output .. " ${color yellow}*" end - end - end - - output = output .. " ${color white}" .. msg - - res = table.concat(res, "\n") - local_res = table.concat(local_res, "\n") - - - if (string.match(res, "[%a%d]")) then - table.insert(status, string.format("${color yellow}%s:%s${color gray}\n%s", service, id, res)) - end - - if (string.match(local_res, "[%a%d]")) then - output = output .. "${color gray}\n ${font Bitstream Vera Sans Mono:size=7}" .. string.gsub(local_res,"\n", "${font}\n ${font Bitstream Vera Sans Mono:size=7}") .. "${font}${color white}" - end - - return output - end - - - - function conky_print_server_errors(interval, tag) - local res = table.concat(status, "\n") - - if (c_timer < 0) then - tag = user .. "_" .. tag - - if (c_timer == -1) then - update_time = os.time() - - local result = 0; - while (result == 0) do - result = os.execute("ps x | grep conky_process_requests | grep " .. tag .. " | grep -v grep > /dev/null") - end - - for item, s in pairs(tested) do - os.execute("/etc/conky/scripts/conky_process_requests.pl \"" .. item .. ".srv\" " .. tag .. " &") - end - end - - local result=os.execute("ps x | grep conky_process_requests | grep " .. tag .. " | grep -v grep > /dev/null") - if (result == 0) then - c_timer = c_timer - 1; - local since = os.difftime(os.time(), update_time) - if (since > tonumber(interval)) then - result_check_server_status = {} - result_check_adei_source = {} - result_check_server_ = {} - end - else - outdate_time = os.time() + 2 * tonumber(interval) - c_timer = 0 - end - return "" - else - c_timer = c_timer + conky_info.update_interval - if (c_timer > tonumber(interval)) then - status = {} - tested = {} - c_timer = c_timer_init - end - end - - if (string.match(res, "[%a%d]")) then - return string.format("\n\n%s", res) - else - return "" - end - end - - function conky_outcon(pos1, pos2) - local n = tonumber(conky_parse('${tcp_portmon 32768 65535 count}')) - local res = {} - local str = "" - for i=1,n do - local val = tostring(conky_parse(string.format('${tcp_portmon 32768 65535 rhost %i}:${tcp_portmon 32768 65535 rport %i}',i - 1,i - 1))) - - if (res[val] == nil) then - res[val] = 1 - else - res[val] = res[val] + 1 - end - end - - - local names = {} - for addr,num in pairs(res) do - table.insert(names, addr) - end - - table.sort(names, function(a,b) return res[a]>res[b] end) - - for i=1,#names do - local name = names[i] - str = str .. string.format("${goto %i}%s${goto %i}cnt %3i\n",pos1,name,pos2,res[name]) - end - - return str - end -end diff --git a/remote/overview.sh b/remote/overview.sh new file mode 100755 index 0000000..da2b83f --- /dev/null +++ b/remote/overview.sh @@ -0,0 +1,12 @@ +#! /bin/bash + +. lib/status.sh + +report="short_report" + +run darksoft.sh +run ipeserv.sh +run kaas.sh +run adei.sh + +wait |