Compare commits
25 Commits
Author | SHA1 | Date |
---|---|---|
Kekskurse | 94d1f90722 | |
Kekskurse | 383ce965a0 | |
Kekskurse | 3fde27f83b | |
Kekskurse | 28b5ccca8e | |
Kekskurse | 280a9559f6 | |
Kekskurse | a80fcb5d4c | |
Kekskurse | 40d601f5b4 | |
Kekskurse | 2ebe72790f | |
Kekskurse | 1d09eef545 | |
Kekskurse | 387ba50c26 | |
Kekskurse | 8a06fe56cf | |
Kekskurse | ab83e1ff5e | |
Kekskurse | 1d54f47988 | |
Kekskurse | eaaee5c3ef | |
Kekskurse | b65aff651c | |
Kekskurse | a49ed9a9a7 | |
Kekskurse | 4a54b35510 | |
Kekskurse | ee5075f47f | |
Kekskurse | 711a0714a4 | |
Kekskurse | 5b815e1932 | |
Kekskurse | 326b2e459e | |
Kekskurse | 4b41ef1c55 | |
Kekskurse | 6ff70bd77b | |
Kekskurse | b93ac4639d | |
Kekskurse | 07cd22131f |
|
@ -0,0 +1,36 @@
|
|||
run-name: ${{ github.actor }} is testing
|
||||
on: ["push"]
|
||||
jobs:
|
||||
Release:
|
||||
runs-on: docker
|
||||
#container:
|
||||
# image: goreleaser/goreleaser
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
#- run: goreleaser release --skip-publish --snapshot --rm-dist --debug
|
||||
- name: Setup Go environment
|
||||
uses: https://github.com/actions/setup-go@v2.1.3
|
||||
with:
|
||||
go-version: 1.20
|
||||
- name: Run GoReleaser
|
||||
uses: https://github.com/goreleaser/goreleaser-action@v4
|
||||
with:
|
||||
# either 'goreleaser' (default) or 'goreleaser-pro'
|
||||
distribution: goreleaser
|
||||
version: latest
|
||||
args: release --skip-publish --snapshot --rm-dist --debug --clean
|
||||
env:
|
||||
GORELEASER_FORCE_TOKEN: "gitea"
|
||||
- name: Copy deb to publish folder
|
||||
run: mkdir publish; cp dist/*deb publish/last.deb
|
||||
- name: Upload to s3
|
||||
uses: https://github.com/shallwefootball/s3-upload-action@master
|
||||
with:
|
||||
aws_key_id: ${{ secrets.AWS_KEY_ID }}
|
||||
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
|
||||
aws_bucket: 'kekscloud-releases'
|
||||
source_dir: 'publish/'
|
||||
destination_dir: 'http-server-status/'
|
||||
endpoint: 's3.eu-central-003.backblazeb2.com'
|
|
@ -0,0 +1,40 @@
|
|||
run-name: ${{ github.actor }} is testing
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
jobs:
|
||||
Release:
|
||||
runs-on: docker
|
||||
#container:
|
||||
# image: goreleaser/goreleaser
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
#- run: goreleaser release --skip-publish --snapshot --rm-dist --debug
|
||||
- name: Setup Go environment
|
||||
uses: https://github.com/actions/setup-go@v2.1.3
|
||||
with:
|
||||
go-version: 1.20
|
||||
- name: Run GoReleaser
|
||||
uses: https://github.com/goreleaser/goreleaser-action@v4
|
||||
with:
|
||||
# either 'goreleaser' (default) or 'goreleaser-pro'
|
||||
distribution: goreleaser
|
||||
version: latest
|
||||
args: release --clean
|
||||
env:
|
||||
GORELEASER_FORCE_TOKEN: "gitea"
|
||||
GITEA_TOKEN: "${{ secrets.GITEA }}"
|
||||
- name: Copy deb to publish folder
|
||||
run: mkdir publish; cp dist/*deb publish/stable.deb; cp dist/*deb publish/
|
||||
- name: Upload to s3
|
||||
uses: https://github.com/shallwefootball/s3-upload-action@master
|
||||
with:
|
||||
aws_key_id: ${{ secrets.AWS_KEY_ID }}
|
||||
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}}
|
||||
aws_bucket: 'kekscloud-releases'
|
||||
source_dir: 'publish/'
|
||||
destination_dir: 'http-server-status/'
|
||||
endpoint: 's3.eu-central-003.backblazeb2.com'
|
|
@ -17,11 +17,6 @@ builds:
|
|||
- amd64
|
||||
ldflags:
|
||||
- -X main.version={{ .Version }}
|
||||
archives:
|
||||
- replacements:
|
||||
darwin: Darwin
|
||||
386: i386
|
||||
amd64: x86_64
|
||||
checksum:
|
||||
name_template: 'checksums.txt'
|
||||
changelog:
|
||||
|
|
13
Readme.md
13
Readme.md
|
@ -4,13 +4,14 @@ Status Page with your Server informations (HDD usage, ram usage, load, systemd)
|
|||
|
||||
# Installation
|
||||
|
||||
## Fast
|
||||
```
|
||||
curl https://git.keks.cloud/kekskurse/http-server-status/raw/branch/main/install.sh | sh
|
||||
```
|
||||
## Dowanload URLs:
|
||||
|
||||
## Manual
|
||||
To Install the Server Montiroing download the last .deb File from the Release page and save it as http-server-status.deb on your server. Than install the package with dpkg
|
||||
* Last Dev Build: `https://kekscloud-releases.s3.eu-central-003.backblazeb2.com/http-server-status/last.deb`
|
||||
* Last Release Build: `https://kekscloud-releases.s3.eu-central-003.backblazeb2.com/http-server-status/stable.deb`
|
||||
* Special Version: `https://kekscloud-releases.s3.eu-central-003.backblazeb2.com/http-server-status/http-server-status_1.0.7_linux_amd64.deb` (Bigger than 1.0.7)
|
||||
|
||||
|
||||
To Install the Server Montiroing download the last .deb File from the Release page or the links above and save it as http-server-status.deb on your server. Than install the package with dpkg
|
||||
|
||||
```
|
||||
dpkg -i http-server-status.deb
|
||||
|
|
|
@ -24,6 +24,7 @@ type Config struct {
|
|||
Load checks.LoadConfig `yaml:"load"`
|
||||
Memory checks.MemoryConfig `yaml:"memory"`
|
||||
Systemd checks.SystemdConf `yaml:"systemd"`
|
||||
Version checks.VersionConfig `yaml:"version"`
|
||||
} `yaml:"checks"`
|
||||
}
|
||||
|
||||
|
@ -43,4 +44,6 @@ func readConfig() {
|
|||
if err != nil {
|
||||
log.Fatal().Err(err).Msg("Cant parse yaml file")
|
||||
}
|
||||
|
||||
c.Checks.Version.Version = version
|
||||
}
|
|
@ -17,11 +17,11 @@ checks:
|
|||
max_load_15: 5
|
||||
memory:
|
||||
enabled: true
|
||||
max: 100
|
||||
max: 80
|
||||
max_swap: 80
|
||||
systemd:
|
||||
enabled: true
|
||||
services:
|
||||
- sshd
|
||||
- test
|
||||
- docker
|
||||
version:
|
||||
enabled: true
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
[Unit]
|
||||
Description=Go Mail Admin
|
||||
Description=HTTP Status Server
|
||||
After=syslog.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=http-server-status
|
||||
ExecStart=/usr/local/bin/http-server-status
|
||||
ExecStart=/usr/bin/http-server-status
|
||||
SyslogIdentifier=http-server-status
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
package checks
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type VersionConfig struct {
|
||||
Enabled bool `yaml:"enabled"`
|
||||
Version string
|
||||
}
|
||||
|
||||
type Version struct {
|
||||
Config VersionConfig
|
||||
}
|
||||
|
||||
func (h Version) Execute() (ok bool, data interface{}, err error) {
|
||||
if h.Config.Enabled == false {
|
||||
return true, nil, nil
|
||||
}
|
||||
resp, err := http.Get("https://git.keks.cloud/api/v1/repos/kekskurse/http-server-status/releases?limit=1")
|
||||
defer resp.Body.Close()
|
||||
|
||||
var g []struct {
|
||||
TagName string `json:"tag_name"`
|
||||
}
|
||||
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return false, nil, err
|
||||
}
|
||||
|
||||
json.Unmarshal(body, &g)
|
||||
|
||||
if g[0].TagName == fmt.Sprintf("v%v", h.Config.Version) {
|
||||
return true, map[string]string{"version": g[0].TagName}, nil
|
||||
}
|
||||
return false, map[string]string{"version": g[0].TagName}, nil
|
||||
}
|
||||
|
||||
func (h Version) Name() string {
|
||||
return "Version"
|
||||
}
|
8
main.go
8
main.go
|
@ -3,9 +3,11 @@ package main
|
|||
import (
|
||||
_ "embed"
|
||||
"encoding/json"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
checks "http-server-status/internal/pkg/checks"
|
||||
"net/http"
|
||||
"os"
|
||||
"sync"
|
||||
"text/template"
|
||||
)
|
||||
|
@ -21,8 +23,10 @@ var checkList []checks.Check
|
|||
|
||||
func init() {
|
||||
readConfig()
|
||||
log.Debug().Int("max_percent", c.Checks.HDD.MaxPercent).Msg("HDD CHECK")
|
||||
checkList = append(checkList, checks.HDD{c.Checks.HDD}, checks.Memory{Config: c.Checks.Memory}, checks.Load{Config: c.Checks.Load}, checks.Systemd{Config: c.Checks.Systemd})
|
||||
pp := log.Output(zerolog.ConsoleWriter{Out: os.Stdout})
|
||||
multi := zerolog.MultiLevelWriter(pp)
|
||||
log.Logger = zerolog.New(multi).With().Timestamp().Caller().Logger()
|
||||
checkList = append(checkList, checks.HDD{c.Checks.HDD}, checks.Memory{Config: c.Checks.Memory}, checks.Load{Config: c.Checks.Load}, checks.Systemd{Config: c.Checks.Systemd}, checks.Version{Config: c.Checks.Version})
|
||||
}
|
||||
|
||||
func auth(fn http.HandlerFunc) http.HandlerFunc {
|
||||
|
|
|
@ -1,2 +1,12 @@
|
|||
if [ -f "/etc/http-server-status/config.yml" ]; then
|
||||
echo "Config exists"
|
||||
else
|
||||
cp /etc/http-server-status/config.yml.sample /etc/http-server-status/config.yml
|
||||
fi
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl is-active --quiet http-server-status && systemctl restart http-server-status && echo "Restart Service"
|
||||
STATUS="$(systemctl is-active tomcat.service)"
|
||||
if [ "${STATUS}" = "active" ]; then
|
||||
systemctl restart http-server-status
|
||||
echo "Restart Service"
|
||||
fi
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#/bin/sh
|
||||
if ! id -u http-server-status > /dev/null 2>&1; then
|
||||
adduser --system http-server-status
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -116,7 +116,26 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-top: 20px;">
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-header {{if .checks.Version.Success }}bg-success{{else}}bg-danger{{end}}" id="loadtitle">
|
||||
Version
|
||||
|
||||
</div>
|
||||
<div class="card-body">
|
||||
{{ if .checks.Version.Data }}
|
||||
Newest Version: {{ .checks.Version.Data.version }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
|
Loading…
Reference in New Issue