summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--README4
-rw-r--r--archive/netstat.conf.adei91
-rw-r--r--forecast.conf75
-rw-r--r--forecastWU.template38
-rw-r--r--gcalc.template1
-rw-r--r--gentoo.conf63
-rw-r--r--logs.conf43
-rw-r--r--logs.lua20
-rw-r--r--netstat.conf73
-rwxr-xr-xremote/check_server_status.sh18
-rwxr-xr-xremote/check_server_traffic.sh7
-rw-r--r--remote/cron/traffic.cron1
-rwxr-xr-xremote/osx/check_server_status.sh50
-rwxr-xr-xscripts/conky-atom.sh55
-rwxr-xr-xscripts/conky-rss.sh48
-rwxr-xr-xscripts/conky_process_requests.pl77
-rwxr-xr-xscripts/emerge-current.sh33
-rwxr-xr-xscripts/emerge-progress.sh20
-rwxr-xr-xscripts/emerge-status.sh39
-rwxr-xr-xscripts/lastsync.pl7
-rwxr-xr-xscripts/netstat-in.sh9
-rwxr-xr-xscripts/ping.pl19
-rwxr-xr-xscripts/run_conky.sh24
-rw-r--r--service/README11
-rwxr-xr-xservice/check_adei.sh115
-rwxr-xr-xservice/check_gluster.sh83
-rwxr-xr-xservice/check_kaas.sh37
-rw-r--r--service/opts.sh22
-rw-r--r--support.lua669
-rw-r--r--sysinfo.conf109
-rw-r--r--todo.conf61
32 files changed, 1923 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..ae5a993
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+example.conf
diff --git a/README b/README
new file mode 100644
index 0000000..0837e48
--- /dev/null
+++ b/README
@@ -0,0 +1,4 @@
+Requirements
+ luarocks install md5
+ luarocks install luafilesystem
+ luarocks install lrexlib-pcre \ No newline at end of file
diff --git a/archive/netstat.conf.adei b/archive/netstat.conf.adei
new file mode 100644
index 0000000..a2010b0
--- /dev/null
+++ b/archive/netstat.conf.adei
@@ -0,0 +1,91 @@
+update_interval 30
+alignment top_left
+own_window yes
+own_window_transparent no
+own_window_type override
+own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
+own_window_colour 21449c
+
+minimum_size 800 0
+maximum_width 800
+
+double_buffer yes
+background no
+
+text_buffer_size 1024
+
+use_xft yes
+xftfont Bitstream Vera Sans Mono:size=9
+xftalpha 0.8
+#override_utf8_locale yes
+#font -xos4-terminus-medium-r-normal--12-120-72-72-c-60-koi8-r
+
+
+gap_x 600
+gap_y 0
+
+# 2 - standard width in characters
+# 3 - network timeout
+# 5 - interactive apps (xmms)
+# 6 - local apps
+# 7 - networking
+# 8 - ping + remote scripts
+template2 80
+template3 2
+template5 120
+template6 300
+template7 600
+template8 900
+
+#template0 ${if_match ${execi $template8 /etc/conky/scripts/ping.pl \1:3389} > 0}${color green}${else}${color red}${endif}*${color}
+#template0 ${lua_parse check_server_status \1 3389 -}
+template0 ${lua_parse check_server_status \1 22 -}
+template1 ${lua_parse check_server_status \1 3306 -}
+
+lua_load /etc/conky/support.lua
+
+TEXT
+${color yellow}KIT ${hr}${lua set_width $template2}${lua set_timeout $template3}
+${color white}ipepdvsrv1 ${goto 160}${lua_parse check_server_status ipepdvsrv1.ipe.kit.edu}
+#{color white}ipepdvcompute1 ${goto 160}${lua_parse check_server_status ipepdvcompute1.ipe.kit.edu}
+${color white}ipepdv ${goto 160}${lua_parse check_server_status ipepdv.ipe.kit.edu 22 adei}${color white}
+ ${color cyan}Office ${color white}: ${lua_parse check_adei_source ipepdv.ipe.kit.edu 22 adei rrd rrd office}
+# ${color cyan}Virtual Server ${color white}: ${lua_parse check_adei_source ipepdv.ipe.kit.edu 22 adei rrd rrd ipepdvsrv1}
+# ${color cyan}Katrin Server ${color white}: ${lua_parse check_adei_source ipepdv.ipe.kit.edu 22 adei rrd rrd ipekatrinadei}
+# ${color cyan}Compute Server ${color white}: ${lua_parse check_adei_source ipepdv.ipe.kit.edu 22 adei rrd rrd ipepdvcompute1}
+# ${color cyan}UFO Server ${color white}: ${lua_parse check_adei_source ipepdv.ipe.kit.edu 22 adei rrd rrd ufosrv1}
+# ${color cyan}Tango ${color white}: ${lua_parse check_adei_source ipepdv.ipe.kit.edu 22 adei tango tango hdb .*}
+${color white}ipekatrinadei ${goto 160}${lua_parse check_server_status katrin.kit.edu 22 adei}${color white}
+ ${color cyan}FPD ${color white}: ${lua_parse check_adei_source katrin.kit.edu 22 adei katrin fpd katrin_rep}
+ ${color cyan}MOS/ZEUS ${color white}: ${lua_parse check_adei_source katrin.kit.edu 22 adei katrin mos Monitorspeczeus_rep}
+ ${color cyan}MOS/OPC ${color white}: ${lua_parse check_adei_source katrin.kit.edu 22 adei katrin mos0 MonitorSpec_rep HV}
+ ${color cyan}Air Coils ${color white}: ${lua_parse check_adei_source katrin.kit.edu 22 adei katrin aircoils aircoils_rep}
+ ${color cyan}Magnetometer ${color white}: ${lua_parse check_adei_source katrin.kit.edu 22 adei katrin magnetometer0 dbMagnet-archive_rep}
+# ${color cyan}Control System ${color white}: ${lua_parse check_adei_source katrin.kit.edu 22 adei katrin cs0 ControlSystem_rep .*}
+${color white}ikkatrinadei ${goto 160}${lua_parse check_server_status 192.168.110.67 22 adei}${color white}
+ ${color cyan}FPD ${color white}: ${lua_parse check_adei_source 192.168.110.67 22 adei detector detector katrin}
+ ${color cyan}MOS ${color white}: ${lua_parse check_adei_source 192.168.110.67 22 adei detector monitorspec monitorspec}
+ ${color cyan}Air Coils ${color white}: ${lua_parse check_adei_source 192.168.110.67 22 adei detector aircoils aircoils}
+${color white}imkmastadei ${goto 160}${lua_parse check_server_status imkmastadei.ka.fzk.de 22 adei}${color white}
+ ${color cyan}Weather Tower ${color white}: ${lua_parse check_adei_source imkmastadei.ka.fzk.de 22 adei wt mast Mastdaten_rep '.*(Licor|Sonic|Calc|Archive)'}
+#${color white}cube-router${goto 160}${lua_parse check_server_status cube-router.ipe.kit.edu 24 adei}${color white}
+# ${color cyan}KIT Cube ${color white}: ${lua_parse check_adei_source cube-router.ka.fzk.de 24 adei kitcube kitcube kitcube_actual .*}
+${color white}itepmtadei ${goto 160}${lua_parse check_server_status itepmtadei.itep.kit.edu 22 adei}${color white}
+ ${color cyan}TOSKA ${color white}: ${lua_parse check_adei_source itepmtadei.itep.kit.edu 22 adei toska toska \\#1 .*}
+${color white}pcebessadei ${goto 160}${lua_parse check_server_status pcebessadei.competence-e.kit.edu 22 adei}${color white}
+ ${color cyan}BESS50 ${color white}: ${lua_parse check_adei_source pcebessadei.competence-e.kit.edu 22 adei battery battery \\#1 .*}
+ ${color cyan}BESS32/Socket ${color white}: ${lua_parse check_adei_source pcebessadei.competence-e.kit.edu 22 adei battery bess32-ac-sock \\#1 .*}
+ ${color cyan}BESS32/MDF ${color white}: ${lua_parse check_adei_source pcebessadei.competence-e.kit.edu 22 adei battery bess32-ac-mdf \\#1 .*}
+ ${color cyan}BESS32/MDF ${color white}: ${lua_parse check_adei_source pcebessadei.competence-e.kit.edu 22 adei battery bess32-ac-mdf \\#1 .*}
+ ${color cyan}PV1000 ${color white}: ${lua_parse check_adei_source pcebessadei.competence-e.kit.edu 22 adei battery pvcn1000 \\#1 .*}
+ ${color cyan}Weather ${color white}: ${lua_parse check_adei_source pcebessadei.competence-e.kit.edu 22 adei battery mast Mastdaten_rep .*}
+#${color white}Tango${goto 160}${template1 ipepdvtango2.ipe.kit.edu}
+${color white}IpeCube ${goto 160}${template0 ipecube.ipe.kit.edu}${lua_parse print_server_errors $template8 conky_netstat}
+
+${color yellow}Network Connections ${hr}
+${color white}Incomming connections${color gray}:
+${execpi $template5 /etc/conky/scripts/netstat-in.sh | grep -v "android-d855cbd1c9f827d" | grep -v "pdv-time-capsule-2.ipe.kit.edu" | awk -e '{ print "${goto 18}", $1, "${goto 720} to", $2 }' }
+#${lua_parse conky_eval $${lua_parse multiply_line ${tcp_portmon 1 32767 count} $${goto 18}$${tcp_portmon 1 32767 rhost @i@}:$${tcp_portmon 1 32767 rport @i@}$${goto 720}to$${offset 18} $${tcp_portmon 1 32767 lport @i@}}}
+${color white}Outgoing connections${color gray}:
+#${lua_parse conky_eval $${lua_parse multiply_line ${tcp_portmon 32768 65535 count} $${goto 18}$${tcp_portmon 32768 65535 rhost @i@}:$${tcp_portmon 32768 65535 rport @i@}$${goto 400}from $${tcp_portmon 32768 65535 lport @i@}}}
+${lua_parse conky_outcon 18 720}
diff --git a/forecast.conf b/forecast.conf
new file mode 100644
index 0000000..7fe13bd
--- /dev/null
+++ b/forecast.conf
@@ -0,0 +1,75 @@
+update_interval 60
+alignment top_right
+double_buffer yes
+
+background no
+use_xft yes
+xftfont Bitstream Vera Sans Mono:size=9
+xftalpha 0.8
+
+update_interval 1.0
+total_run_times 0
+
+# Minimum size of text area
+minimum_size 440 0
+maximum_width 440
+
+draw_shades yes
+draw_outline no
+draw_borders no
+draw_graph_borders yes
+stippled_borders 8
+border_inner_margin 4
+border_width 1
+
+# own window options
+own_window yes
+#own_window_transparent yes
+own_window_type override
+own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
+own_window_colour 21449c
+
+
+# Gap between borders of screen and text
+# same thing as passing -x at command line
+#gap_x 280
+#gap_x -2280
+#gap_y 0
+
+gap_y 720
+gap_x -4460
+
+# Force UTF8? note that UTF8 support required XFT
+override_utf8_locale yes
+
+# Add spaces to keep things from moving about? This only affects certain objects.
+use_spacer right
+
+# Default colors and also border colors
+default_color white
+default_shade_color black
+default_outline_color white
+
+color1 white
+#color2 6892C6
+color2 orange
+#color3 FC8820
+color3 yellow
+color4 78BF39
+color5 CC0000
+
+text_buffer_size 2048
+
+# 5 - interactive apps (xmms)
+# 6 - local apps
+# 7 - networking
+# 8 - ping + remote scripts
+template5 120
+template6 300
+template7 600
+template8 900
+
+TEXT
+${offset -5}${color3}${font StyleBats:style=CleanCut:size=12}q ${voffset -2}${font Bitstream Vera Sans Mono:style=Bold:size=11}Weather${font} ${goto 120}${hr}${color1}
+${execpi $template7 conkyForecastWU -C /usr/share/conkyforecast/conkyForecastWU.config --location=zmw:00000.24.10727 --template=/etc/conky/forecastWU.template}
+${voffset -200}
diff --git a/forecastWU.template b/forecastWU.template
new file mode 100644
index 0000000..33ee602
--- /dev/null
+++ b/forecastWU.template
@@ -0,0 +1,38 @@
+${voffset 64}${goto 12}${color1}${font Bitstream Vera Sans Mono:style=Bold:size=10}[--datatype=HT --hideunits --centeredwidth=3] - [--datatype=LT --hideunits --centeredwidth=3]
+${voffset 56}${goto 16}${font Bitstream Vera Sans Mono:size=9}[--datatype=HT --startday=0 --endday=0 --hideunits --centeredwidth=3 --spaces=8]
+${voffset -19}${goto 72}${font Bitstream Vera Sans Mono:size=9}[--datatype=LT --startday=0 --endday=0 --hideunits --centeredwidth=3 --spaces=8]
+${voffset 0}${goto 16}[--datatype=PC --startday=0 --endday=0 --hideunits --centeredwidth=3 --spaces=8]
+${voffset -19}${goto 72}[--datatype=PC --night --startday=0 --endday=0 --hideunits --centeredwidth=3 --spaces=8]
+${color3}${hr}${color1}
+
+${voffset -220}${goto 120}${color4}Station: ${color1}[--datatype=OB]
+${goto 120}${color4}Time: ${color1}[--datatype=LU]
+${goto 120}${color4}Status: ${color1}[--datatype=CT --hideunits --centeredwidth=8]
+${goto 120}${color4}Humidity: ${color1}[--datatype=HM]
+${goto 120}${color4}Visibility: ${color1}[--datatype=VI]
+${goto 120}${color4}Bar: ${color1}[--datatype=BR] - [--datatype=BD]
+${goto 120}${color4}UV: ${color1}[--datatype=UI] - [--datatype=UT]
+${goto 120}${color4}Dew Point: ${color1}[--datatype=DP]
+${goto 120}${color4}Sunrise: ${color1}[--datatype=SR] / [--datatype=SS]
+${goto 120}${color4}Moon: ${color1}[--datatype=MP]
+${color}
+
+${voffset -185}${goto 364}${font ConkyWindNESW:size=40}[--datatype=BF]${font}
+${voffset 0}${goto 360}[--datatype=WS --centeredwidth=8]
+${image [--datatype=MI] -p 360,146 -s 64x64}
+
+${color2}${voffset 36}${goto 46}${font Bitstream Vera Sans Mono:size=11}[--datatype=DW --startday=1 --endday=3 --shortweekday --spaces=10]${color1}
+${voffset 56}${goto 20}${font Bitstream Vera Sans Mono:size=9}[--datatype=HT --startday=1 --endday=3 --hideunits --centeredwidth=3 --spaces=13]
+${voffset -19}${goto 80}${font Bitstream Vera Sans Mono:size=9}[--datatype=LT --startday=1 --endday=3 --hideunits --centeredwidth=3 --spaces=13]
+${voffset 0}${goto 20}${font Bitstream Vera Sans Mono:size=9}[--datatype=PC --startday=1 --endday=3 --hideunits --centeredwidth=3 --spaces=13]
+${voffset -19}${goto 80}${font Bitstream Vera Sans Mono:size=9}[--datatype=PC --night --startday=1 --endday=2 --hideunits --centeredwidth=3 --spaces=13]
+
+${image [--datatype=WI] -p 32,32}
+${image [--datatype=WI --startday=0] -p 0,108}
+${image [--datatype=WI --night --startday=0] -p 56,108}
+
+${image [--datatype=WI --startday=1] -p 0,245}
+${image [--datatype=WI --night --startday=1] -p 64,245}
+${image [--datatype=WI --startday=2] -p 160,245}
+${image [--datatype=WI --night --startday=2] -p 224,245}
+${image [--datatype=WI --startday=3] -p 320,245}
diff --git a/gcalc.template b/gcalc.template
new file mode 100644
index 0000000..343ca7d
--- /dev/null
+++ b/gcalc.template
@@ -0,0 +1 @@
+[starttime] [title]
diff --git a/gentoo.conf b/gentoo.conf
new file mode 100644
index 0000000..b992037
--- /dev/null
+++ b/gentoo.conf
@@ -0,0 +1,63 @@
+update_interval 5
+alignment top_left
+own_window yes
+own_window_transparent no
+own_window_type override
+own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
+own_window_colour 21449c
+
+minimum_size 1000 0
+maximum_width 1000
+
+double_buffer yes
+background no
+
+text_buffer_size 4096
+
+use_xft yes
+xftfont DejaVu Sans Mono:size=9
+xftalpha 0.8
+override_utf8_locale yes
+
+gap_x 1500
+gap_y 0
+
+# 2 - standard width in characters
+# 3 - network timeout
+# 5 - interactive apps (xmms)
+# 6 - local apps
+# 7 - networking
+# 8 - ping + remote scripts
+template2 100
+template3 2
+template5 120
+template6 300
+template7 800
+template8 900
+
+#template0 ${if_match ${execi $template8 /etc/conky/scripts/ping.pl \1:3389} > 0}${color green}${else}${color red}${endif}*${color}
+template0 ${lua_parse check_server_status \1 3389 -}
+
+#lua_load /etc/conky/support.lua
+
+TEXT
+${color yellow}Gentoo ${hr}${color gray}
+${color white}Last Sync ${color gray}${execi $template6 /etc/conky/scripts/lastsync.pl}
+${color white}Current Status ${color gray}${execi $template5 /etc/conky/scripts/emerge-status.sh}
+${color white}Current Progress ${color green}${execibar $template5 /etc/conky/scripts/emerge-progress.sh}
+${color white}Current Packages ${color gray}${execi $template5 /etc/conky/scripts/emerge-current.sh 8 | fmt -w $template2 }
+
+${color yellow}Security ${hr}${color gray}
+${color gray}${execi $template7 rsstail -n 8 -1 -u https://security.gentoo.org/glsa/feed.rss | cut -d ':' -f 2- | cut -c 2- | fmt -t -w $template2 }
+
+${color yellow}New Packages ${hr}${color gray}
+${color gray}${execi $template7 rsstail -n 8 -1 -u https://packages.gentoo.org/packages/added.atom | cut -d ':' -f 2- | cut -c 2- | fmt -t -w $template2 }
+
+${color yellow}Gentoo Planet ${hr}${color gray}
+${execi $template7 rsstail -n 8 -1 -u http://planet.gentoo.org/rss20.xml | cut -d ':' -f 3- | cut -c 2- | fmt -t -w $template2 }
+
+${color yellow}LWN Headlines ${hr}${color gray}
+${execi $template7 rsstail -n 8 -1 -u http://lwn.net/headlines/rss | cut -d ':' -f 2- | cut -c 2- | fmt -t -w $template2 }
+
+${color yellow}IBM Developerworks ${hr}${color gray}
+${execi $template7 rsstail -n 8 -1 -u 'http://www.ibm.com/developerworks/views/rss/customrssatom.jsp?zone_by=AIX&zone_by=Linux&zone_by=Open+source&type_by=Articles&type_by=Tutorials&search_by=&day=1&month=01&year=2008&max_entries=10&feed_by=rss&encoding=UTF-8&isGUI=true&Submit.x=41&Submit.y=15' | cut -d ':' -f 2- | cut -c 2- | fmt -t -w $template2}
diff --git a/logs.conf b/logs.conf
new file mode 100644
index 0000000..250e452
--- /dev/null
+++ b/logs.conf
@@ -0,0 +1,43 @@
+update_interval 5
+alignment top_left
+own_window yes
+own_window_transparent no
+own_window_type override
+own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
+own_window_colour 21449c
+
+minimum_size 1600 0
+maximum_width 1600
+
+double_buffer yes
+background no
+
+text_buffer_size 4096
+
+use_xft yes
+xftfont Bitstream Vera Sans Mono:size=7
+xftalpha 0.8
+#override_utf8_locale yes
+#font -xos4-terminus-medium-r-normal--12-120-72-72-c-60-koi8-r
+
+
+gap_x 2560
+gap_y 0
+
+lua_load /etc/conky/logs.lua
+
+TEXT
+${color yellow}styx ${hr}${color gray}
+${lua_parse filter_syslog /var/log/styx 22}
+
+${color yellow}darksoft.org ${hr}${color gray}
+${lua_parse filter_syslog /var/log/messages_darkserv1 22}
+
+#${color yellow}aragats.am ${hr}${color gray}
+#${lua_parse filter_syslog /var/log/messages_darkserv2 22}
+
+${color yellow}serv4.suren.me ${hr}${color gray}
+${lua_parse filter_syslog /var/log/messages_darkserv4 22}
+
+${color yellow}suren.fzk.de ${hr}${color gray}
+${lua_parse filter_syslog /var/log/messages_darkserv3 22}
diff --git a/logs.lua b/logs.lua
new file mode 100644
index 0000000..051f2a7
--- /dev/null
+++ b/logs.lua
@@ -0,0 +1,20 @@
+require "luarocks.require"
+rex_pcre = require "rex_pcre"
+
+do
+ function conky_filter_syslog(log, lines)
+ local data = conky_parse('${tail ' .. log .. ' ' .. lines .. ')}')
+-- return rex_pcre.gsub(data,"(MAC|OUT|IN|TOS|PREC|ID|RES)=[\\w\\d:]*\\s", "")
+ local lines = rex_pcre.split(data, "\\x02")
+ local res = {}
+ for line in lines do
+ if (rex_pcre.match(line, "\\*\\*\\*\\s*(PortScan|SynFlood.*|BlackList|Fragments|DeathPing)\\s*\\*\\*\\*")) then
+ local fixed = rex_pcre.gsub(line,"(MAC|OUT|IN|TOS|PREC|ID|RES)=[\\w\\d:]*\\s", "")
+ table.insert(res, fixed)
+ else
+ table.insert(res, line)
+ end
+ end
+ return table.concat(res, "\n")
+ end
+end
diff --git a/netstat.conf b/netstat.conf
new file mode 100644
index 0000000..62f9261
--- /dev/null
+++ b/netstat.conf
@@ -0,0 +1,73 @@
+update_interval 30
+alignment top_left
+own_window yes
+own_window_transparent no
+own_window_type override
+own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
+own_window_colour 21449c
+
+minimum_size 800 0
+maximum_width 800
+
+double_buffer yes
+background no
+
+text_buffer_size 1024
+
+use_xft yes
+xftfont Bitstream Vera Sans Mono:size=9
+xftalpha 0.8
+#override_utf8_locale yes
+#font -xos4-terminus-medium-r-normal--12-120-72-72-c-60-koi8-r
+
+
+gap_x 600
+gap_y 0
+
+# 2 - standard width in characters
+# 3 - network timeout
+# 5 - interactive apps (xmms)
+# 6 - local apps
+# 7 - networking
+# 8 - ping + remote scripts
+template2 80
+template3 2
+template5 120
+template6 300
+template7 600
+template8 900
+
+#template0 ${if_match ${execi $template8 /etc/conky/scripts/ping.pl \1:3389} > 0}${color green}${else}${color red}${endif}*${color}
+#template0 ${lua_parse check_server_status \1 3389 -}
+template0 ${lua_parse check_server_status \1 22 -}
+template1 ${lua_parse check_server_status \1 3306 -}
+
+lua_load /etc/conky/support.lua
+
+TEXT
+${color yellow}Cluster ${hr}${lua set_width $template2}${lua set_timeout $template3}
+${color white}KaaS ${goto 160}${lua_parse check_service_ kaas kaas.kit.edu 3}${color white}
+${color white}KaaS/Gluster ${goto 160}${lua_parse check_service_ gluster kaas.kit.edu}${color white}
+
+${color yellow}Servers ${hr}${lua set_width $template2}${lua set_timeout $template3}
+${color white}ipepdvsrv1 ${goto 160}${lua_parse check_server_status ipepdvsrv1.ipe.kit.edu}
+${color white}ipepdvsrv2 ${goto 160}${lua_parse check_server_status ipepdvsrv2.ipe.kit.edu}
+${color white}katrin ${goto 160}${lua_parse check_server_status katrin.kit.edu}
+${color white}ipekatrin1 ${goto 160}${lua_parse check_server_status ipekatrin1.ipe.kit.edu 22 uptime}
+${color white}ipekatrin2 ${goto 160}${lua_parse check_server_status ipekatrin2.ipe.kit.edu 22 uptime}
+${color white}ipekatrin3 ${goto 160}${lua_parse check_server_status ipekatrin3.ipe.kit.edu 22 uptime}
+
+${color yellow}ADEI ${hr}${lua set_width $template2}${lua set_timeout $template3}
+${color white}KaaS ${goto 160}${lua_parse check_service_ adei kaas adei-katrin.kaas.kit.edu/adei 'db_server=fpd&db_name=katrin_rep&db_group=0'}${color white}
+${color white}ipekatrinadei ${goto 160}${lua_parse check_service_ adei katrin katrin.kit.edu/adei-katrin-orig 'db_server=fpd&db_name=katrin_rep&db_group=0'}${color white}
+${color white}pcebessadei ${goto 160}${lua_parse check_service_ adei pcebess pcebessadei.competence-e.kit.edu/adei-battery}${color white}
+${color white}ipemkmastadei ${goto 160}${lua_parse check_service_ adei imkmast imkmastadei.ka.fzk.de/adei}${color white}
+${color white}itepmtadei ${goto 160}${lua_parse check_service_ adei itepmt itepmtadei.itep.kit.edu/adei}${color white}
+${color white}CRD ${goto 160}${lua_parse check_service_ adei crd adei.crd.yerphi.am/adei}${color white}
+${lua_parse print_server_errors $template8 conky_netstat}
+
+${color yellow}Network Connections ${hr}
+${color white}Incomming connections${color gray}:
+${execpi $template5 /etc/conky/scripts/netstat-in.sh | grep -v "android-d855cbd1c9f827d" | grep -v "pdv-time-capsule-2.ipe.kit.edu" | awk -e '{ print "${goto 18}", $1, "${goto 720} to", $2 }' }
+${color white}Outgoing connections${color gray}:
+${lua_parse conky_outcon 18 720}
diff --git a/remote/check_server_status.sh b/remote/check_server_status.sh
new file mode 100755
index 0000000..791ad12
--- /dev/null
+++ b/remote/check_server_status.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+fs=`df -m | grep /dev/sda2 | sed -e 's/[[:space:]]\+/ /g' | cut -d ' ' -f 4`
+mem=`free -m | grep "buffers/cache" | sed -e 's/[[:space:]]\+/ /g' | cut -d ' ' -f 4`
+cpu=`uptime | sed -e "s/[[:space:]]/\n/g" | tail -n 1`
+
+if [ $fs -le 8192 ]; then
+ echo "Only $(($fs / 1024)) GB left in the file system"
+fi
+
+if [ $mem -le 128 ]; then
+ echo "The system is starving on memory, $mem MB left free"
+fi
+
+#Multiply by number of CPU cores
+if [ `echo "$cpu < 0.98" | bc` -eq 0 ]; then
+ echo "The system is starving on cpu, $cpu is load average for the last 15 min"
+fi
diff --git a/remote/check_server_traffic.sh b/remote/check_server_traffic.sh
new file mode 100755
index 0000000..a9f0abf
--- /dev/null
+++ b/remote/check_server_traffic.sh
@@ -0,0 +1,7 @@
+#! /bin/bash
+
+all_in=`iptables -L traffic_in -n -v -x | grep -E "0\.0\.0\.0/0[[:space:]]+0\.0\.0\.0/0" | awk 'END { print $2}'`
+all_out=`iptables -L traffic_out -n -v -x | grep -E "0\.0\.0\.0/0[[:space:]]+0\.0\.0\.0/0" | awk 'END { print $2}'`
+all_forward=`iptables -L traffic_forward -n -v -x | grep -E "0\.0\.0\.0/0[[:space:]]+0\.0\.0\.0/0" | awk 'END { print $2}'`
+
+echo "$all_in $all_out $all_forward"
diff --git a/remote/cron/traffic.cron b/remote/cron/traffic.cron
new file mode 100644
index 0000000..0325d0a
--- /dev/null
+++ b/remote/cron/traffic.cron
@@ -0,0 +1 @@
+0 0 * * 1 root /sbin/iptables -Z traffic_in; /sbin/iptables -Z traffic_out; /sbin/iptables -Z traffic_forward
diff --git a/remote/osx/check_server_status.sh b/remote/osx/check_server_status.sh
new file mode 100755
index 0000000..ec7c0f2
--- /dev/null
+++ b/remote/osx/check_server_status.sh
@@ -0,0 +1,50 @@
+#!/bin/bash
+
+root=`df -m | grep /dev/disk3s2 | sed -E 's/[[:space:]]+/ /g' | cut -d ' ' -f 4`
+fs=`df -m | grep /dev/disk2 | sed -E 's/[[:space:]]+/ /g' | cut -d ' ' -f 4`
+cpu=`uptime | sed -E "s/[[:space:]]+/ /g" | tr ' ' '\n' | tail -n 1`
+mem=`top -l 1 | grep PhysMem | sed -E "s/[[:space:]]+/ /g"`
+
+cache=`echo $mem | cut -f 6 -d ' '`
+free=`echo $mem | cut -f 10 -d ' '`
+
+len=`echo $cache | wc -c`
+len=`expr $len - 1`
+units=`echo $cache | cut -c $len`
+len=`expr $len - 1`
+size=`echo $cache | cut -c -$len`
+
+if [ $units == "G" ]; then
+ size=`expr $size '*' 1024`
+elif [ $units != "M" ]; then
+ size=0
+fi
+
+len=`echo $free | wc -c`
+len=`expr $len - 1`
+units=`echo $free | cut -c $len`
+len=`expr $len - 1`
+fsize=`echo $free | cut -c -$len`
+if [ $units == "G" ]; then
+ size=`expr $fsize '*' 1024 + $size`
+elif [ $units == "M" ]; then
+ size=`expr $fsize + $size`
+fi
+
+mem=$size
+
+if [ $root -le 8192 ]; then
+ echo "Only $(($root / 1024)) GB left in the root file system"
+fi
+
+if [ $fs -le 102400 ]; then
+ echo "Only $(($fs / 1024)) GB left in the PDV file system"
+fi
+
+if [ $mem -le 512 ]; then
+ echo "The system is starving on memory, $mem MB left free"
+fi
+
+if [ `echo "$cpu < 7.80" | bc` -eq 0 ]; then
+ echo "The system is starving on cpu, $cpu is load average for the last 15 min"
+fi
diff --git a/scripts/conky-atom.sh b/scripts/conky-atom.sh
new file mode 100755
index 0000000..2cd0192
--- /dev/null
+++ b/scripts/conky-atom.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+# RSS Display Script by Bill Woodford (admin@sdesign.us) v1.0
+#
+# This script is designed to output story titles for most any RSS Feed.
+#
+# This script depends on curl. Please ensure it is installed and in your $PATH
+# Gentoo: emerge -av net-misc/curl
+# Debian: apt-get install curl
+# Homepage: http://curl.haxx.se/
+#
+# Usage:
+# .conkyrc: ${execi [time] /path/to/script/conky-rss.sh URI LINES TITLENUM}
+# URI = Location of feed, ex. http://www.gentoo.org/rdf/en/glsa-index.rdf
+# LINES = How many titles to display (default 5)
+# TITLENUM = How many times the title of the feed itself is specified, usually 1 or 2 (default 2)
+#
+# Usage Example
+# ${execi 300 /home/youruser/scripts/conky-rss.sh http://www.foxnews.com/xmlfeed/rss/0,4313,1,00.rss 4 2}
+
+#RSS Setup - Don't change unless you want these values hard-coded!
+uri=$1 #URI of RSS Feed
+lines=$2 #Number of headlines
+titlenum=$3 #Number of extra titles
+if [ -n $4 ]; then
+ width=$4
+else
+ width=1024
+fi
+
+#Script start
+#Require a uri, as a minimum
+if [[ "$uri" == "" ]]; then
+ echo "No URI specified, cannot continue!" >&2
+ echo "Please read script for more information" >&2
+else
+ #Set defaults if none specified
+ if [[ $lines == "" ]]; then lines=5 ; fi
+ if [[ $titlenum == "" ]]; then titlenum=2 ; fi
+
+ #The actual work
+ atom=`curl -s --connect-timeout 30 $uri`
+ echo $atom |\
+ sed -e 's/<\/title>/<\/title>\n/g' |\
+ grep '<title' |\
+ sed -e 's/^.*<title/<title/' |\
+ sed -e 's#<\(/\?\)title>#<\1p>#g' |\
+ html2text -utf8 -width 65536 |\
+ cut -d '/' -f 2- | sed -e 's/-[[:digit:].r\-]\+:/:/' |\
+ tail -n +2 |\
+ head -n $(($lines + $titlenum)) |\
+ tail -n $(($lines)) |\
+ cut -c 1-`echo $((3 * $width))` |\
+ fmt -t -w $width
+
+fi
diff --git a/scripts/conky-rss.sh b/scripts/conky-rss.sh
new file mode 100755
index 0000000..92375b5
--- /dev/null
+++ b/scripts/conky-rss.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+# RSS Display Script by Bill Woodford (admin@sdesign.us) v1.0
+#
+# This script is designed to output story titles for most any RSS Feed.
+#
+# This script depends on curl. Please ensure it is installed and in your $PATH
+# Gentoo: emerge -av net-misc/curl
+# Debian: apt-get install curl
+# Homepage: http://curl.haxx.se/
+#
+# Usage:
+# .conkyrc: ${execi [time] /path/to/script/conky-rss.sh URI LINES TITLENUM}
+# URI = Location of feed, ex. http://www.gentoo.org/rdf/en/glsa-index.rdf
+# LINES = How many titles to display (default 5)
+# TITLENUM = How many times the title of the feed itself is specified, usually 1 or 2 (default 2)
+#
+# Usage Example
+# ${execi 300 /home/youruser/scripts/conky-rss.sh http://www.foxnews.com/xmlfeed/rss/0,4313,1,00.rss 4 2}
+
+#RSS Setup - Don't change unless you want these values hard-coded!
+uri=$1 #URI of RSS Feed
+lines=$2 #Number of headlines
+titlenum=$3 #Number of extra titles
+if [ -n $4 ]; then
+ width=$4
+else
+ width=1024
+fi
+
+#Script start
+#Require a uri, as a minimum
+if [[ "$uri" == "" ]]; then
+ echo "No URI specified, cannot continue!" >&2
+ echo "Please read script for more information" >&2
+else
+ #Set defaults if none specified
+ if [[ $lines == "" ]]; then lines=5 ; fi
+ if [[ $titlenum == "" ]]; then titlenum=2 ; fi
+
+ #The actual work
+ curl -s --connect-timeout 30 $uri |\
+ sed -e 's/<\/title>/\n/g' |\
+ grep -o '<title>.*' |\
+ sed -e 's/<title>//' |\
+ head -n $(($lines + $titlenum)) |\
+ tail -n $(($lines)) | \
+ fmt -t -w $width
+fi
diff --git a/scripts/conky_process_requests.pl b/scripts/conky_process_requests.pl
new file mode 100755
index 0000000..4e66d7a
--- /dev/null
+++ b/scripts/conky_process_requests.pl
@@ -0,0 +1,77 @@
+#! /usr/bin/perl
+
+use Digest::MD5 qw(md5_hex);
+
+$dir = $ENV{'HOME'} . "/.conky/info/";
+
+sub process_server_request {
+ my $server = shift(@_);
+ my $fn = shift(@_);
+
+ open fl, $fn;
+ @commands = <fl>;
+ close fl;
+
+ $n_cmd = 0;
+ foreach $cmd(@commands) {
+ if ($cmd !~ /^[\/\w\d_]/) {next;}
+ $n_cmd = $n_cmd + 1;
+ }
+
+ if ($n_cmd > 1) {
+ $ping = $commands[0];
+ chomp($ping);
+
+ $md5 = md5_hex($ping);
+ $res = `$ping`;
+
+ open(fl, ">$dir/$server-$md5.srv");
+ print fl $res;
+ close(fl);
+
+ delete($commands[0]);
+ } else {
+ $res = 1
+ }
+
+ if ($res > 0) {
+ foreach $cmd(@commands) {
+ if ($cmd !~ /^[\/\w\d_]/) {next;}
+ chomp($cmd);
+ $md5 = md5_hex($cmd);
+ open(fl, ">$dir/$server-$md5.srv");
+ open(cmd, "$cmd |");
+ while (<cmd>) { print fl; }
+ close(cmd);
+ close(fl);
+ }
+ }
+}
+
+sub process_item {
+ my $item = shift(@_);
+
+ $fn = $ENV{'HOME'} . "/.conky/requests/" . $item;
+ if (! -f $fn) { return; }
+
+ if ($item =~ /^(.*)\.srv$/) {
+ $server = $1;
+
+ process_server_request($server, $fn);
+
+ unlink($fn);
+ }
+}
+
+opendir dir, $ENV{'HOME'} . "/.conky/requests/";
+@dirlist = readdir dir;
+closedir dir;
+
+if ($#ARGV >= 0) {
+ $item = shift(@ARGV);
+ process_item($item);
+} else {
+ foreach $item(@dirlist) {
+ process_item($item);
+ }
+}
diff --git a/scripts/emerge-current.sh b/scripts/emerge-current.sh
new file mode 100755
index 0000000..53e7a19
--- /dev/null
+++ b/scripts/emerge-current.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+# emerge-current.sh by Hellf[i]re
+#
+# This script is designed to read the name of the last package compiled.
+#
+# As this script does read the entirety of emerge.log, it will be rather
+# heavy on the CPU. It shouldn't be enough to be noticable on newer (2.0Ghz+)
+# processors, but it still should not be run more often than every 30 seconds.
+#
+# Usage:
+# .conkyrc: ${execi [time] /path/to/script/emerge-current.sh}
+#
+# Usage Example
+# ${execi 30 /home/youruser/scripts/emerge-current.sh}
+
+if [ -n "$1" ]; then
+ num=$1
+else
+ num=1
+fi
+
+tac /var/log/emerge.log |\
+grep 'Compiling' |\
+head -n $num |\
+sed -e 's/.*(//' |\
+sed -e 's/::.*)//' |\
+sed -e '2,$ { s|^[^/]\+/|| }' |\
+sed -e '2,$ { s|-[0-9.]\+\(-r[0-9]\+\)\?$|| }' |\
+head -n $num | sed -e "2 { s/^/ / }" -e "2,$ { :a ; N ; s/\n/, /; ta }" |\
+cut -d \) -f 1
+
+
+
diff --git a/scripts/emerge-progress.sh b/scripts/emerge-progress.sh
new file mode 100755
index 0000000..1f28f73
--- /dev/null
+++ b/scripts/emerge-progress.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+# source: Jeremy_Z @ forums.gentoo.org http://forums.gentoo.org/viewtopic-t-351806-postdays-0-postorder-asc-start-550.html
+#
+# This script will report the progress of the last emerge command run. It
+# reports the TOTAL percentage complete - not the percentage of the current
+# package. For example, if there are 110 packages currently being emerged, and
+# it is on the 55th package, it will report 50.
+#
+# Usage:
+# .conkyrc: ${execibar [time] /path/to/script/emerge-progress.sh}
+#
+# Usage Example
+# ${execibar 30 /home/youruser/scripts/emerge-progress.sh}
+
+tail -n 50 /var/log/emerge.log |\
+tac |\
+grep -v "Starting retry" |\
+grep -iE '([0-9]* of [0-9]*)' -o -m 1 |\
+sed -e 's/\(.*\) of \(.*\)/\1 \2/' |\
+awk '{print 100.0*$1/$2}'
diff --git a/scripts/emerge-status.sh b/scripts/emerge-status.sh
new file mode 100755
index 0000000..a1241ef
--- /dev/null
+++ b/scripts/emerge-status.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+#
+# emerge-status.sh by Hellf[i]re
+#
+# This script will report the current status of portage.
+#
+# Usage:
+# .conkyrc: ${execi [time] /path/to/script/emerge-current.sh}
+#
+# Usage Example
+# ${execi 30 /home/youruser/scripts/emerge-current.sh}
+#
+# Known Bugs:
+# 1) If there are two emerges running at once, when the first one finishes
+# running, the script will report the current status as "Completed".
+# 2) If there is a emerge running and you run a search, the script will
+# report the current status as "Completed", until the running emerge
+# moves to the next package, or itself completes.
+# The reasons for this are twofold - one, it's a feature ;) and two, there
+# would be far too much parsing required to find out the current status of
+# every command which is run in parallel.
+
+STATUS=`tail -n 15 /var/log/emerge.log |\
+grep -iE "Compiling|Cleaning|AUTOCLEAN|completed|search|terminating|rsync" |\
+cut -d ' ' -f "2-" |\
+grep -Ev 'Finished\.|Cleaning up\.\.\.' |\
+tail -n 1`
+
+#echo "$STATUS"
+
+if [ "`echo "$STATUS" | grep -i compiling`" != "" ]; then echo Compiling
+elif [ "`echo "$STATUS" | grep -i cleaning`" != "" ]; then echo Cleaning
+elif [ "`echo "$STATUS" | grep -i autoclean`" != "" ]; then echo Autoclean
+elif [ "`echo "$STATUS" | grep -i sync`" != "" ]; then echo Syncing
+elif [ "`echo "$STATUS" | grep -i search`" != "" ]; then echo Searching
+elif [ "`echo "$STATUS" | grep -i completed`" != "" ]; then echo Completed
+elif [ "`echo "$STATUS" | grep -i terminating`" != "" ]; then echo Completed
+else echo Script Error!
+fi
diff --git a/scripts/lastsync.pl b/scripts/lastsync.pl
new file mode 100755
index 0000000..37bef03
--- /dev/null
+++ b/scripts/lastsync.pl
@@ -0,0 +1,7 @@
+#!/usr/bin/perl
+use Date::Manip;
+
+$date = `grep "Sync completed" /var/log/emerge.log | tail -n1 | cut -c-10`;
+$date = &DateCalc("Jan 1, 1970 00:00:00 GMT",$date);
+$date = UnixDate("$date","%A %H:%M");
+print "$date";
diff --git a/scripts/netstat-in.sh b/scripts/netstat-in.sh
new file mode 100755
index 0000000..993d97e
--- /dev/null
+++ b/scripts/netstat-in.sh
@@ -0,0 +1,9 @@
+#! /bin/bash
+
+query=""
+for port in `netstat -lntu | tail -n +3 | grep -v "127.0.0.1" | awk -e '{print $4}' | rev | cut -d ':' -f 1 | rev | sort -n | uniq`; do
+ [ $port -gt 32768 ] && continue;
+ [ -z "$query" ] && query="sport = :$port" || query="$query or sport = :$port"
+done
+
+eval /sbin/ss -nrtu state established "'( $query ) '" | tail -n +2 | grep -v localhost | awk -F'[:\t ]+' -e '$6 != $4 { print $6, $5 }'
diff --git a/scripts/ping.pl b/scripts/ping.pl
new file mode 100755
index 0000000..0f24483
--- /dev/null
+++ b/scripts/ping.pl
@@ -0,0 +1,19 @@
+#!/usr/bin/perl -w
+use Net::Ping;
+use Switch;
+
+if (@ARGV >1) { $host=$ARGV[0]; $timeout=$ARGV[1]; }
+elsif (@ARGV>0) { $host=$ARGV[0]; $timeout=2; }
+else { print "Usage is: $0 host <timeout=1>\n"; exit; }
+
+if ($host =~ /^(.*):(\d+)$/) {
+ $host = $1;
+ $port = $2;
+} else {
+ $port = 22;
+}
+
+$p=Net::Ping->new('tcp');
+$p->port_number($port);
+if ($p->ping($host, $timeout)) {print 1;} else {print 0;}
+$p->close();
diff --git a/scripts/run_conky.sh b/scripts/run_conky.sh
new file mode 100755
index 0000000..abdea35
--- /dev/null
+++ b/scripts/run_conky.sh
@@ -0,0 +1,24 @@
+#!/bin/bash
+
+if [ "$1" != "start" ]; then
+ killall -9 conky
+ killall -9 rainlendar2
+ killall -9 rainlendar2.bin
+fi
+
+if [ "$1" != "stop" ]; then
+ python /opt/scripts/unlock.py gui || exit
+
+ killall -9 gpg-agent
+ pass test
+
+ conky -q -d -c /etc/conky/sysinfo.conf
+ conky -q -d -c /etc/conky/netstat.conf
+ conky -q -d -c /etc/conky/gentoo.conf
+ conky -q -d -c /etc/conky/logs.conf
+ conky -q -d -c /etc/conky/todo.conf
+ # todo should be loaded before forecast
+ sleep 0.3
+ conky -q -d -c /etc/conky/forecast.conf
+ /opt/rainlendar2/rainlendar2 --quiet &
+fi
diff --git a/service/README b/service/README
new file mode 100644
index 0000000..51d5122
--- /dev/null
+++ b/service/README
@@ -0,0 +1,11 @@
+* Message (important or local service messages)
+Status messages to be printed bellow all services
+
+Online Healthy [Short Message]
+
+
+Statuses
+========
+ 0 - Bad
+ 1 - Good
+ * - Intermediate
diff --git a/service/check_adei.sh b/service/check_adei.sh
new file mode 100755
index 0000000..f08ab5f
--- /dev/null
+++ b/service/check_adei.sh
@@ -0,0 +1,115 @@
+#! /bin/bash
+
+MAX_SOURCE_OFFSET=3600
+MAX_MASTER_OFFSET=300
+MAX_SLAVE_OFFSET=300
+
+function query {
+ if [ "$2" == "ecode" ]; then
+ url="$1&mysql=master"
+ resp=$(curl -f "$url" 2>&1 | grep "returned error")
+ else
+ if [ "$2" == "slave" ]; then
+ url="$1&mysql=slave"
+ else
+ url="$1&mysql=master"
+ fi
+
+ resp=$(curl -sf "$url")
+ err=$?
+ [ $err -eq 0 ] || resp=""
+ fi
+ echo $resp
+}
+
+function format_time {
+ offset=$1
+ if [ $offset -ge 86400 ]; then
+ echo "$((offset / 86400))d"
+ elif [ $offset -ge 3600 ]; then
+ echo "$((offset / 3600))h"
+ elif [ $offset -ge 60 ]; then
+ echo "$((offset / 60))m"
+ else
+ echo "${offset}s"
+ fi
+}
+
+
+cd "$(dirname "$0")"
+id=$1
+
+auth=$(cat ../security/adei.txt | grep -P "^$id" | awk '{ print $2 }')
+[ -n $auth ] && auth="$auth@"
+
+host=$(echo $2 | cut -d '/' -f 1)
+url="http://$auth$2/services"
+
+src=$3
+
+# Check if online
+online=$(../scripts/ping.pl "$host")
+healthy=$online
+
+# Check if healthy and find version
+version=$(query "$url/info.php?target=version&encoding=text")
+if [ -z "$version" ]; then
+ err=$(query "$url/info.php?target=version&encoding=text" "ecode")
+ echo $err
+ healthy=0
+else
+ if [[ "$version" =~ "Error:" ]]; then
+ echo $version
+ healthy=0
+ version=""
+ else
+ version="ADEI $version"
+ fi
+fi
+
+# Get current database size
+size=$(query "$url/info.php?target=size&encoding=text")
+[[ "$size" =~ "Error:" ]] && size=""
+[ -n "$size" ] && msg="\${color gray}/ $((size / 1024 / 1024 / 1024)) GB"
+
+
+# Verify offset (for selected database)
+if [ $healthy -ne 0 -a -n "$src" ]; then
+ now=$(date +%s)
+ sdate=$(query "$url/getdata.php?$src&db_mask=0&format=csv&window=-1&rt=1&cache=1&time_format=U" slave | cut -d ',' -f 1 | cut -d '.' -f 1)
+ mdate=$(query "$url/getdata.php?$src&db_mask=0&format=csv&window=-1&rt=1&cache=1&time_format=U" | cut -d ',' -f 1 | cut -d '.' -f 1)
+
+ if [ -z "$sdate" -o -z "$mdate" ]; then
+ echo "Error querying data from '$src'"
+ healthy=2
+ else
+ master_offset=$(($now - $mdate))
+ slave_offset=$(($mdate - $sdate))
+
+ if [ $master_offset -gt $MAX_SOURCE_OFFSET ]; then
+ rdate=$(query "$url/getdata.php?$src&db_mask=0&format=csv&window=-1&rt=1&time_format=U" | cut -d ',' -f 1 | cut -d '.' -f 1)
+ cache_offset=$(($rdate - $mdate))
+ if [ $cache_offset -gt $MAX_MASTER_OFFSET ]; then
+ echo "ADEI cache is off by $(format_time $cache_offset) for '$src'"
+ healthy=2
+ else
+ offset=$(($now - $rdate))
+# echo "Source '$src' is not updated for $(format_time $offset)"
+ fi
+ fi
+
+ if [ $slave_offset -gt $MAX_SLAVE_OFFSET ]; then
+ echo "MySQL slave is off by $(format_time $slave_offset) for '$src'"
+ healthy=2
+ fi
+
+ [ -n "$msg" ] && msg="${msg}, "
+ [ -z "$msg" ] && msg="\${color gray}/ "
+ msg="${msg}cache $(format_time $master_offset)"
+ [ $slave_offset -gt 0 ] && msg="$msg & slave $(format_time $slave_offset)"
+ msg="$msg off"
+ fi
+
+fi
+
+echo "$online $healthy $version $msg"
diff --git a/service/check_gluster.sh b/service/check_gluster.sh
new file mode 100755
index 0000000..e591e7e
--- /dev/null
+++ b/service/check_gluster.sh
@@ -0,0 +1,83 @@
+#! /bin/bash
+
+cd "$(dirname "$0")"
+. opts.sh
+
+if [ -f "../security/$host.kubeconfig" ]; then
+ gpod=$(get_gluster_pod)
+
+ function gluster {
+ oc -n glusterfs rsh po/$gpod gluster "$@"
+ }
+
+# check if gluster pods are running
+ if [ -n "$gpod" ]; then
+ online=1
+ else
+ oc -n glusterfs get pods -l 'glusterfs=storage-pod' | sed 's/^/* /'
+ online=0
+ fi
+else
+ echo "0 0 Not supported"
+ exit
+fi
+
+function check {
+ vol=$1
+ vol_bricks=$(gluster volume info "$vol" | grep -P 'Number of Bricks' | awk '{ print $NF }' | tr -d '\r\n')
+ vol_online=$(gluster volume status "$vol" detail | grep Online | grep Y | wc -l)
+
+ if [ -z "$vol_bricks" -o -z "$vol_online" -o "$vol_bricks" -ne "$vol_online" ]; then
+ vol_status=$(gluster volume info "$vol" | grep -P 'Status' | awk '{ print $2 }' | tr -d '\r\n')
+ vol_avail=$(gluster volume status "$vol" detail | grep Brick | wc -l)
+ echo "* Volume $vol: $vol_status (Bricks: $vol_bricks, Available: $vol_avail, Online: $vol_online)"
+
+ if [ "$vol_status" == "Started" -a "$vol_online" -ge 0 ]; then
+ return 2
+ else
+ return 0
+ fi
+ else
+ return 1
+ fi
+}
+
+version=$(gluster --version | head -n 1 | awk '{ print $2 }' | tr -d '\r')
+if [ -z "$version" ]; then
+ online=0
+else
+ version="GlusterFS $version"
+fi
+
+volumes=0
+partial=0
+failed=0
+healthy=$online
+
+if [ $online -eq 1 ]; then
+ vols=$(gluster volume info | grep -P '^Volume Name' | awk '{ print $NF }' | tr '\r\n' ' ')
+ for vol in $vols; do
+ [[ "$vol" =~ [0-9] ]] && continue
+ [[ "$vol" =~ ^vol_ ]] && continue
+ [[ "$vol" =~ ^heketi ]] && continue
+ check ${vol}
+ ret=$?
+
+ volumes=$((volumes + 1))
+ if [ $ret -eq 0 ]; then
+ healthy=0
+ failed=$((failed + 1))
+ elif [ $ret -ne 1 ]; then
+ [ $healthy -gt 0 ] && healthy=$ret
+ partial=$((partial + 1))
+ fi
+ done
+fi
+
+if [ $healthy -eq 1 ]; then
+ msg="\${color gray}/ $volumes volumes"
+else
+ msg="\${color gray}/ $volumes volumes, $failed failed, $partial bricks missing"
+fi
+
+echo "$online $healthy $version $msg"
diff --git a/service/check_kaas.sh b/service/check_kaas.sh
new file mode 100755
index 0000000..d6e7300
--- /dev/null
+++ b/service/check_kaas.sh
@@ -0,0 +1,37 @@
+#! /bin/bash
+
+cd "$(dirname "$0")"
+. opts.sh
+
+e_nodes=$2
+
+
+online=$(../scripts/ping.pl "$host")
+healthy=$online
+
+version=$(oc version | head -n 1 | awk '{ print $2 }')
+if [ -z "$version" ]; then
+ healthy=0
+else
+ version="OpenShift $version"
+fi
+
+etcd=$(oc get cs | grep etcd | grep "Healthy" | wc -l)
+if [ -z "$etcd" -o "$etcd" -lt 3 ]; then
+ healthy=2
+ oc get cs | grep etcd | grep "Healthy" | sed -r -e 's/\s+/ /g' | awk '{ print $1, $2 }' | sed 's/^/* /'
+fi
+
+if [ $healthy -ne 0 ]; then
+ nodes=$(oc get nodes | grep Ready | wc -l)
+ if [ $nodes -ge $e_nodes ]; then
+ nodes=" / \${color gray}$etcd etcd, $nodes nodes"
+ else
+ offline=$(oc get nodes | grep -v "STATUS" | grep -v "Ready" | wc -l)
+ nodes=" / \${color gray}$etcd etcd, $nodes ready, $offline offline"
+ healthy=2
+ oc get nodes | grep -v "STATUS" | grep -v "Ready" | awk '{ print $1, $2 }' | sed 's/^/* /'
+ fi
+fi
+
+echo "$online $healthy $version $nodes"
diff --git a/service/opts.sh b/service/opts.sh
new file mode 100644
index 0000000..3628708
--- /dev/null
+++ b/service/opts.sh
@@ -0,0 +1,22 @@
+host=$1
+
+function oc {
+ cfg="../security/$host.kubeconfig"
+ /usr/bin/oc --config "$cfg" "$@"
+}
+
+function node {
+ ip=$1
+ shift
+
+ ssh -xq root@192.168.26.$ip "$@"
+}
+
+function get_gluster_pod {
+ oc -n glusterfs get pods -l 'glusterfs=storage-pod' | grep Running | awk '{ print $1 }' | head -n 1
+}
+
+function heketi {
+ node 1 heketi-cli -s http://heketi-storage.glusterfs.svc.cluster.local:8080 --user admin --secret "$(oc get secret heketi-storage-admin-secret -n glusterfs -o jsonpath='{.data.key}' | base64 -d)" "$@"
+}
+
diff --git a/support.lua b/support.lua
new file mode 100644
index 0000000..984d677
--- /dev/null
+++ b/support.lua
@@ -0,0 +1,669 @@
+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/sysinfo.conf b/sysinfo.conf
new file mode 100644
index 0000000..d34a79b
--- /dev/null
+++ b/sysinfo.conf
@@ -0,0 +1,109 @@
+update_interval 5
+alignment top_left
+
+own_window yes
+own_window_transparent no
+own_window_type override
+own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
+own_window_colour 21449c
+
+double_buffer yes
+background no
+minimum_size 450 0
+maximum_width 450
+
+#cpu_avg_samples 1
+#net_avg_samples 1
+
+use_xft yes
+xftfont DejaVu Sans Mono:size=9
+xftalpha 0.8
+override_utf8_locale yes
+
+gap_x 100
+gap_y 0
+
+show_graph_scale yes
+#draw_borders yes
+#border_margin 1
+#border_width 3
+#default_color gray
+
+lua_load /etc/conky/support.lua
+
+# 2 - standard width in characters
+# 3 - network timeout
+# 5 - interactive apps (xmms)
+# 6 - local apps
+# 7 - networking
+# 8 - ping + remote scripts
+template2 45
+template3 2
+template5 120
+template6 300
+template7 600
+template8 600
+
+#template0 ${if_match ${execi ${template8} /etc/conky/scripts/ping.pl \1} > 0}${color green}${else}${color red}${endif}*${color}
+template0 ${lua_parse check_server_status \1 22 -}
+
+#Servers checked once a minute
+#Scale for I/O ~ 50 MB (looks like in kilobits)
+#Scale for Net ~ 1 MB/s (looks like in kilobytes)
+
+TEXT
+${font DejaVu Sans Mono:size=11}${color orange}$nodename ${time %H:%M:%S}${color white}${font}, $uptime_short up
+$sysname $kernel, $machine $freq_g GHz
+$hr
+${color yellow}CPU Load${color white}: ${cpu cpu0}% ${color gray}(6 cores, average)
+#${color white}${cpugraph cpu0 32,220 00ff00 00ff00} ${cpugraph cpu1 32,220 00ff00 00ff00}
+${color white}${cpugraph cpu1 32,143 00ff00 00ff00} ${cpugraph cpu2 32,143 00ff00 00ff00} ${cpugraph cpu3 32,143 00ff00 00ff00}
+${color white}${cpugraph cpu4 32,143 00ff00 00ff00} ${cpugraph cpu5 32,143 00ff00 00ff00} ${cpugraph cpu6 32,143 00ff00 00ff00}
+${color yellow}RAM Usage :$color $memperc% ($mem of $memmax)
+${color green}${membar}
+${color yellow}Swap Usage:$color $swapperc% ($swap of $swapmax)
+${color green}${swapbar}
+${color yellow}I/O Read${color white} : ${diskio_read}${goto 235}${color yellow}I/O Write${color white} : ${diskio_write}
+${color white}${diskiograph_read 32,220 00ff00 00ff00 409600} ${diskiograph_write 32,220 00ff00 00ff00 409600}
+${color gray}${goto 0}${diskio sda}${goto 120}${diskio sdb}${goto 235}${diskio sdc}${goto 355}${diskio sdd}
+
+${color grey}root $color${fs_free /} of ${fs_size /} ${goto 250}${fs_bar 6 /}
+${color grey}raid $color${fs_free /mnt/raid} of ${fs_size /mnt/raid} ${goto 250}${fs_bar 6 /mnt/raid}
+${color grey}rest $color${fs_free /mnt/image} of ${fs_size /mnt/image} ${goto 250}${fs_bar 6 /mnt/image}
+${color grey}fast $color${fs_free /mnt/fast} of ${fs_size /mnt/fast} ${goto 250}${fs_bar 6 /mnt/fast}
+${color white}$hr${lua set_width $template2}${lua set_timeout $template3}
+${color yellow}Host${color white} : ${lua filter_real_ip br0}
+${color yellow}Connections${color white}: ${color gray}in ${color white}${tcp_portmon 1 32767 count}${color white}, ${color gray}out ${color white}${tcp_portmon 32768 65535 count}${color}
+${color yellow}Received${color white} : ${downspeed eth0}${color yellow}${goto 235}Sent${color white}: ${upspeed eth0}
+${color white}${downspeedgraph eth0 32,220 00ff00 00ff00 1024} ${upspeedgraph eth0 32,220 00ff00 00ff00 1024}
+${color white}DarkSide ${lua_parse check_server_status darksoft.org} ${template0 192.168.21.1} ${color grey}$color ${downspeed tun0} ${color grey} ${goto 300}$color ${upspeed tun0}
+#${color white}Serv2 ${lua_parse check_server_status serv2.suren.me} ${template0 192.168.22.1} ${color grey}$color ${downspeed tun2} ${color grey} ${goto 300}$color ${upspeed tun2}
+${color white}Serv4 ${lua_parse check_server_status serv4.suren.me} ${template0 192.168.24.1} ${color grey}$color ${downspeed tun3} ${color grey} ${goto 300}$color ${upspeed tun3}
+${color white}FZK/Suren ${lua_parse check_server_status suren.fzk.de 24} ${template0 192.168.15.1} ${color grey}$color ${downspeed tun1} ${color grey} ${goto 300}$color ${upspeed tun1}
+${color white}FZK/Serv ${lua_parse check_server_status 192.168.26.120}
+#${color white}Yerevan ${template0 217.113.10.181} ${color grey}* ${color grey}$color ${downspeed ppp0} ${color grey} ${goto 300}$color ${upspeed ppp0}
+#${color white}Yerevan ${template0 217.113.10.181} ${template0 192.168.24.106} ${color grey}$color ${downspeed ppp0} ${color grey} ${goto 300}$color ${upspeed ppp0}
+${color white}Virtual ${color grey}$color ${downspeed vlan0} ${color grey} ${goto 300}$color ${upspeed vlan0}
+${color yellow}Routing ${lua_parse check_server_status google.de 80 -}
+${color white}DarkSide ${lua_parse check_server_ traffic darksoft.org 22 5 10}
+#${color white}Serv2 ${lua_parse check_server_ traffic serv2.suren.me 22 5 10}
+${color white}Serv4 ${lua_parse check_server_ traffic serv4.suren.me 22 5 10}
+${color white}FZK/Suren ${lua_parse check_server_ traffic suren.fzk.de 24}${color white}${lua_parse print_server_errors $template8 conky_sysinfo}
+${hr}
+${color yellow}Processes :$color $processes ${color grey}Running:$color $running_processes
+${font DejaVu Sans Mono:size=8}${color yellow}CPU usage PID CPU% MEM% IO%
+${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1} ${top io_perc 1}
+${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2} ${top io_perc 2}
+${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3} ${top io_perc 3}
+${color yellow}Mem usage PID CPU% RSS VMEM
+${color lightgrey} ${top_mem name 1} ${top_mem pid 1} ${top_mem cpu 1}${goto 300}${top_mem mem_res 1}${goto 375}${top_mem mem_vsize 1}
+${color lightgrey} ${top_mem name 2} ${top_mem pid 2} ${top_mem cpu 2}${goto 300}${top_mem mem_res 2}${goto 375}${top_mem mem_vsize 2}
+${color lightgrey} ${top_mem name 3} ${top_mem pid 3} ${top_mem cpu 3}${goto 300}${top_mem mem_res 3}${goto 375}${top_mem mem_vsize 3}
+${color yellow}I/O usage PID CPU% Read Write
+${color lightgrey} ${top_io name 1} ${top_io pid 1} ${top_io cpu 1}${goto 300}${top_io io_read 1}${goto 375}${top_io io_write 1}
+${color lightgrey} ${top_io name 2} ${top_io pid 2} ${top_io cpu 2}${goto 300}${top_io io_read 2}${goto 375}${top_io io_write 2}
+${color lightgrey} ${top_io name 3} ${top_io pid 3} ${top_io cpu 3}${goto 300}${top_io io_read 3}${goto 375}${top_io io_write 3}
+#${font}$hr
+#${execi $template6 fortune -s | fold -s -w$template2}
+
+#${color yellow}Xmms : ${color white}${execi $template5 xmmsctrl title | iconv -f KOI8-R -t UTF-8 }
diff --git a/todo.conf b/todo.conf
new file mode 100644
index 0000000..463391b
--- /dev/null
+++ b/todo.conf
@@ -0,0 +1,61 @@
+update_interval 120
+
+alignment top_right
+own_window yes
+own_window_transparent no
+own_window_type override
+own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
+own_window_colour 21449c
+
+minimum_size 720 0
+maximum_width 720
+
+double_buffer yes
+background no
+
+text_buffer_size 1024
+
+use_xft yes
+xftfont DejaVu Sans Mono:size=9
+xftalpha 0.8
+override_utf8_locale yes
+#font -xos4-terminus-medium-r-normal--12-120-72-72-c-60-koi8-r
+
+gap_x -3280
+gap_y 0
+
+#gap_y 500
+#gap_x 2540
+
+template2 70
+
+# 5 - interactive apps (xmms)
+# 6 - local apps
+# 7 - networking
+# 8 - ping + remote scripts
+template5 15
+template6 300
+template7 600
+template8 900
+
+TEXT
+${color yellow}ToDo ${hr}
+${color}${execpi $template5 t -p listpri "A-D" -@ "- x " | head -n -2 | cut -d ' ' -f 2- | fmt -t -w 80}
+
+${color yellow}Work ${hr}
+${color}${execpi $template5 t -@ -p listpri "A-D" @work "- x " | head -n -2 | cut -d ' ' -f 2- | fmt -t -w 80}
+
+${color yellow}Buy ${hr}
+${color}${execpi $template5 t -@ -p listpri "A-D" @buy "- x " | head -n -2 | cut -d ' ' -f 2- | fmt -t -w 80}
+
+${color yellow}Travel ${hr}
+${color}${execpi $template5 t -@ -p listpri "A-D" @travel "- x " | head -n -2 | cut -d ' ' -f 2- | fmt -t -w 80}
+
+
+##${color}${execpi $template6 grep '(!)' todo.txt | fmt -t -w 80 | iconv -f KOI8-R -t UTF-8}
+#V.2 API is long unsupported and there is no updates to callendar
+#${color yellow}Google Calendars ${hr}
+#${color}${execi $template7 conkyGoogleCalendar --username=csa7fff@googlemail.com --daysahead=28 --limit=10 --template=/etc/conky/gcalc.template}
+
+
+${execi $template6 fortune -s | fold -s -w$template2 | iconv -f KOI8-R -t UTF-8 }