Compare commits
26 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fd4f0429e4 | |||
| 33d4b99a4b | |||
| 9be57f2271 | |||
| 8196447526 | |||
| 712119cb5e | |||
| 644a9418dd | |||
| 8431eef515 | |||
| df07261c57 | |||
| 08634f2a88 | |||
| 273be111b4 | |||
| a4e193fb25 | |||
| d252333ba9 | |||
| 0864b8000c | |||
| ecd6b7e128 | |||
| 527214f38c | |||
| 0f788cc9ce | |||
| 9ece82f3f5 | |||
| 3780f8e864 | |||
| fc3d6a33e3 | |||
| 2fc24d0e76 | |||
| d92a21fbca | |||
| 1d3d16eeaa | |||
| 4331f86ed4 | |||
| da890d95b6 | |||
| e5713e3a81 | |||
| 9778809cba |
@@ -56,3 +56,5 @@ jobs:
|
||||
file: ${{ env.PROJECT_PATH }}/coverage.txt
|
||||
flags: unittests
|
||||
fail_ci_if_error: false
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
# compiles FreeBSD artifacts and attaches them to build
|
||||
name: Release FreeBSD
|
||||
|
||||
on:
|
||||
release:
|
||||
# Only use the types keyword to narrow down the activity types that will trigger your workflow.
|
||||
types: [published]
|
||||
jobs:
|
||||
|
||||
release-freebsd:
|
||||
name: Release FreeBSD
|
||||
runs-on: macos-latest
|
||||
env:
|
||||
PROJECT_PATH: /go/src/github.com/analogj/scrutiny
|
||||
GOPATH: /go
|
||||
GOOS: freebsd
|
||||
GOARCH: amd64
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: ${{github.event.release.tag_name}}
|
||||
- name: Build Binaries
|
||||
uses: vmactions/freebsd-vm@v0.1.3
|
||||
with:
|
||||
envs: 'PROJECT_PATH GOPATH GOOS GOARCH'
|
||||
usesh: true
|
||||
#TODO: lock go version using https://www.jeremymorgan.com/tutorials/golang/how-to-install-go-freebsd/
|
||||
prepare: pkg install -y curl go gmake
|
||||
run: |
|
||||
pwd
|
||||
ls -lah
|
||||
whoami
|
||||
freebsd-version
|
||||
|
||||
mkdir -p $(dirname "$PROJECT_PATH")
|
||||
cp -R $GITHUB_WORKSPACE $PROJECT_PATH
|
||||
cd $PROJECT_PATH
|
||||
|
||||
mkdir -p $GITHUB_WORKSPACE/dist
|
||||
|
||||
echo "building web binary (OS = ${GOOS}, ARCH = ${GOARCH})"
|
||||
go build -ldflags "-extldflags=-static -X main.goos=${GOOS} -X main.goarch=${GOARCH}" -o $GITHUB_WORKSPACE/dist/scrutiny-web-${GOOS}-${GOARCH} -tags "static netgo sqlite_omit_load_extension" webapp/backend/cmd/scrutiny/scrutiny.go
|
||||
|
||||
chmod +x "$GITHUB_WORKSPACE/dist/scrutiny-web-${GOOS}-${GOARCH}"
|
||||
file "$GITHUB_WORKSPACE/dist/scrutiny-web-${GOOS}-${GOARCH}" || true
|
||||
ldd "$GITHUB_WORKSPACE/dist/scrutiny-web-${GOOS}-${GOARCH}" || true
|
||||
|
||||
echo "building collector binary (OS = ${GOOS}, ARCH = ${GOARCH})"
|
||||
go build -ldflags "-extldflags=-static -X main.goos=${GOOS} -X main.goarch=${GOARCH}" -o $GITHUB_WORKSPACE/dist/scrutiny-collector-metrics-${GOOS}-${GOARCH} -tags "static netgo" collector/cmd/collector-metrics/collector-metrics.go
|
||||
|
||||
chmod +x "$GITHUB_WORKSPACE/dist/scrutiny-collector-metrics-${GOOS}-${GOARCH}"
|
||||
file "$GITHUB_WORKSPACE/dist/scrutiny-collector-metrics-${GOOS}-${GOARCH}" || true
|
||||
ldd "$GITHUB_WORKSPACE/dist/scrutiny-collector-metrics-${GOOS}-${GOARCH}" || true
|
||||
|
||||
|
||||
- name: Release Asset - Web - freebsd-amd64
|
||||
id: upload-release-asset1
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.SCRUTINY_GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ github.event.release.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
|
||||
asset_path: './dist/scrutiny-web-freebsd-amd64'
|
||||
asset_name: scrutiny-web-freebsd-amd64
|
||||
asset_content_type: application/octet-stream
|
||||
|
||||
- name: Release Asset - Collector - freebsd-amd64
|
||||
id: upload-release-asset2
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.SCRUTINY_GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ github.event.release.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
|
||||
asset_path: './dist/scrutiny-collector-metrics-freebsd-amd64'
|
||||
asset_name: scrutiny-collector-metrics-freebsd-amd64
|
||||
asset_content_type: application/octet-stream
|
||||
+3
-1
@@ -23,7 +23,9 @@ analogj/scrutiny
|
||||
The frontend is written in Angular.
|
||||
If you're working on the frontend and can use mocked data rather than a real backend, you can use
|
||||
```
|
||||
cd webapp/frontend && ng serve
|
||||
cd webapp/frontend
|
||||
npm install
|
||||
ng serve
|
||||
```
|
||||
|
||||
However, if you need to also run the backend, and use real data, you'll need to run the following command:
|
||||
|
||||
@@ -39,46 +39,5 @@ windows/amd64:
|
||||
@echo "building collector binary (OS = $(OS), ARCH = $(ARCH))"
|
||||
xgo -v --targets="$(OS)/$(ARCH)" -ldflags "-extldflags=-static -X main.goos=$(OS) -X main.goarch=$(ARCH)" -out scrutiny-collector-metrics -tags "static netgo" ${GO_WORKSPACE}/collector/cmd/collector-metrics/
|
||||
|
||||
freebsd/amd64: export GOOS = freebsd
|
||||
freebsd/amd64: export GOARCH = amd64
|
||||
freebsd/amd64:
|
||||
mkdir -p /build
|
||||
|
||||
@echo "building web binary (OS = $(GOOS), ARCH = $(GOARCH))"
|
||||
go build -ldflags "-extldflags=-static -X main.goos=$(GOOS) -X main.goarch=$(GOARCH)" -o /build/scrutiny-web-$(GOOS)-$(GOARCH) -tags "static netgo sqlite_omit_load_extension" webapp/backend/cmd/scrutiny/scrutiny.go
|
||||
|
||||
chmod +x "/build/scrutiny-web-$(GOOS)-$(GOARCH)"
|
||||
file "/build/scrutiny-web-$(GOOS)-$(GOARCH)" || true
|
||||
ldd "/build/scrutiny-web-$(GOOS)-$(GOARCH)" || true
|
||||
|
||||
@echo "building collector binary (OS = $(GOOS), ARCH = $(GOARCH))"
|
||||
go build -ldflags "-extldflags=-static -X main.goos=$(GOOS) -X main.goarch=$(GOARCH)" -o /build/scrutiny-collector-metrics-$(GOOS)-$(GOARCH) -tags "static netgo" collector/cmd/collector-metrics/collector-metrics.go
|
||||
|
||||
chmod +x "/build/scrutiny-collector-metrics-$(GOOS)-$(GOARCH)"
|
||||
file "/build/scrutiny-collector-metrics-$(GOOS)-$(GOARCH)" || true
|
||||
ldd "/build/scrutiny-collector-metrics-$(GOOS)-$(GOARCH)" || true
|
||||
|
||||
freebsd/386: export GOOS = freebsd
|
||||
freebsd/386: export GOARCH = 386
|
||||
freebsd/386:
|
||||
mkdir -p /build
|
||||
|
||||
@echo "building web binary (OS = $(GOOS), ARCH = $(GOARCH))"
|
||||
go build -ldflags "-extldflags=-static -X main.goos=$(GOOS) -X main.goarch=$(GOARCH)" -o /build/scrutiny-web-$(GOOS)-$(GOARCH) -tags "static netgo sqlite_omit_load_extension" webapp/backend/cmd/scrutiny/scrutiny.go
|
||||
|
||||
chmod +x "/build/scrutiny-web-$(GOOS)-$(GOARCH)"
|
||||
file "/build/scrutiny-web-$(GOOS)-$(GOARCH)" || true
|
||||
ldd "/build/scrutiny-web-$(GOOS)-$(GOARCH)" || true
|
||||
|
||||
@echo "building collector binary (OS = $(GOOS), ARCH = $(GOARCH))"
|
||||
go build -ldflags "-extldflags=-static -X main.goos=$(GOOS) -X main.goarch=$(GOARCH)" -o /build/scrutiny-collector-metrics-$(GOOS)-$(GOARCH) -tags "static netgo" collector/cmd/collector-metrics/collector-metrics.go
|
||||
|
||||
chmod +x "/build/scrutiny-collector-metrics-$(GOOS)-$(GOARCH)"
|
||||
file "/build/scrutiny-collector-metrics-$(GOOS)-$(GOARCH)" || true
|
||||
ldd "/build/scrutiny-collector-metrics-$(GOOS)-$(GOARCH)" || true
|
||||
|
||||
|
||||
|
||||
|
||||
# clean:
|
||||
# rm scrutiny-collector-metrics-* scrutiny-web-*
|
||||
|
||||
@@ -99,24 +99,37 @@ OPTIONS:
|
||||
return err
|
||||
}
|
||||
}
|
||||
//override config with flags if set
|
||||
if c.IsSet("host-id") {
|
||||
config.Set("host.id", c.String("host-id")) // set/override the host-id using CLI.
|
||||
}
|
||||
|
||||
if c.Bool("debug") {
|
||||
config.Set("log.level", "DEBUG")
|
||||
}
|
||||
|
||||
if c.IsSet("log-file") {
|
||||
config.Set("log.file", c.String("log-file"))
|
||||
}
|
||||
|
||||
if c.IsSet("api-endpoint") {
|
||||
config.Set("api.endpoint", c.String("api-endpoint"))
|
||||
}
|
||||
|
||||
collectorLogger := logrus.WithFields(logrus.Fields{
|
||||
"type": "metrics",
|
||||
})
|
||||
|
||||
if c.Bool("debug") {
|
||||
logrus.SetLevel(logrus.DebugLevel)
|
||||
if level, err := logrus.ParseLevel(config.GetString("log.level")); err == nil {
|
||||
logrus.SetLevel(level)
|
||||
} else {
|
||||
logrus.SetLevel(logrus.InfoLevel)
|
||||
}
|
||||
|
||||
if c.IsSet("log-file") {
|
||||
logFile, err := os.OpenFile(c.String("log-file"), os.O_CREATE|os.O_WRONLY, 0644)
|
||||
if config.IsSet("log.file") && len(config.GetString("log.file")) > 0 {
|
||||
logFile, err := os.OpenFile(config.GetString("log.file"), os.O_CREATE|os.O_WRONLY, 0644)
|
||||
if err != nil {
|
||||
logrus.Errorf("Failed to open log file %s for output: %s", c.String("log-file"), err)
|
||||
logrus.Errorf("Failed to open log file %s for output: %s", config.GetString("log.file"), err)
|
||||
return err
|
||||
}
|
||||
defer logFile.Close()
|
||||
@@ -126,7 +139,7 @@ OPTIONS:
|
||||
metricCollector, err := collector.CreateMetricsCollector(
|
||||
config,
|
||||
collectorLogger,
|
||||
c.String("api-endpoint"),
|
||||
config.GetString("api.endpoint"),
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
@@ -144,14 +157,12 @@ OPTIONS:
|
||||
&cli.StringFlag{
|
||||
Name: "api-endpoint",
|
||||
Usage: "The api server endpoint",
|
||||
Value: "http://localhost:8080",
|
||||
EnvVars: []string{"SCRUTINY_API_ENDPOINT"},
|
||||
},
|
||||
|
||||
&cli.StringFlag{
|
||||
Name: "log-file",
|
||||
Usage: "Path to file for logging. Leave empty to use STDOUT",
|
||||
Value: "",
|
||||
EnvVars: []string{"COLLECTOR_LOG_FILE"},
|
||||
},
|
||||
|
||||
|
||||
@@ -96,6 +96,7 @@ OPTIONS:
|
||||
logrus.SetOutput(io.MultiWriter(os.Stderr, logFile))
|
||||
}
|
||||
|
||||
//TODO: pass in the collector, use configuration from collector-metrics
|
||||
stCollector, err := collector.CreateSelfTestCollector(
|
||||
collectorLogger,
|
||||
c.String("api-endpoint"),
|
||||
|
||||
@@ -15,7 +15,15 @@ func ExecCmd(logger *logrus.Entry, cmdName string, cmdArgs []string, workingDir
|
||||
|
||||
cmd := exec.Command(cmdName, cmdArgs...)
|
||||
var stdBuffer bytes.Buffer
|
||||
mw := io.MultiWriter(logger.Logger.Out, &stdBuffer)
|
||||
|
||||
logWriters := []io.Writer{
|
||||
&stdBuffer,
|
||||
}
|
||||
if logger.Logger.Level == logrus.DebugLevel {
|
||||
logWriters = append(logWriters, logger.Logger.Out)
|
||||
}
|
||||
|
||||
mw := io.MultiWriter(logWriters...)
|
||||
|
||||
cmd.Stdout = mw
|
||||
cmd.Stderr = mw
|
||||
|
||||
@@ -33,6 +33,11 @@ func (c *configuration) Init() error {
|
||||
|
||||
c.SetDefault("devices", []string{})
|
||||
|
||||
c.SetDefault("log.level", "INFO")
|
||||
c.SetDefault("log.file", "")
|
||||
|
||||
c.SetDefault("api.endpoint", "http://localhost:8080")
|
||||
|
||||
//c.SetDefault("collect.short.command", "-a -o on -S on")
|
||||
|
||||
//if you want to load a non-standard location system config file (~/drawbridge.yml), use ReadConfig
|
||||
|
||||
@@ -22,6 +22,7 @@ COPY --from=backendbuild /go/src/github.com/analogj/scrutiny/scrutiny-collector-
|
||||
COPY --from=backendbuild /go/src/github.com/analogj/scrutiny/scrutiny-collector-metrics /scrutiny/bin/
|
||||
RUN chmod +x /scrutiny/bin/scrutiny-collector-selftest && \
|
||||
chmod +x /scrutiny/bin/scrutiny-collector-metrics && \
|
||||
chmod +x /entrypoint-collector.sh && \
|
||||
chmod 0644 /etc/cron.d/scrutiny && \
|
||||
rm -f /etc/cron.daily/apt /etc/cron.daily/dpkg /etc/cron.daily/passwd
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#!/bin/bash
|
||||
# Cron runs in its own isolated environment (usually using only /etc/environment )
|
||||
# So when the container starts up, we will do a dump of the runtime environment into a .env file that we
|
||||
# will then source into the crontab file (/etc/cron.d/scrutiny.sh)
|
||||
|
||||
@@ -54,7 +54,12 @@ devices:
|
||||
# - 3ware,4
|
||||
# - 3ware,5
|
||||
|
||||
|
||||
#log:
|
||||
# file: '' #absolute or relative paths allowed, eg. web.log
|
||||
# level: INFO
|
||||
#
|
||||
#api:
|
||||
# endpoint: 'http://localhost:8080'
|
||||
|
||||
########################################################################################################################
|
||||
# FEATURES COMING SOON
|
||||
|
||||
@@ -239,15 +239,19 @@ func (n *Notify) GenShoutrrrNotificationParams(shoutrrrUrl string) (string, *sho
|
||||
subject := n.Payload.Subject
|
||||
switch serviceName {
|
||||
// no params supported for these services
|
||||
case "discord", "hangouts", "ifttt", "mattermost", "teams", "rocketchat":
|
||||
case "hangouts", "mattermost", "teams", "rocketchat":
|
||||
break
|
||||
case "discord":
|
||||
(*params)["title"] = subject
|
||||
case "gotify":
|
||||
(*params)["title"] = subject
|
||||
case "ifttt":
|
||||
(*params)["title"] = subject
|
||||
case "join":
|
||||
(*params)["title"] = subject
|
||||
(*params)["icon"] = logoUrl
|
||||
case "opsgenie":
|
||||
(*params)["description"] = subject
|
||||
(*params)["title"] = subject
|
||||
case "pushbullet":
|
||||
(*params)["title"] = subject
|
||||
case "pushover":
|
||||
@@ -260,7 +264,7 @@ func (n *Notify) GenShoutrrrNotificationParams(shoutrrrUrl string) (string, *sho
|
||||
case "standard":
|
||||
(*params)["subject"] = subject
|
||||
case "telegram":
|
||||
(*params)["subject"] = subject
|
||||
(*params)["title"] = subject
|
||||
case "zulip":
|
||||
(*params)["topic"] = subject
|
||||
}
|
||||
|
||||
@@ -2,4 +2,4 @@ package version
|
||||
|
||||
// VERSION is the app-global version string, which will be replaced with a
|
||||
// new value during packaging
|
||||
const VERSION = "0.3.7"
|
||||
const VERSION = "0.3.12"
|
||||
|
||||
@@ -1 +1 @@
|
||||
export const treoBreakpoints = {'xs': '(min-width: 0) and (max-width: 599px)', 'sm': '(min-width: 600px) and (max-width: 959px)', 'md': '(min-width: 960px) and (max-width: 1279px)', 'lg': '(min-width: 1280px) and (max-width: 1439px)', 'xl': '(min-width: 1440px)', 'lt-md': '(max-width: 959px)', 'lt-lg': '(max-width: 1279px)', 'lt-xl': '(max-width: 1439px)', 'gt-xs': '(min-width: 600px)', 'gt-sm': '(min-width: 960px)', 'gt-md': '(min-width: 1280px)'};
|
||||
export const treoBreakpoints = {'xs': '(min-width: 0) and (max-width: 599px)', 'sm': '(min-width: 600px) and (max-width: 959px)', 'md': '(min-width: 960px) and (max-width: 1279px)', 'lg': '(min-width: 1280px) and (max-width: 1439px)', 'xl': '(min-width: 1440px)', 'lt-md': '(max-width: 200px)', 'lt-lg': '(max-width: 1279px)', 'lt-xl': '(max-width: 1439px)', 'gt-xs': '(min-width: 600px)', 'gt-sm': '(min-width: 960px)', 'gt-md': '(min-width: 1280px)'};
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
|
||||
<div class="flex flex-wrap w-full">
|
||||
|
||||
<div *ngFor="let disk of data.data | deviceSort" class="flex w-1/2 min-w-80 p-4">
|
||||
<div *ngFor="let disk of data.data | deviceSort" class="flex gt-sm:w-1/2 min-w-80 p-4">
|
||||
<div [ngClass]="{'border-green': disk.smart_results[0]?.smart_status == 'passed',
|
||||
'border-red': disk.smart_results[0]?.smart_status == 'failed' }"
|
||||
class="relative flex flex-col flex-auto p-6 pr-3 pb-3 bg-card rounded border-l-4 shadow-md overflow-hidden">
|
||||
|
||||
@@ -139,7 +139,7 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy
|
||||
tooltip: {
|
||||
theme: 'dark',
|
||||
x : {
|
||||
format: 'MMM dd, yyyy hh:mm:ss'
|
||||
format: 'MMM dd, yyyy HH:mm:ss'
|
||||
},
|
||||
y : {
|
||||
formatter: (value) => {
|
||||
|
||||
Reference in New Issue
Block a user