Compare commits
52 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e364fe95d9 | |||
| c285491c34 | |||
| c62af772af | |||
| fe5bad8c00 | |||
| 72e0681497 | |||
| 885a957197 | |||
| bc444918da | |||
| 1fe56136b9 | |||
| 491b1ed4aa | |||
| 36f53198be | |||
| 85dde0efc9 | |||
| bf98216e0d | |||
| 93cf676818 | |||
| 58eaa29e4d | |||
| 9898ff1a33 | |||
| 7edef7a2fb | |||
| ada3665ba0 | |||
| 7dbe108e33 | |||
| e2e0045ddd | |||
| edfa75739a | |||
| 404421bab4 | |||
| c160e3e50b | |||
| 048bf237e2 | |||
| 13d3d9f64e | |||
| 7293f2e48b | |||
| 77971edf5f | |||
| c89381b39e | |||
| d6c1d4aa04 | |||
| 5be3407489 | |||
| 4fd650a150 | |||
| 78d0dd8f3b | |||
| c9620b5f87 | |||
| a83aab79bf | |||
| 75b78a45c0 | |||
| bdbb7d0e1b | |||
| de3269409f | |||
| 96534c44b7 | |||
| c1aaf67152 | |||
| 95ef254b8c | |||
| 0fffc167fb | |||
| 216d3a6fe3 | |||
| c841ba56de | |||
| afca629848 | |||
| aa720f7065 | |||
| b7f97c27bc | |||
| 52a0f7575e | |||
| e7a3fd96f0 | |||
| e32af371f7 | |||
| 382175bbb1 | |||
| b09ec3b912 | |||
| 1b2e95532b | |||
| eac234ee2e |
@@ -0,0 +1,4 @@
|
||||
*.css linguist-detectable=false
|
||||
*.scss linguist-detectable=false
|
||||
*.js linguist-detectable=false
|
||||
*.ts linguist-detectable=false
|
||||
@@ -1,21 +1,24 @@
|
||||
name: CI
|
||||
# This workflow is triggered on pushes to the repository.
|
||||
on: [push]
|
||||
# This workflow is triggered on pushes & pull requests
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
container: golang:1.13
|
||||
container: karalabe/xgo-1.13.x
|
||||
env:
|
||||
PROJECT_PATH: /go/src/github.com/analogj/scrutiny
|
||||
CGO_ENABLED: 1
|
||||
steps:
|
||||
- name: Git
|
||||
run: |
|
||||
apt-get update && apt-get install -y software-properties-common
|
||||
add-apt-repository ppa:git-core/ppa && apt-get update && apt-get install -y git
|
||||
git --version
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Test
|
||||
env:
|
||||
GOOS: linux
|
||||
GOARCH: amd64
|
||||
run: |
|
||||
mkdir -p $PROJECT_PATH
|
||||
cp -a $GITHUB_WORKSPACE/* $PROJECT_PATH/
|
||||
@@ -23,89 +26,33 @@ jobs:
|
||||
|
||||
go mod vendor
|
||||
go test -race -coverprofile=coverage.txt -covermode=atomic -v -tags "static" $(go list ./... | grep -v /vendor/)
|
||||
- name: Build amd64
|
||||
env:
|
||||
GOOS: linux
|
||||
GOARCH: amd64
|
||||
CGO_ENABLED: 1
|
||||
- name: Build Binaries
|
||||
run: |
|
||||
apt-get update && apt-get install -y file
|
||||
|
||||
cd $PROJECT_PATH
|
||||
echo "###### Build Web ######"
|
||||
go build -ldflags "-extldflags=-static -X main.goos=linux -X main.goarch=amd64" -o scrutiny-web-linux-amd64 -tags "static netgo sqlite_omit_load_extension" webapp/backend/cmd/scrutiny/scrutiny.go
|
||||
echo "###### Build Collector ######"
|
||||
go build -ldflags "-extldflags=-static -X main.goos=linux -X main.goarch=amd64" -o scrutiny-collector-metrics-linux-amd64 -tags "static netgo" collector/cmd/collector-metrics/collector-metrics.go
|
||||
|
||||
chmod +x scrutiny-web-linux-amd64
|
||||
chmod +x scrutiny-collector-metrics-linux-amd64
|
||||
|
||||
file scrutiny-web-linux-amd64
|
||||
ldd scrutiny-web-linux-amd64 || true
|
||||
file scrutiny-collector-metrics-linux-amd64
|
||||
ldd scrutiny-collector-metrics-linux-amd64 || true
|
||||
- name: Build arm
|
||||
env:
|
||||
GOOS: linux
|
||||
GOARCH: arm
|
||||
run: |
|
||||
cd $PROJECT_PATH
|
||||
go build -ldflags "-extldflags=-static -X main.goos=linux -X main.goarch=arm" -o scrutiny-web-linux-arm -tags "static netgo sqlite_omit_load_extension" webapp/backend/cmd/scrutiny/scrutiny.go
|
||||
go build -ldflags "-extldflags=-static -X main.goos=linux -X main.goarch=arm" -o scrutiny-collector-metrics-linux-arm -tags "static netgo" collector/cmd/collector-metrics/collector-metrics.go
|
||||
|
||||
chmod +x scrutiny-web-linux-arm
|
||||
chmod +x scrutiny-collector-metrics-linux-arm
|
||||
|
||||
- name: Build arm64
|
||||
env:
|
||||
GOOS: linux
|
||||
GOARCH: arm64
|
||||
run: |
|
||||
cd $PROJECT_PATH
|
||||
go build -ldflags "-extldflags=-static -X main.goos=linux -X main.goarch=arm64" -o scrutiny-web-linux-arm64 -tags "static netgo sqlite_omit_load_extension" webapp/backend/cmd/scrutiny/scrutiny.go
|
||||
go build -ldflags "-extldflags=-static -X main.goos=linux -X main.goarch=arm64" -o scrutiny-collector-metrics-linux-arm64 -tags "static netgo" collector/cmd/collector-metrics/collector-metrics.go
|
||||
|
||||
chmod +x scrutiny-web-linux-arm64
|
||||
chmod +x scrutiny-collector-metrics-linux-arm64
|
||||
|
||||
- name: Build windows
|
||||
env:
|
||||
GOOS: windows
|
||||
GOARCH: amd64
|
||||
run: |
|
||||
cd $PROJECT_PATH
|
||||
go build -ldflags "-X main.goos=windows -X main.goarch=amd64" -o scrutiny-web-windows-amd64.exe -tags "static" webapp/backend/cmd/scrutiny/scrutiny.go
|
||||
go build -ldflags "-X main.goos=windows -X main.goarch=amd64" -o scrutiny-collector-metrics-windows-amd64.exe -tags "static" collector/cmd/collector-metrics/collector-metrics.go
|
||||
|
||||
- name: Build freebsd
|
||||
env:
|
||||
GOOS: freebsd
|
||||
GOARCH: amd64
|
||||
run: |
|
||||
cd $PROJECT_PATH
|
||||
go build -ldflags "-extldflags=-static -X main.goos=freebsd -X main.goarch=amd64" -o scrutiny-web-freebsd-amd64 -tags "static netgo sqlite_omit_load_extension" webapp/backend/cmd/scrutiny/scrutiny.go
|
||||
go build -ldflags "-extldflags=-static -X main.goos=freebsd -X main.goarch=amd64" -o scrutiny-collector-metrics-freebsd-amd64 -tags "static netgo" collector/cmd/collector-metrics/collector-metrics.go
|
||||
|
||||
chmod +x scrutiny-web-freebsd-amd64
|
||||
chmod +x scrutiny-collector-metrics-freebsd-amd64
|
||||
make all
|
||||
|
||||
- name: Archive
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: binaries.zip
|
||||
path: |
|
||||
${{ env.PROJECT_PATH }}/scrutiny-web-linux-amd64
|
||||
${{ env.PROJECT_PATH }}/scrutiny-collector-metrics-linux-amd64
|
||||
${{ env.PROJECT_PATH }}/scrutiny-web-linux-arm64
|
||||
${{ env.PROJECT_PATH }}/scrutiny-collector-metrics-linux-arm64
|
||||
${{ env.PROJECT_PATH }}/scrutiny-web-linux-arm
|
||||
${{ env.PROJECT_PATH }}/scrutiny-collector-metrics-linux-arm
|
||||
${{ env.PROJECT_PATH }}/scrutiny-web-windows-amd64.exe
|
||||
${{ env.PROJECT_PATH }}/scrutiny-collector-metrics-windows-amd64.exe
|
||||
${{ env.PROJECT_PATH }}/scrutiny-web-freebsd-amd64
|
||||
${{ env.PROJECT_PATH }}/scrutiny-collector-metrics-freebsd-amd64
|
||||
/build/scrutiny-web-linux-amd64
|
||||
/build/scrutiny-collector-metrics-linux-amd64
|
||||
/build/scrutiny-web-linux-arm64
|
||||
/build/scrutiny-collector-metrics-linux-arm64
|
||||
/build/scrutiny-web-linux-arm-5
|
||||
/build/scrutiny-collector-metrics-linux-arm-5
|
||||
/build/scrutiny-web-linux-arm-6
|
||||
/build/scrutiny-collector-metrics-linux-arm-6
|
||||
/build/scrutiny-web-linux-arm-7
|
||||
/build/scrutiny-collector-metrics-linux-arm-7
|
||||
/build/scrutiny-web-windows-4.0-amd64.exe
|
||||
/build/scrutiny-collector-metrics-windows-4.0-amd64.exe
|
||||
# /build/scrutiny-web-freebsd-amd64
|
||||
# /build/scrutiny-collector-metrics-freebsd-amd64
|
||||
- uses: codecov/codecov-action@v1
|
||||
with:
|
||||
file: ${{ env.PROJECT_PATH }}/coverage.txt
|
||||
flags: unittests
|
||||
fail_ci_if_error: true
|
||||
fail_ci_if_error: false
|
||||
|
||||
@@ -16,10 +16,16 @@ jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
container: golang:1.13
|
||||
container: karalabe/xgo-1.13.x
|
||||
env:
|
||||
PROJECT_PATH: /go/src/github.com/analogj/scrutiny
|
||||
CGO_ENABLED: 1
|
||||
steps:
|
||||
- name: Git
|
||||
run: |
|
||||
apt-get update && apt-get install -y software-properties-common
|
||||
add-apt-repository ppa:git-core/ppa && apt-get update && apt-get install -y git
|
||||
git --version
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
- name: Bump version
|
||||
@@ -30,9 +36,6 @@ jobs:
|
||||
version_metadata_path: ${{ github.event.inputs.version_metadata_path }}
|
||||
github_token: ${{ secrets.SCRUTINY_GITHUB_TOKEN }}
|
||||
- name: Test
|
||||
env:
|
||||
GOOS: linux
|
||||
GOARCH: amd64
|
||||
run: |
|
||||
mkdir -p $PROJECT_PATH
|
||||
cp -a $GITHUB_WORKSPACE/* $PROJECT_PATH/
|
||||
@@ -41,62 +44,11 @@ jobs:
|
||||
go mod vendor
|
||||
go test -v -tags "static" $(go list ./... | grep -v /vendor/)
|
||||
|
||||
- name: Build amd64
|
||||
env:
|
||||
GOOS: linux
|
||||
GOARCH: amd64
|
||||
- name: Build Binaries
|
||||
run: |
|
||||
|
||||
cd $PROJECT_PATH
|
||||
go build -ldflags "-extldflags=-static -X main.goos=linux -X main.goarch=amd64" -o scrutiny-web-linux-amd64 -tags "static netgo sqlite_omit_load_extension" webapp/backend/cmd/scrutiny/scrutiny.go
|
||||
go build -ldflags "-extldflags=-static -X main.goos=linux -X main.goarch=amd64" -o scrutiny-collector-metrics-linux-amd64 -tags "static netgo" collector/cmd/collector-metrics/collector-metrics.go
|
||||
|
||||
chmod +x scrutiny-web-linux-amd64
|
||||
chmod +x scrutiny-collector-metrics-linux-amd64
|
||||
|
||||
- name: Build arm
|
||||
env:
|
||||
GOOS: linux
|
||||
GOARCH: arm
|
||||
run: |
|
||||
cd $PROJECT_PATH
|
||||
go build -ldflags "-extldflags=-static -X main.goos=linux -X main.goarch=arm" -o scrutiny-web-linux-arm -tags "static netgo sqlite_omit_load_extension" webapp/backend/cmd/scrutiny/scrutiny.go
|
||||
go build -ldflags "-extldflags=-static -X main.goos=linux -X main.goarch=arm" -o scrutiny-collector-metrics-linux-arm -tags "static netgo" collector/cmd/collector-metrics/collector-metrics.go
|
||||
|
||||
chmod +x scrutiny-web-linux-arm
|
||||
chmod +x scrutiny-collector-metrics-linux-arm
|
||||
|
||||
- name: Build arm64
|
||||
env:
|
||||
GOOS: linux
|
||||
GOARCH: arm64
|
||||
run: |
|
||||
cd $PROJECT_PATH
|
||||
go build -ldflags "-extldflags=-static -X main.goos=linux -X main.goarch=arm64" -o scrutiny-web-linux-arm64 -tags "static netgo sqlite_omit_load_extension" webapp/backend/cmd/scrutiny/scrutiny.go
|
||||
go build -ldflags "-extldflags=-static -X main.goos=linux -X main.goarch=arm64" -o scrutiny-collector-metrics-linux-arm64 -tags "static netgo" collector/cmd/collector-metrics/collector-metrics.go
|
||||
|
||||
chmod +x scrutiny-web-linux-arm64
|
||||
chmod +x scrutiny-collector-metrics-linux-arm64
|
||||
|
||||
- name: Build windows
|
||||
env:
|
||||
GOOS: windows
|
||||
GOARCH: amd64
|
||||
run: |
|
||||
cd $PROJECT_PATH
|
||||
go build -ldflags "-X main.goos=windows -X main.goarch=amd64" -o scrutiny-web-windows-amd64.exe -tags "static" webapp/backend/cmd/scrutiny/scrutiny.go
|
||||
go build -ldflags "-X main.goos=windows -X main.goarch=amd64" -o scrutiny-collector-metrics-windows-amd64.exe -tags "static" collector/cmd/collector-metrics/collector-metrics.go
|
||||
|
||||
- name: Build freebsd
|
||||
env:
|
||||
GOOS: freebsd
|
||||
GOARCH: amd64
|
||||
run: |
|
||||
cd $PROJECT_PATH
|
||||
go build -ldflags "-extldflags=-static -X main.goos=freebsd -X main.goarch=amd64" -o scrutiny-web-freebsd-amd64 -tags "static netgo sqlite_omit_load_extension" webapp/backend/cmd/scrutiny/scrutiny.go
|
||||
go build -ldflags "-extldflags=-static -X main.goos=freebsd -X main.goarch=amd64" -o scrutiny-collector-metrics-freebsd-amd64 -tags "static netgo" collector/cmd/collector-metrics/collector-metrics.go
|
||||
|
||||
chmod +x scrutiny-web-freebsd-amd64
|
||||
chmod +x scrutiny-collector-metrics-freebsd-amd64
|
||||
make all
|
||||
|
||||
- name: Commit
|
||||
uses: EndBug/add-and-commit@v4 # You can change this to use a specific version
|
||||
@@ -130,7 +82,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.SCRUTINY_GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.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: ${{ env.PROJECT_PATH }}/scrutiny-web-linux-amd64
|
||||
asset_path: /build/scrutiny-web-linux-amd64
|
||||
asset_name: scrutiny-web-linux-amd64
|
||||
asset_content_type: application/octet-stream
|
||||
- name: Release Asset - Collector - linux-amd64
|
||||
@@ -140,7 +92,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.SCRUTINY_GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.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: ${{ env.PROJECT_PATH }}/scrutiny-collector-metrics-linux-amd64
|
||||
asset_path: /build/scrutiny-collector-metrics-linux-amd64
|
||||
asset_name: scrutiny-collector-metrics-linux-amd64
|
||||
asset_content_type: application/octet-stream
|
||||
|
||||
@@ -152,7 +104,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.SCRUTINY_GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.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: ${{ env.PROJECT_PATH }}/scrutiny-web-linux-arm64
|
||||
asset_path: /build/scrutiny-web-linux-arm64
|
||||
asset_name: scrutiny-web-linux-arm64
|
||||
asset_content_type: application/octet-stream
|
||||
- name: Release Asset - Collector - linux-arm64
|
||||
@@ -162,48 +114,90 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.SCRUTINY_GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.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: ${{ env.PROJECT_PATH }}/scrutiny-collector-metrics-linux-arm64
|
||||
asset_path: /build/scrutiny-collector-metrics-linux-arm64
|
||||
asset_name: scrutiny-collector-metrics-linux-arm64
|
||||
asset_content_type: application/octet-stream
|
||||
|
||||
- name: Release Asset - Web - linux-arm
|
||||
- name: Release Asset - Web - linux-arm-5
|
||||
id: upload-release-asset5
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.SCRUTINY_GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.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: ${{ env.PROJECT_PATH }}/scrutiny-web-linux-arm
|
||||
asset_name: scrutiny-web-linux-arm
|
||||
asset_path: /build/scrutiny-web-linux-arm-5
|
||||
asset_name: scrutiny-web-linux-arm-5
|
||||
asset_content_type: application/octet-stream
|
||||
- name: Release Asset - Collector - linux-arm
|
||||
- name: Release Asset - Collector - linux-arm-5
|
||||
id: upload-release-asset6
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.SCRUTINY_GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.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: ${{ env.PROJECT_PATH }}/scrutiny-collector-metrics-linux-arm
|
||||
asset_name: scrutiny-collector-metrics-linux-arm
|
||||
asset_path: /buildd/scrutiny-collector-metrics-linux-arm-5
|
||||
asset_name: scrutiny-collector-metrics-linux-arm-5
|
||||
asset_content_type: application/octet-stream
|
||||
|
||||
- name: Release Asset - Web - freebsd-amd64
|
||||
- name: Release Asset - Web - linux-arm-6
|
||||
id: upload-release-asset7
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.SCRUTINY_GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.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: ${{ env.PROJECT_PATH }}/scrutiny-web-freebsd-amd64
|
||||
asset_name: scrutiny-web-freebsd-amd64
|
||||
asset_path: /build/scrutiny-web-linux-arm-6
|
||||
asset_name: scrutiny-web-linux-arm-6
|
||||
asset_content_type: application/octet-stream
|
||||
- name: Release Asset - Collector - freebsd-amd64
|
||||
- name: Release Asset - Collector - linux-arm-6
|
||||
id: upload-release-asset8
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.SCRUTINY_GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.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: ${{ env.PROJECT_PATH }}/scrutiny-collector-metrics-freebsd-amd64
|
||||
asset_name: scrutiny-collector-metrics-freebsd-amd64
|
||||
asset_path: /buildd/scrutiny-collector-metrics-linux-arm-6
|
||||
asset_name: scrutiny-collector-metrics-linux-arm-6
|
||||
asset_content_type: application/octet-stream
|
||||
|
||||
- name: Release Asset - Web - linux-arm-7
|
||||
id: upload-release-asset9
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.SCRUTINY_GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.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: /build/scrutiny-web-linux-arm-7
|
||||
asset_name: scrutiny-web-linux-arm-7
|
||||
asset_content_type: application/octet-stream
|
||||
- name: Release Asset - Collector - linux-arm-7
|
||||
id: upload-release-asset10
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.SCRUTINY_GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.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: /buildd/scrutiny-collector-metrics-linux-arm-7
|
||||
asset_name: scrutiny-collector-metrics-linux-arm-7
|
||||
asset_content_type: application/octet-stream
|
||||
|
||||
# - name: Release Asset - Web - freebsd-amd64
|
||||
# id: upload-release-asset7
|
||||
# uses: actions/upload-release-asset@v1
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ secrets.SCRUTINY_GITHUB_TOKEN }}
|
||||
# with:
|
||||
# upload_url: ${{ steps.create_release.outputs.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: ${{ env.PROJECT_PATH }}/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-asset8
|
||||
# uses: actions/upload-release-asset@v1
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ secrets.SCRUTINY_GITHUB_TOKEN }}
|
||||
# with:
|
||||
# upload_url: ${{ steps.create_release.outputs.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: ${{ env.PROJECT_PATH }}/scrutiny-collector-metrics-freebsd-amd64
|
||||
# asset_name: scrutiny-collector-metrics-freebsd-amd64
|
||||
# asset_content_type: application/octet-stream
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
name: Label sponsors
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened]
|
||||
issues:
|
||||
types: [opened]
|
||||
jobs:
|
||||
build:
|
||||
name: is-sponsor-label
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: JasonEtco/is-sponsor-label-action@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -0,0 +1,84 @@
|
||||
export CGO_ENABLED = 1
|
||||
|
||||
GO_WORKSPACE ?= /go/src/github.com/analogj/scrutiny
|
||||
|
||||
BINARY=\
|
||||
linux/amd64 \
|
||||
linux/arm-5 \
|
||||
linux/arm-6 \
|
||||
linux/arm-7 \
|
||||
linux/arm64 \
|
||||
|
||||
|
||||
.PHONY: all $(BINARY)
|
||||
all: $(BINARY) windows/amd64
|
||||
|
||||
$(BINARY): OS = $(word 1,$(subst /, ,$*))
|
||||
$(BINARY): ARCH = $(word 2,$(subst /, ,$*))
|
||||
$(BINARY): build/scrutiny-web-%:
|
||||
@echo "building web binary (OS = $(OS), ARCH = $(ARCH))"
|
||||
xgo -v --targets="$(OS)/$(ARCH)" -ldflags "-extldflags=-static -X main.goos=$(OS) -X main.goarch=$(ARCH)" -out scrutiny-web -tags "static netgo sqlite_omit_load_extension" ${GO_WORKSPACE}/webapp/backend/cmd/scrutiny/
|
||||
|
||||
chmod +x "/build/scrutiny-web-$(OS)-$(ARCH)"
|
||||
file "/build/scrutiny-web-$(OS)-$(ARCH)" || true
|
||||
ldd "/build/scrutiny-web-$(OS)-$(ARCH)" || true
|
||||
|
||||
@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/
|
||||
|
||||
chmod +x "/build/scrutiny-collector-metrics-$(OS)-$(ARCH)"
|
||||
file "/build/scrutiny-collector-metrics-$(OS)-$(ARCH)" || true
|
||||
ldd "/build/scrutiny-collector-metrics-$(OS)-$(ARCH)" || true
|
||||
|
||||
windows/amd64: export OS = windows
|
||||
windows/amd64: export ARCH = amd64
|
||||
windows/amd64:
|
||||
@echo "building web binary (OS = $(OS), ARCH = $(ARCH))"
|
||||
xgo -v --targets="$(OS)/$(ARCH)" -ldflags "-extldflags=-static -X main.goos=$(OS) -X main.goarch=$(ARCH)" -out scrutiny-web -tags "static netgo sqlite_omit_load_extension" ${GO_WORKSPACE}/webapp/backend/cmd/scrutiny/
|
||||
|
||||
@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-*
|
||||
@@ -47,7 +47,7 @@ Scrutiny is a simple but focused application, with a couple of core features:
|
||||
- Customized thresholds using real world failure rates
|
||||
- Temperature tracking
|
||||
- Provided as an all-in-one Docker image (but can be installed manually)
|
||||
- (Future) Configurable Alerting/Notifications via Webhooks
|
||||
- Future Configurable Alerting/Notifications via Webhooks
|
||||
- (Future) Hard Drive performance testing & tracking
|
||||
|
||||
# Getting Started
|
||||
@@ -119,18 +119,25 @@ See [docs/INSTALL_MANUAL.md](docs/INSTALL_MANUAL.md) for instructions.
|
||||
|
||||
Once scrutiny is running, you can open your browser to `http://localhost:8080` and take a look at the dashboard.
|
||||
|
||||
Initially it will be empty, however after the first collector run, you'll be greeted with a list of all your hard drives and their current smart status.
|
||||
If you're using the omnibus image, the collector should already have run, and your dashboard should be populate with every
|
||||
drive that Scrutiny detected. The collector is configured to run once a day, but you can trigger it manually by running the command below.
|
||||
|
||||
The collector is configured to run once a day, but you can trigger it manually by running the following command
|
||||
For users of the docker Hub/Spoke deployment or manual install: initially the dashboard will be empty.
|
||||
After the first collector run, you'll be greeted with a list of all your hard drives and their current smart status.
|
||||
|
||||
```
|
||||
docker exec scrutiny /scrutiny/bin/scrutiny-collector-metrics run
|
||||
```
|
||||
|
||||
# Configuration
|
||||
We support a global YAML configuration file that must be located at `/scrutiny/config/scrutiny.yaml`
|
||||
By default Scrutiny looks for its YAML configuration files in `/scrutiny/config`
|
||||
|
||||
Check the [example.scrutiny.yml](example.scrutiny.yaml) file for a fully commented version.
|
||||
There are two configuration files available:
|
||||
|
||||
- Webapp/API config via `scrutiny.yaml` - [example.scrutiny.yaml](example.scrutiny.yaml).
|
||||
- Collector config via `collector.yaml` - [example.collector.yaml](example.collector.yaml).
|
||||
|
||||
Neither file is required, however if provided, it allows you to configure how Scrutiny functions.
|
||||
|
||||
## Notifications
|
||||
|
||||
|
||||
@@ -161,9 +161,10 @@ OPTIONS:
|
||||
EnvVars: []string{"COLLECTOR_DEBUG", "DEBUG"},
|
||||
},
|
||||
|
||||
&cli.BoolFlag{
|
||||
&cli.StringFlag{
|
||||
Name: "host-id",
|
||||
Usage: "Host identifier/label, used for grouping devices",
|
||||
Value: "",
|
||||
EnvVars: []string{"COLLECTOR_HOST_ID"},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -92,7 +92,7 @@ func (d *Detect) wwnFallback(detectedDevice *models.Device) {
|
||||
block, err := ghw.Block()
|
||||
if err == nil {
|
||||
for _, disk := range block.Disks {
|
||||
if disk.Name == detectedDevice.DeviceName {
|
||||
if disk.Name == detectedDevice.DeviceName && strings.ToLower(disk.WWN) != "unknown" {
|
||||
d.Logger.Debugf("Found matching block device. WWN: %s", disk.WWN)
|
||||
detectedDevice.WWN = disk.WWN
|
||||
break
|
||||
|
||||
@@ -30,7 +30,7 @@ func (d *Detect) wwnFallback(detectedDevice *models.Device) {
|
||||
block, err := ghw.Block()
|
||||
if err == nil {
|
||||
for _, disk := range block.Disks {
|
||||
if disk.Name == detectedDevice.DeviceName {
|
||||
if disk.Name == detectedDevice.DeviceName && strings.ToLower(disk.WWN) != "unknown" {
|
||||
d.Logger.Debugf("Found matching block device. WWN: %s", disk.WWN)
|
||||
detectedDevice.WWN = disk.WWN
|
||||
break
|
||||
|
||||
@@ -30,7 +30,7 @@ func (d *Detect) wwnFallback(detectedDevice *models.Device) {
|
||||
block, err := ghw.Block()
|
||||
if err == nil {
|
||||
for _, disk := range block.Disks {
|
||||
if disk.Name == detectedDevice.DeviceName {
|
||||
if disk.Name == detectedDevice.DeviceName && strings.ToLower(disk.WWN) != "unknown" {
|
||||
d.Logger.Debugf("Found matching block device. WWN: %s", disk.WWN)
|
||||
detectedDevice.WWN = disk.WWN
|
||||
break
|
||||
|
||||
+5
-2
@@ -34,7 +34,7 @@ ENV PATH="/scrutiny/bin:${PATH}"
|
||||
ADD https://github.com/dshearer/jobber/releases/download/v1.4.4/jobber_1.4.4-1_amd64.deb /tmp/
|
||||
RUN apt install /tmp/jobber_1.4.4-1_amd64.deb
|
||||
|
||||
RUN apt-get update && apt-get install -y smartmontools=7.0-0ubuntu1~ubuntu18.04.1 ca-certificates && update-ca-certificates
|
||||
RUN apt-get update && apt-get install -y smartmontools=7.0-0ubuntu1~ubuntu18.04.1 ca-certificates curl && update-ca-certificates
|
||||
|
||||
ADD https://github.com/just-containers/s6-overlay/releases/download/v1.21.8.0/s6-overlay-amd64.tar.gz /tmp/
|
||||
RUN tar xzf /tmp/s6-overlay-amd64.tar.gz -C /
|
||||
@@ -49,6 +49,9 @@ RUN chmod +x /scrutiny/bin/scrutiny && \
|
||||
chmod +x /scrutiny/bin/scrutiny-collector-metrics && \
|
||||
mkdir -p /scrutiny/web && \
|
||||
mkdir -p /scrutiny/config && \
|
||||
mkdir -p /scrutiny/jobber
|
||||
mkdir -p /scrutiny/jobber && \
|
||||
chmod -R ugo+rwx /scrutiny/config && \
|
||||
chmod -R ugo+rwx /scrutiny/jobber
|
||||
|
||||
|
||||
CMD ["/init"]
|
||||
|
||||
@@ -29,9 +29,12 @@ EXPOSE 8080
|
||||
WORKDIR /scrutiny
|
||||
ENV PATH="/scrutiny/bin:${PATH}"
|
||||
|
||||
RUN apt-get update && apt-get install -y ca-certificates curl && update-ca-certificates
|
||||
|
||||
COPY --from=backendbuild /go/src/github.com/analogj/scrutiny/scrutiny /scrutiny/bin/
|
||||
COPY --from=frontendbuild /scrutiny/dist /scrutiny/web
|
||||
RUN chmod +x /scrutiny/bin/scrutiny && \
|
||||
mkdir -p /scrutiny/web && \
|
||||
mkdir -p /scrutiny/config
|
||||
mkdir -p /scrutiny/config && \
|
||||
chmod -R ugo+rwx /scrutiny/config
|
||||
CMD ["/scrutiny/bin/scrutiny", "start"]
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
FROM karalabe/xgo-1.13.x
|
||||
|
||||
WORKDIR /go/src/github.com/analogj/scrutiny
|
||||
|
||||
COPY . /go/src/github.com/analogj/scrutiny
|
||||
|
||||
RUN make all
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
Vagrant.configure("2") do |config|
|
||||
config.vm.guest = :freebsd
|
||||
config.vm.synced_folder ".", "/vagrant", id: "vagrant-root", disabled: true
|
||||
config.vm.box = "freebsd/FreeBSD-11.0-CURRENT"
|
||||
config.ssh.shell = "sh"
|
||||
config.vm.base_mac = "080027D14C66"
|
||||
|
||||
config.vm.provider :virtualbox do |vb|
|
||||
vb.customize ["modifyvm", :id, "--memory", "1024"]
|
||||
vb.customize ["modifyvm", :id, "--cpus", "1"]
|
||||
vb.customize ["modifyvm", :id, "--hwvirtex", "on"]
|
||||
vb.customize ["modifyvm", :id, "--audio", "none"]
|
||||
vb.customize ["modifyvm", :id, "--nictype1", "virtio"]
|
||||
vb.customize ["modifyvm", :id, "--nictype2", "virtio"]
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,32 @@
|
||||
# UnRAID Install
|
||||
|
||||
Installation of Scrutiny in UnRAID follows the same process as installing any other docker container, utilizing the Community Applications plugin
|
||||
|
||||
## Install the 'Community Applications' Plugin
|
||||
|
||||
All docker containers in UnRAID are typically installed utilizing the Community Applications plugin. To get started:
|
||||
- Navigate to the plugins tab ( <UnRaid_IP_Address>/Plugins )
|
||||
- Select the 'Install Plugin' tab, and enter the following address into the input field
|
||||
```
|
||||
https://raw.githubusercontent.com/Squidly271/community.applications/master/plugins/community.applications.plg
|
||||
```
|
||||
|
||||
You're all set with the pre-requisites!
|
||||
|
||||
## Installing the Scrutiny docker image
|
||||
|
||||
To install, simply click 'Install'; the configuration parameters should not need modification as the template within CA already defines the necessary parameters.
|
||||
|
||||
As a docker image can be created using various OS bases, the image choice is entirely the users choice. Recommendations of a specific image from a specific maintainer is beyond the scope of this guide. However, to provide some context given the number of questions posed regarding the various versions available:
|
||||
|
||||
- **analogj/scrutiny**
|
||||
- `Image maintained directly by the application author`
|
||||
- `Debian based docker image`
|
||||
- **linuxserver/scrutiny:**
|
||||
- `Image maintained by the LinuxServer.io group`
|
||||
- `Alpine based docker image`
|
||||
- **hotio/scrutiny:**
|
||||
- `Image maintained by hotio`
|
||||
- `DETAILS TBD`
|
||||
|
||||
The support for a given image is provided by that images maintainers, while support for the application itself remains with the developer - i.e. LinuxServer.io supports the docker image of Scrutiny which they create, to the extent an issue is specific to that image. If an issue/enhancement pertains directly to the source code, support would still come directly from this repository's contributors.
|
||||
@@ -4,7 +4,7 @@ These are the officially supported NAS OS's (with documentation and setup guides
|
||||
Once a guide is created (in `docs/guides/`) it will be linked here.
|
||||
|
||||
- [ ] freenas/truenas
|
||||
- [ ] unraid
|
||||
- [x] [unraid](https://github.com/AnalogJ/scrutiny/blob/master/docs/INSTALL_UNRAID.md)
|
||||
- [ ] ESXI
|
||||
- [ ] Proxmox
|
||||
- [ ] Synology
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/with-contenv bash
|
||||
|
||||
echo "waiting for scrutiny service to start"
|
||||
s6-svwait -u /var/run/s6/services/scrutiny
|
||||
|
||||
#tell s6 to only run this script once
|
||||
s6-svc -O /var/run/s6/services/collector-once
|
||||
|
||||
# wait until scrutiny is "Ready"
|
||||
while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://localhost:8080/api/health)" != "200" ]]; do sleep 5; done
|
||||
|
||||
|
||||
echo "starting scrutiny collector"
|
||||
/scrutiny/bin/scrutiny-collector-metrics run
|
||||
@@ -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.0"
|
||||
const VERSION = "0.3.2"
|
||||
|
||||
@@ -237,6 +237,30 @@ func TestSendTestNotificationRoute_ScriptFailure(t *testing.T) {
|
||||
require.Equal(t, 500, wr.Code)
|
||||
}
|
||||
|
||||
func TestSendTestNotificationRoute_ScriptSuccess(t *testing.T) {
|
||||
//setup
|
||||
parentPath, _ := ioutil.TempDir("", "")
|
||||
defer os.RemoveAll(parentPath)
|
||||
mockCtrl := gomock.NewController(t)
|
||||
defer mockCtrl.Finish()
|
||||
fakeConfig := mock_config.NewMockInterface(mockCtrl)
|
||||
fakeConfig.EXPECT().GetString("web.database.location").AnyTimes().Return(path.Join(parentPath, "scrutiny_test.db"))
|
||||
fakeConfig.EXPECT().GetString("web.src.frontend.path").AnyTimes().Return(parentPath)
|
||||
fakeConfig.EXPECT().GetStringSlice("notify.urls").AnyTimes().Return([]string{"script:///usr/bin/env"})
|
||||
ae := web.AppEngine{
|
||||
Config: fakeConfig,
|
||||
}
|
||||
router := ae.Setup(logrus.New())
|
||||
|
||||
//test
|
||||
wr := httptest.NewRecorder()
|
||||
req, _ := http.NewRequest("POST", "/api/health/notify", strings.NewReader("{}"))
|
||||
router.ServeHTTP(wr, req)
|
||||
|
||||
//assert
|
||||
require.Equal(t, 200, wr.Code)
|
||||
}
|
||||
|
||||
func TestSendTestNotificationRoute_ShoutrrrFailure(t *testing.T) {
|
||||
//setup
|
||||
parentPath, _ := ioutil.TempDir("", "")
|
||||
|
||||
Generated
+10
@@ -1922,6 +1922,11 @@
|
||||
"integrity": "sha512-pGF/zvYOACZ/gLGWdQH8zSwteQS1epp68yRcVLJMgUck/MjEn/FBYmPub9pXT8C1e4a8YZfHo1CKyV8q1vKUnQ==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/humanize-duration": {
|
||||
"version": "3.18.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/humanize-duration/-/humanize-duration-3.18.1.tgz",
|
||||
"integrity": "sha512-MUgbY3CF7hg/a/jogixmAufLjJBQT7WEf8Q+kYJkOc47ytngg1IuZobCngdTjAgY83JWEogippge5O5fplaQlw=="
|
||||
},
|
||||
"@types/jasmine": {
|
||||
"version": "3.5.10",
|
||||
"resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-3.5.10.tgz",
|
||||
@@ -6064,6 +6069,11 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"humanize-duration": {
|
||||
"version": "3.24.0",
|
||||
"resolved": "https://registry.npmjs.org/humanize-duration/-/humanize-duration-3.24.0.tgz",
|
||||
"integrity": "sha512-B3udnqisaDeRsvUSb+5n2hjxhABI9jotB+i1IEhgHhguTeM5LxIUKoVIu7UpeyaPOygr/Fnv7UhOi45kYYG+tg=="
|
||||
},
|
||||
"humanize-ms": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz",
|
||||
|
||||
@@ -39,9 +39,11 @@
|
||||
"@fullcalendar/moment": "4.4.0",
|
||||
"@fullcalendar/rrule": "4.4.0",
|
||||
"@fullcalendar/timegrid": "4.4.0",
|
||||
"@types/humanize-duration": "^3.18.1",
|
||||
"apexcharts": "3.19.0",
|
||||
"crypto-js": "3.3.0",
|
||||
"highlight.js": "10.0.1",
|
||||
"humanize-duration": "^3.24.0",
|
||||
"lodash": "4.17.15",
|
||||
"moment": "2.24.0",
|
||||
"ng-apexcharts": "1.2.3",
|
||||
|
||||
@@ -9,6 +9,7 @@ export const sda = {
|
||||
"model_name": "Samsung_SSD_860_EVO_500GB",
|
||||
"interface_type": "SCSI",
|
||||
"interface_speed": "",
|
||||
"host_id": "NAS",
|
||||
"serial_number": "S3YZNB0KBXXXXXX",
|
||||
"firmware": "002C",
|
||||
"rotational_speed": 0,
|
||||
|
||||
@@ -9,6 +9,7 @@ export const sdc = {
|
||||
"model_name": "WDC_WD140EDFZ-11A0VA0",
|
||||
"interface_type": "SCSI",
|
||||
"interface_speed": "1.5 Gb/s",
|
||||
"host_id": "NAS",
|
||||
"serial_number": "9RK4XXXXX",
|
||||
"firmware": "MS1OA650",
|
||||
"rotational_speed": 7200,
|
||||
|
||||
@@ -11,6 +11,7 @@ export const summary = {
|
||||
"manufacturer": "ATA",
|
||||
"model_name": "Samsung_SSD_860_EVO_500GB",
|
||||
"interface_type": "SCSI",
|
||||
"host_id": "NAS",
|
||||
"interface_speed": "",
|
||||
"serial_number": "S3YZNB0KBXXXXXX",
|
||||
"firmware": "002C",
|
||||
@@ -386,6 +387,7 @@ export const summary = {
|
||||
"model_name": "WDC_WD140EDFZ-11A0VA0",
|
||||
"interface_type": "SCSI",
|
||||
"interface_speed": "1.5 Gb/s",
|
||||
"host_id": "NAS",
|
||||
"serial_number": "9RK4XXXXX",
|
||||
"firmware": "MS1OA650",
|
||||
"rotational_speed": 7200,
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
class="font-bold text-md text-secondary uppercase tracking-wider">{{deviceTitle(disk)}}</a>
|
||||
<div [ngClass]="{'text-green': disk.smart_results[0]?.smart_status == 'passed',
|
||||
'text-red': disk.smart_results[0]?.smart_status == 'failed' }" class="font-medium text-sm" *ngIf="disk.smart_results[0]">
|
||||
Last Updated on {{disk.smart_results[0]?.date | date:'MMMM dd, yyyy' }}
|
||||
Last Updated on {{disk.smart_results[0]?.date | date:'MMMM dd, yyyy - HH:mm' }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="ml-auto" *ngIf="disk.smart_results">
|
||||
@@ -105,7 +105,8 @@
|
||||
</div>
|
||||
<div class="flex flex-col mx-6 my-3 xs:w-full">
|
||||
<div class="font-semibold text-xs text-hint uppercase tracking-wider leading-none">Powered On</div>
|
||||
<div class="mt-2 font-medium text-3xl leading-none">{{ humanizeHours(disk.smart_results[0]?.power_on_hours) }}</div>
|
||||
<div class="mt-2 font-medium text-3xl leading-none" *ngIf="disk.smart_results[0]?.power_on_hours; else unknownPoweredOn">{{ humanizeDuration(disk.smart_results[0]?.power_on_hours * 60 * 60 * 1000, { round: true, largest: 1, units: ['y', 'd', 'h'] }) }}</div>
|
||||
<ng-template #unknownPoweredOn><div class="mt-2 font-medium text-3xl leading-none">--</div></ng-template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -8,6 +8,7 @@ import { DashboardService } from 'app/modules/dashboard/dashboard.service';
|
||||
import * as moment from "moment";
|
||||
import {MatDialog} from '@angular/material/dialog';
|
||||
import { DashboardSettingsComponent } from 'app/layout/common/dashboard-settings/dashboard-settings.component';
|
||||
import humanizeDuration from 'humanize-duration'
|
||||
|
||||
@Component({
|
||||
selector : 'example',
|
||||
@@ -165,11 +166,18 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy
|
||||
}
|
||||
|
||||
deviceTitle(disk){
|
||||
var title = [`/dev/${disk.device_name}`]
|
||||
let title = []
|
||||
|
||||
if (disk.host_id) title.push(disk.host_id)
|
||||
|
||||
title.push(`/dev/${disk.device_name}`)
|
||||
|
||||
if (disk.device_type && disk.device_type != 'scsi' && disk.device_type != 'ata'){
|
||||
title.push(disk.device_type)
|
||||
}
|
||||
|
||||
title.push(disk.model_name)
|
||||
|
||||
return title.join(' - ')
|
||||
}
|
||||
|
||||
@@ -184,23 +192,6 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy
|
||||
return item.id || index;
|
||||
}
|
||||
|
||||
humanizeHours(hours: number): string {
|
||||
if(!hours){
|
||||
return '--'
|
||||
}
|
||||
readonly humanizeDuration = humanizeDuration;
|
||||
|
||||
var value: number
|
||||
let unit = ""
|
||||
if(hours > (24*365)){ //more than a year
|
||||
value = Math.round((hours/(24*365)) * 10)/10
|
||||
unit = "years"
|
||||
} else if (hours > 24){
|
||||
value = Math.round((hours/24) *10 )/10
|
||||
unit = "days"
|
||||
} else{
|
||||
value = hours
|
||||
unit = "hours"
|
||||
}
|
||||
return `${value} ${unit}`
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,8 +56,12 @@
|
||||
<div class="text-2xl font-semibold leading-tight">/dev/{{data.data.device_name}}</div>
|
||||
</div>
|
||||
<div class="flex flex-col my-2 grid grid-cols-2">
|
||||
<div *ngIf="data.data.host_id" class="my-2 col-span-2 lt-md:col-span-1">
|
||||
<div>{{data.data.host_id}}</div>
|
||||
<div class="text-secondary text-md">Host ID</div>
|
||||
</div>
|
||||
<div *ngIf="data.data.device_type && data.data.device_type != 'ata' && data.data.device_type != 'scsi'" class="my-2 col-span-2 lt-md:col-span-1">
|
||||
<div>{{data.data.device_type}}</div>
|
||||
<div>{{data.data.device_type | uppercase}}</div>
|
||||
<div class="text-secondary text-md">Device Type</div>
|
||||
</div>
|
||||
<div *ngIf="data.data.manufacturer" class="my-2 col-span-2 lt-md:col-span-1">
|
||||
@@ -96,8 +100,8 @@
|
||||
<div>{{data.data.smart_results[0]?.power_cycle_count}}</div>
|
||||
<div class="text-secondary text-md">Power Cycle Count</div>
|
||||
</div>
|
||||
<div class="my-2 col-span-2 lt-md:col-span-1">
|
||||
<div matTooltip="{{data.data.smart_results[0]?.power_on_hours}} hours">{{humanizeHours(data.data.smart_results[0]?.power_on_hours)}}</div>
|
||||
<div *ngIf="data.data.smart_results[0]?.power_on_hours" class="my-2 col-span-2 lt-md:col-span-1">
|
||||
<div matTooltip="{{humanizeDuration(data.data.smart_results[0]?.power_on_hours * 60 * 60 * 1000, { conjunction: ' and ', serialComma: false })}}">{{humanizeDuration(data.data.smart_results[0]?.power_on_hours *60 * 60 * 1000, { round: true, largest: 1, units: ['y', 'd', 'h'] })}}</div>
|
||||
<div class="text-secondary text-md">Powered On</div>
|
||||
</div>
|
||||
<div class="my-2 col-span-2 lt-md:col-span-1">
|
||||
|
||||
@@ -8,6 +8,7 @@ import {takeUntil} from "rxjs/operators";
|
||||
import {fadeOut} from "../../../@treo/animations/fade";
|
||||
import {DetailSettingsComponent} from "app/layout/common/detail-settings/detail-settings.component";
|
||||
import {MatDialog} from "@angular/material/dialog";
|
||||
import humanizeDuration from 'humanize-duration';
|
||||
|
||||
@Component({
|
||||
selector: 'detail',
|
||||
@@ -320,23 +321,6 @@ export class DetailComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
// return item.id || index;
|
||||
}
|
||||
|
||||
humanizeHours(hours: number): string {
|
||||
if(!hours){
|
||||
return '--'
|
||||
}
|
||||
readonly humanizeDuration = humanizeDuration;
|
||||
|
||||
var value: number
|
||||
let unit = ""
|
||||
if(hours > (24*365)){ //more than a year
|
||||
value = Math.round((hours/(24*365)) * 10)/10
|
||||
unit = "years"
|
||||
} else if (hours > 24){
|
||||
value = Math.round((hours/24) *10 )/10
|
||||
unit = "days"
|
||||
} else{
|
||||
value = hours
|
||||
unit = "hours"
|
||||
}
|
||||
return `${value} ${unit}`
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user