Skip to content

Commit

Permalink
Add Apple Silicon binary and fix its CPU clock speed
Browse files Browse the repository at this point in the history
by updating the deps.

Also remove some an overkill dependency (minio/minio)
by switching to getting disk info from an existing one
(shirou/gopsutil).

Finally update docs a bit, in particular I should be less
harsh on myself. :P

Fixes #2
  • Loading branch information
gdubicki committed Mar 9, 2024
1 parent 31bdee0 commit 3a3bc56
Show file tree
Hide file tree
Showing 10 changed files with 177 additions and 57 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ it, then something IS wrong with the server, isn't it?).

## Installation

1. Download the lastest binary for your OS and arch and make it executable:
1. Download the latest binary for your OS and arch and make it executable, f.e. for Linux on AMD64:
```
curl -L https://github.com/gdubicki/dynamotd/releases/latest/download/dynamotd-linux-amd64 -o /usr/local/bin/dynamotd && chmod +x /usr/local/bin/dynamotd
```
2. (Optionally) Configure with `/etc/dynamotd.yaml` file. See the example config in [dynamotd.yaml](./dynamotd.yaml).

3. Make it shown instead of or after your default static MOTD by editing `/etc/pam.d/sshd`. Find line with `pam_motd.so` and either replace or append this line to it:
```
session optional pam_exec.so stdout /usr/local/bin/dynamotd -force-color
session optional pam_exec.so stdout /usr/local/bin/dynamotd -force-color
```
(or `-no-color` if you prefer plain black-and-white output).

Expand All @@ -51,7 +51,7 @@ Check out all the available command-line arguments by running `dynamotd -help`.
## Contributing

Requirements:
* Go v. 1.17+
* Go v. 1.22+

How to build:
```
Expand All @@ -63,7 +63,7 @@ How to run tests:
go test -v tests/*
```

Optional, but recommended: use [pre-commit](https://pre-commit.com) and install use apps.
Optional, but recommended: use [pre-commit](https://pre-commit.com) and install the apps used by our config.

## TODO

Expand All @@ -77,5 +77,5 @@ These features will be implemented in the future:

We also don't have user docs, developer docs and contribution guide.

What we DO have is some non-idiomatic code and brain-dead solutions because the original author is only learning Golang.
What we DO have is some non-idiomatic code because the original author is only learning Golang.
:P
3 changes: 2 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@

GOOS=linux GOARCH=amd64 go build -o dynamotd-linux-amd64
GOOS=linux GOARCH=arm64 go build -o dynamotd-linux-arm64
GOOS=darwin GOARCH=amd64 go build -o dynamotd-macos
GOOS=darwin GOARCH=amd64 go build -o dynamotd-macos-amd64
GOOS=darwin GOARCH=arm64 go build -o dynamotd-macos-arm64
19 changes: 10 additions & 9 deletions dynamotd.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
# This is a configuration file example.
# It is completely optional. The values below represent the defaults.

# empty line is an empty line, duh
rows:
- "timestamp"
- ""
- "fqdn"
- "ip"
- "uptime"
- ""
- "load"
- "memory"
- "diskspace"
- timestamp
-
- fqdn
- ip
- uptime
-
- load
- memory
- diskspace
71 changes: 40 additions & 31 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,42 +1,51 @@
module github.com/gdubicki/dynamotd

go 1.17
go 1.22

require (
github.com/Showmax/go-fqdn v0.0.0-20180501083314-6f60894d629f
github.com/Showmax/go-fqdn v1.0.0
github.com/Tonyfilla/go-humanize v0.0.0-20190109114339-dd7dcc22b778
github.com/fatih/color v1.13.0
github.com/mackerelio/go-osstat v0.2.1
github.com/minio/minio v0.0.0-20200926040242-511424a287e7
github.com/shirou/gopsutil v3.21.11+incompatible
github.com/spf13/viper v1.6.1
github.com/stretchr/testify v1.4.0
github.com/fatih/color v1.16.0
github.com/mackerelio/go-osstat v0.2.4
github.com/shirou/gopsutil/v3 v3.24.2
github.com/spf13/viper v1.18.2
github.com/stretchr/testify v1.9.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/fsnotify/fsnotify v1.4.7 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/magiconair/properties v1.8.1 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/mitchellh/mapstructure v1.1.2 // indirect
github.com/montanaflynn/stats v0.5.0 // indirect
github.com/lufia/plan9stats v0.0.0-20240226150601-1dcf7310316a // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/montanaflynn/stats v0.7.1 // indirect
github.com/ncw/directio v1.0.5 // indirect
github.com/pelletier/go-toml v1.2.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/afero v1.1.2 // indirect
github.com/spf13/cast v1.3.0 // indirect
github.com/spf13/jwalterweatherman v1.0.0 // indirect
github.com/spf13/pflag v1.0.3 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tklauser/numcpus v0.4.0 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27 // indirect
golang.org/x/text v0.3.3 // indirect
gopkg.in/ini.v1 v1.57.0 // indirect
gopkg.in/yaml.v2 v2.2.8 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/pelletier/go-toml/v2 v2.1.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/tklauser/go-sysconf v0.3.13 // indirect
github.com/tklauser/numcpus v0.7.0 // indirect
github.com/yusufpapurcu/wmi v1.2.4 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 3a3bc56

Please sign in to comment.