Skip to content

Commit

Permalink
kalua: monitoring: screenshot() initial writeup
Browse files Browse the repository at this point in the history
  • Loading branch information
Bastian Bittorf committed Jul 22, 2016
1 parent cf806ee commit 903368a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 10 deletions.
6 changes: 2 additions & 4 deletions TODO.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
stopwatch_stop() timefile '/tmp/STOPWATCH_tmpCRON_LASTCALL'... not found - abort

# switch: 'TP-LINK TL-WR841N/ND v9'

# track_ap: store all hostnames from monitoring

# tarball ohne /etc/init.d fuer server?


# reverse_ssh fuer debian -> fernwartung

# roaming: bad arping? -> IWLOG
# roaming: DHCP: jede new MUSS gemeldet werden
# roaming: checker: calc mac-sum without first hex and if differ only 1, its the same AP/bandroam
Expand Down Expand Up @@ -106,8 +106,6 @@ Wed Jul 6 17:48:46 2016 authpriv.notice dropbear[27654]: Password auth succeede

# how to preserve: already set (correct) gps?

# patch: uclient-fetch --quiet Vs. -q

# monitoring: telegram: stoerung -> OK -> war von...bis

# audioplayer: test buffer
Expand Down
20 changes: 20 additions & 0 deletions openwrt-addons/etc/kalua/monitoring
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,25 @@ _monitoring_url()
url="$url/?local=${date}&node=0&city=168&mac=${mac}&latlon=&hostname=${hostname}&update=0&wifidrv=&olsrver=&olsrrestartcount=0&olsrrestarttime=&portfw=&optimizenlq=&optimizeneigh=off&txpwr=0&wifimode=ap&channel=${channel}&mrate=auto&hw=${hardware}&frag=&rts=&pfilter=&gmodeprot=0&gmode=11ng&profile=${network}_ap&noise=-1&rssi=&distance=&version=${version}&reboot=1&up=${uptime}&load=${load}&forwarded=0&essid=${ssid}&bssid=&gw=1&gwnode=1&etx2gw=1&hop2gw=0&neigh=&users=&pubip=${mypubip}&sens=&wifiscan=&v1=${uname}&v2=&s1=${switch}&h1=${ram}&h2=&h4=2&h5=33&h6=4096&h7=337&d0=&d1=&n0=&i0=static&i1=wan&i2=${myip}%2f29&i3=0&i4=0&i5=${mygw}&r0=&w0=wlan0&w1=0"
}

_monitoring_screenshot()
{
local file="$TMPDIR/screenshot.jpg"
local hash_old hash_new mac key dest

command -v 'scrot' >/dev/null && {
read -r hash_old <"$file"

export DISPLAY=:0
scrot --quality 10 "$file"

hash_new="$( _file hash "$file" )"
[ "$hash_old" = "$hash_new" ] || {
read -r mac <'/www/monitoring.wifimac' && {
# root@intercity-vpn.de:/var/www/networks/liszt28/vds/
dest="$( uci get system.@vds[0].server )../settings/$mac.screenshot.jpg"
key="$( _ssh key_public_fingerprint_get keyfilename )"
scp -i "$key" "$file" "$dest"
}
}
}
}
11 changes: 5 additions & 6 deletions openwrt-addons/etc/kalua_init
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,12 @@
# Maybe your own."

while read -r LINE; do { # e.g. none /run/user tmpfs rw,nosuid,nodev,noexec...
case "$LINE" in # attribute 'noexec' does not matter...
*'size='[0-9]'k'*) # and avoid very small discs
;;
# *'nosuid'*|*'noexec'*|*'nodev'*|*' /home/'*)
*'noexec'*|*' /home/'*)
case "$LINE" in
*'nosuid'*|*'noexec'*|*' /home/'*|*'size='[0-9]'k'*)
# avoid those (and very small disks)
# we only 'source' shellscripts and work with tempfiles
;;
*' tmpfs rw,'*) # ...we only 'source' shellscripts (TODO: nosuid/noexec/nodev?)
*' tmpfs rw,'*)
set -- $LINE
mkdir -p "$2/kalua" 2>/dev/null && {
TMPDIR="$2/kalua"
Expand Down

0 comments on commit 903368a

Please sign in to comment.