Skip to content

Commit

Permalink
first alpha release
Browse files Browse the repository at this point in the history
gabriel-aires committed Nov 22, 2021
1 parent e63b0ba commit 94f2a5b
Showing 4 changed files with 41 additions and 9 deletions.
4 changes: 4 additions & 0 deletions assets/pico.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion os-probe.sublime-project
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@
},
{
"name": "Spider-Gazelle (test)",
"shell_cmd": "curl 127.0.0.1:3000",
"shell_cmd": "curl 127.0.0.1:3000/dashboard",
"working_dir": "$project_path",
"quiet": false
}
9 changes: 6 additions & 3 deletions src/controllers/dashboard.cr
Original file line number Diff line number Diff line change
@@ -2,7 +2,11 @@ require "kilt/slang"

class Dashboard < Application
def index
welcome_text = "You're being trampled by Spider-Gazelle!"
hostname = `hostname 2> /dev/null`
disk_info = `df -h 2> /dev/null`
process_info = `top -b -n 1 2> /dev/null`
service_info = `systemctl status --all --no-page 2> /dev/null`

Log.warn { "logs can be collated using the request ID" }

# You can use signals to change log levels at runtime
@@ -12,8 +16,7 @@ class Dashboard < Application

respond_with do
html template("welcome.slang")
text "Welcome, #{welcome_text}"
json({welcome: welcome_text})
json({hostname: hostname, disk_info: disk_info, process_info: process_info, service_info: service_info})
end
end
end
35 changes: 30 additions & 5 deletions src/views/welcome.slang
Original file line number Diff line number Diff line change
@@ -1,11 +1,36 @@
doctype html
html lang="en"

head
title Welcome
link rel="shortcut icon" href="/favicon.ico"
body style="text-align: center"
img src="/sg.png" alt="OS-Probe"
br
h1 style="color: red"
= welcome_text
link rel="stylesheet" href="/pico.min.css"

body.dark
main.container

header
h1 System information for #{hostname}:

h3 Disk Info
figure
pre
= disk_info

h3 Process Info
figure
pre
= process_info

h3 Service Info
figure
pre
= service_info

footer
h6
| Built with S2 and
a href="https://spider-gazelle.net" Spider-Gazelle
h6
| Check the
a href="https://github.com/gabriel-aires/os-probe" Github Repo

0 comments on commit 94f2a5b

Please sign in to comment.