$def with (machine, root_ssh, admin_ssh) $var breadcrumbs = ("machines", "Machines") $var title: $machine["name"]

$machine["ip_address"]

$ d = machine["details"] $#

$d

$code: def get_output(cmd): output = root_ssh(cmd).stdout if "\n" not in output: output += "\n" return output.rpartition("\n")[0] def get_admin_output(cmd): output = admin_ssh(cmd).stdout if "\n" not in output: output += "\n" return output.rpartition("\n")[0] $def render(cmd):
$get_output(cmd)
$def admin_render(cmd):
$get_admin_output(cmd)

Application

$:render("/home/admin/runinenv /home/admin/app python -V") $:render("du -sh /home/admin/app")
\
$for line in get_output("ls -lh /home/admin/app/run").splitlines():
    $ parts = line.split()[-5:]
    $if len(parts) < 5:
        $continue
    $ size, month, day, yeartime, path = parts
    $month $day $yeartime \
    $if size:
        \
    $path\
    $if size:
        \
     $size

Supervisor

$:render("supervisorctl status") $def render_status(cmd): $ status = {} $for line in root_ssh(cmd).stdout.rpartition("\n")[0].splitlines(): $ key, _, value = line.partition("=") $ status[key] = value
$status["ActiveState"]

Nginx

$:render_status("systemctl --no-pager show nginx")

Tmux

$:admin_render("tmux list-sessions") $:admin_render("tmux list-windows -t 0")

System

$:render("df -ht ext4") $:render("grep 'Invalid user' /var/log/auth.log | cut -d' ' -f8 | sort | uniq -c | sort -r | head") $#

Last updated: $d.get("updated")

$#
$#
$#
$# $# $if d.get("supervisor"): $#

Supervisor: $d["supervisor"]

$# $else: $#
$# $#
$#
$# $# $if d.get("nginx"): $#

Nginx: $d["nginx"]

$# $else: $#
$# $#
$#
$# $# $if d.get("tor"): $#

Tor: $d["tor"]

$# $else: $#
$# $#
$#
$# $# $if d.get("python"): $#

Python: $d["python"]

$# $else: $#
$# $#
$#
$# $#
$# $# $if d.get("canopy"): $#

Canopy: $d["canopy"]

$#

Identities

$# $# $#
$# $# $#
$#
$# $else: $#
$# $#
$#