Merge pull request #44 from AnalogJHQ/notify

Notify
pull/1/head
Jason Kulatunga 4 years ago committed by GitHub
commit 390ac1d0a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,6 +1,6 @@
name: CI
# This workflow is triggered on pushes to the repository.
on: [push]
on: [push, pull_request]
jobs:
build:

@ -0,0 +1,117 @@
name: Release
# This workflow is triggered manually
on:
workflow_dispatch:
inputs:
version_bump_type:
description: 'Version Bump Type (major, minor, patch)'
required: true
default: 'patch'
version_metadata_path:
description: 'Path to file containing Version string'
required: true
default: 'webapp/backend/pkg/version/version.go'
jobs:
build:
name: Build
runs-on: ubuntu-latest
container: golang:1.13
env:
PROJECT_PATH: /go/src/github.com/analogj/scrutiny
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Bump version
id: bump_version
uses: packagrio/action-bumpr-go@master
with:
version_bump_type: ${{ github.event.inputs.version_bump_type }}
version_metadata_path: ${{ github.event.inputs.version_metadata_path }}
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Build
env:
GOOS: linux
GOARCH: amd64
run: |
mkdir -p $PROJECT_PATH
cp -a $GITHUB_WORKSPACE/. $PROJECT_PATH/
cd $PROJECT_PATH
go mod vendor
go test -v -tags "static" $(go list ./... | grep -v /vendor/)
go build -ldflags "-X main.goos=linux -X main.goarch=amd64" -o scrutiny-web-linux-amd64 -tags "static" webapp/backend/cmd/scrutiny/scrutiny.go
go build -ldflags "-X main.goos=linux -X main.goarch=amd64" -o scrutiny-collector-metrics-linux-amd64 -tags "static" collector/cmd/collector-metrics/collector-metrics.go
chmod +x scrutiny-web-linux-amd64
chmod +x scrutiny-collector-metrics-linux-amd64
- name: Commit
uses: EndBug/add-and-commit@v4 # You can change this to use a specific version
with:
author_name: Jason Kulatunga
author_email: jason@thesparktree.com
cwd: ${{ env.PROJECT_PATH }}
force: false
signoff: true
message: '(${{steps.bump_version.outputs.release_version}}) Automated packaging of release by Packagr'
tag: ${{steps.bump_version.outputs.release_version}}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this line unchanged
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.bump_version.outputs.release_version }}
release_name: Release ${{ steps.bump_version.outputs.release_version }}
draft: false
prerelease: false
- name: Upload Web Backend Release Asset
id: upload-release-asset1
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.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_name: scrutiny-web-linux-amd64
asset_content_type: application/octet-stream
- name: Upload Collector Release Asset
id: upload-release-asset2
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.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_name: scrutiny-collector-metrics-linux-amd64
asset_content_type: application/octet-stream
# build-docker:
# needs: build
# name: Build Docker
# runs-on: ubuntu-latest
# container: docker:19.03.2
# steps:
# - name: Checkout
# uses: actions/checkout@v2
- name: Build Docker
run: |
cd $PROJECT_PATH
docker build -t analogj/scrutiny:latest -t analogj/scrutiny:${{ steps.bump_version.outputs.release_version }} .
docker save -o docker-analogj-scrutiny-${{ steps.bump_version.outputs.release_version }}.tar analogj/scrutiny
- name: Upload Collector Release Asset
id: upload-release-asset3
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.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: docker-analogj-scrutiny-${{ steps.bump_version.outputs.release_version }}.tar
asset_name: docker-analogj-scrutiny-${{ steps.bump_version.outputs.release_version }}.tar
asset_content_type: application/octet-stream

@ -34,13 +34,23 @@ disks:
# - /dev/sdb
notify:
metric:
script: 'notify-metrics.sh'
long:
script: 'notify-long-test.sh'
short:
script: 'notify-short-test.sh'
level: 'warn' # 'warn' or 'error'
urls:
- "discord://token@channel"
- "telegram://token@telegram?channels=channel-1[,channel-2,...]"
- "pushover://shoutrrr:apiToken@userKey/?devices=device1[,device2, ...]"
- "slack://[botname@]token-a/token-b/token-c"
- "smtp://username:password@host:port/?fromAddress=fromAddress&toAddresses=recipient1[,recipient2,...]"
- "teams://token-a/token-b/token-c"
- "gotify://gotify-host/token"
- "pushbullet://api-token[/device/#channel/email]"
- "ifttt://key/?events=event1[,event2,...]&value1=value1&value2=value2&value3=value3"
- "mattermost://[username@]mattermost-host/token[/channel]"
- "hangouts://chat.googleapis.com/v1/spaces/FOO/messages?key=bar&token=baz"
- "zulip://bot-mail:bot-key@zulip-domain/?stream=name-or-id&topic=name"
- "join://shoutrrr:api-key@join/?devices=device1[,device2, ...][&icon=icon][&title=title]"
- "script:///file/path/on/disk"
- "https://www.example.com/path"
collect:
metric:

@ -85,7 +85,7 @@ func (sm *Smart) ProcessNvmeSmartInfo(info collector.SmartInfo) {
{AttributeId: "critical_warning", Name: "Critical Warning", Value: info.NvmeSmartHealthInformationLog.CriticalWarning},
{AttributeId: "temperature", Name: "Temperature", Value: info.NvmeSmartHealthInformationLog.Temperature},
{AttributeId: "available_spare", Name: "Available Spare", Value: info.NvmeSmartHealthInformationLog.AvailableSpare, Threshold: info.NvmeSmartHealthInformationLog.AvailableSpareThreshold},
{AttributeId: "percentage_used", Name: "Percentage Used", Value: info.NvmeSmartHealthInformationLog.PercentageUsed},
{AttributeId: "percentage_used", Name: "Percentage Used", Value: info.NvmeSmartHealthInformationLog.PercentageUsed, Threshold: 100},
{AttributeId: "data_units_read", Name: "Data Units Read", Value: info.NvmeSmartHealthInformationLog.DataUnitsRead},
{AttributeId: "data_units_written", Name: "Data Units Written", Value: info.NvmeSmartHealthInformationLog.DataUnitsWritten},
{AttributeId: "host_reads", Name: "Host Reads", Value: info.NvmeSmartHealthInformationLog.HostReads},

Loading…
Cancel
Save