merge upstream/dev - catch up with workflow changes

(there were some merge conflicts in ./Dockerfile and ./Makefile - let's just hope I got them right)
pull/1118/head
Willy 2021-10-02 16:33:39 +02:00
commit db49c6588f
No known key found for this signature in database
GPG Key ID: 02E60AE5D9208602
27 changed files with 630 additions and 220 deletions

View File

@ -63,9 +63,13 @@ jobs:
arch: [386, amd64, arm-7, arm-6, arm64]
include:
- platform: darwin
arch: [386, amd64]
arch: 386
- platform: darwin
arch: amd64
- platform: windows
arch: [386, amd64]
arch: 386
- platform: windows
arch: amd64
steps:
- uses: actions/checkout@v2
@ -129,7 +133,7 @@ jobs:
rm -rf statping
echo "compressed=statping-linux-${{ matrix.arch }}.tar.gz" >> $GITHUB_ENV
- name: Compress Windows ${{matrix.arch}} Builds
- name: Compress Windows Builds
if: matrix.platform == 'windows'
run: |
cd build
@ -139,8 +143,19 @@ jobs:
rm -rf statping.exe
echo "compressed=statping-windows-${{ matrix.arch }}.zip" >> $GITHUB_ENV
- name: Compress Darwin ${{matrix.arch}} Builds
if: matrix.platform == 'darwin'
- name: Compress Darwin 32bit Builds
if: matrix.platform == 'darwin' && matrix.arch == '386'
run: |
cd build
ls >> $GITHUB_ENV
# mv statping-darwin-10.6-${{ matrix.arch }} statping
# chmod +x statping
# tar -czvf statping-darwin-${{ matrix.arch }}.tar.gz *
# rm -rf statping
# echo "compressed=statping-darwin-${{ matrix.arch }}.tar.gz" >> $GITHUB_ENV
- name: Compress Darwin 64bit Builds
if: matrix.platform == 'darwin' && matrix.arch == 'amd64'
run: |
cd build
mv statping-darwin-10.12-${{ matrix.arch }} statping
@ -149,6 +164,22 @@ jobs:
rm -rf statping
echo "compressed=statping-darwin-${{ matrix.arch }}.tar.gz" >> $GITHUB_ENV
# - name: Compress Darwin arm64 Builds
# if: matrix.platform == 'darwin' && matrix.arch == 'arm64'
# run: |
# cd build
# mv statping-darwin-10.15-${{ matrix.arch }} statping
# chmod +x statping
# tar -czvf statping-darwin-${{ matrix.arch }}.tar.gz statping
# rm -rf statping
# echo "compressed=statping-darwin-${{ matrix.arch }}.tar.gz" >> $GITHUB_ENV
- name: Upload Compiled Statping Binary
uses: actions/upload-artifact@v1
with:
name: statping-${{ matrix.platform }}-${{ matrix.arch }}
path: ./build
test:
needs: frontend
runs-on: ubuntu-latest

View File

@ -2,7 +2,7 @@ name: 2. Unstable Build, Test and Deploy
on:
push:
branches:
- dev
- unstable
paths-ignore:
- '**.md'
@ -64,6 +64,8 @@ jobs:
include:
- platform: darwin
arch: amd64
- platform: windows
arch: 386
- platform: windows
arch: amd64
@ -455,14 +457,14 @@ jobs:
restore-keys: |
buildx-docker-master
- name: Docker Login
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
# - name: Docker Login
# env:
# DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
# DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
# run: echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin#
- name: Docker Build :base
run: make buildx-base
# - name: Docker Build :base
# run: make buildx-base
- name: Docker Login
env:

View File

@ -74,11 +74,13 @@ jobs:
matrix:
platform: [linux]
arch: [386, amd64, arm-7, arm-6, arm64]
# include:
# - platform: darwin
# arch: amd64
# - platform: windows
# arch: amd64
include:
- platform: darwin
arch: amd64
- platform: windows
arch: 386
- platform: windows
arch: amd64
steps:
- uses: actions/checkout@v2
@ -108,17 +110,17 @@ jobs:
echo "XGO_TAGS=netgo osusergo linux sqlite_omit_load_extension" >> $GITHUB_ENV
shell: bash
# - name: Set Darwin Build Flags
# if: matrix.platform == 'darwin'
# run: echo "XGO_TAGS=netgo osusergo darwin sqlite_omit_load_extension" >> $GITHUB_ENV
# shell: bash
- name: Set Darwin Build Flags
if: matrix.platform == 'darwin'
run: echo "XGO_TAGS=netgo osusergo darwin sqlite_omit_load_extension" >> $GITHUB_ENV
shell: bash
# - name: Set Windows Build Flags
# if: matrix.platform == 'windows'
# run: |
# echo "BUILD_FLAGS=-extldflags -static" >> $GITHUB_ENV
# echo "XGO_TAGS=netgo osusergo sqlite_omit_load_extension" >> $GITHUB_ENV
# shell: bash
- name: Set Windows Build Flags
if: matrix.platform == 'windows'
run: |
echo "BUILD_FLAGS=-extldflags -static -buildmode=exe" >> $GITHUB_ENV
echo "XGO_TAGS=netgo osusergo sqlite_omit_load_extension" >> $GITHUB_ENV
shell: bash
- name: Build ${{ matrix.platform }}/${{ matrix.arch }}
uses: crazy-max/ghaction-xgo@v1
@ -148,25 +150,25 @@ jobs:
rm -rf statping
echo "compressed=statping-linux-${{ matrix.arch }}.tar.gz" >> $GITHUB_ENV
# - name: Compress Windows Builds
# if: matrix.platform == 'windows'
# run: |
# cd build
# mv statping-windows-4.0-${{ matrix.arch }}.exe statping.exe
# chmod +x statping.exe
# zip statping-windows-${{ matrix.arch }}.zip statping.exe
# rm -rf statping.exe
# echo "compressed=statping-windows-${{ matrix.arch }}.zip" >> $GITHUB_ENV
- name: Compress Windows Builds
if: matrix.platform == 'windows'
run: |
cd build
mv statping-windows-4.0-${{ matrix.arch }}.exe statping.exe
chmod +x statping.exe
zip statping-windows-${{ matrix.arch }}.zip statping.exe
rm -rf statping.exe
echo "compressed=statping-windows-${{ matrix.arch }}.zip" >> $GITHUB_ENV
# - name: Compress Darwin Builds
# if: matrix.platform == 'darwin'
# run: |
# cd build
# mv statping-darwin-10.6-${{ matrix.arch }} statping
# chmod +x statping
# tar -czvf statping-darwin-${{ matrix.arch }}.tar.gz statping
# rm -rf statping
# echo "compressed=statping-darwin-${{ matrix.arch }}.tar.gz" >> $GITHUB_ENV
- name: Compress Darwin Builds
if: matrix.platform == 'darwin'
run: |
cd build
mv statping-darwin-10.12-${{ matrix.arch }} statping
chmod +x statping
tar -czvf statping-darwin-${{ matrix.arch }}.tar.gz statping
rm -rf statping
echo "compressed=statping-darwin-${{ matrix.arch }}.tar.gz" >> $GITHUB_ENV
- name: Upload Compiled Statping Binary
uses: actions/upload-artifact@v1
@ -477,14 +479,14 @@ jobs:
restore-keys: |
buildx-docker
- name: Docker Login
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
- name: Docker Build :base
run: make buildx-base
# - name: Docker Login
# env:
# DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
# DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
# run: echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin
#
# - name: Docker Build :base
# run: make buildx-base
- name: Docker Login
env:

View File

@ -1,6 +1,15 @@
# 0.90.78 (xx-xx-2021)
# 0.90.78 (09-15-2021)
- HTTP Webhooks accept multiple HTTP Headers
- Modified Telegram notifier to allow chat_ids
- New Notifier - Mattermost
- Updated German Language - Thanks Flofeld
- Czech Language - Thanks Fjuro
- Some minor branding Changes
- Moved some asset dependancies from assets.statping.com
- Fixed the (Ubuntu) Snap Store build script
- Retrospectively updated the Changelog
- [GITHUB] Fixed Windows/Mac autobuilds
- [GITHUB] Unstable container build
- [GITHUB] Triggers SNAP builds
# 0.90.77 (08-18-2021)

View File

@ -44,9 +44,9 @@ RUN chmod a+x statping && mv statping /go/bin/statping
# /root/sassc/bin/sassc - sass binary
# /statping - Vue frontend (from frontend)
ARG BUILDPLATFORM
# Statping main Docker image that contains all required libraries
FROM alpine:latest
RUN apk --no-cache add libgcc libstdc++ ca-certificates curl jq && update-ca-certificates
COPY --from=backend /go/bin/statping /usr/local/bin/

View File

@ -272,16 +272,11 @@ download-key:
wget -O statping.gpg $(SIGN_URL)
gpg --import statping.gpg
# push the :dev docker tag using curl
dockerhub-dev:
docker build --build-arg VERSION=${VERSION} -t statping-ng/statping-ng:dev --no-cache -f Dockerfile .
docker push statping-ng/statping-ng:dev
dockerhub:
docker build --build-arg VERSION=${VERSION} -t statping-ng/statping-ng:latest --no-cache -f Dockerfile .
docker tag statping-ng/statping-ng statping-ng/statping-ng:v${VERSION}
docker push statping-ng/statping-ng:v${VERSION}
docker push statping-ng/statping-ng
docker build --build-arg VERSION=${VERSION} -t adamboutcher/statping-ng:latest --no-cache -f Dockerfile .
docker tag adamboutcher/statping-ng adamboutcher/statping-ng:v${VERSION}
docker push adamboutcher/statping-ng:v${VERSION}
docker push adamboutcher/statping-ng
docker-build-dev:
docker build --build-arg VERSION=${VERSION} -t statping-ng/statping-ng:latest --no-cache -f Dockerfile .

208
README.md
View File

@ -1,112 +1,152 @@
<p align="center">
<img width="60%" src="https://raw.githubusercontent.com/statping-ng/statping-ng/dev/frontend/public/img/banner.png">
<h1 align="center" style="text-align:center">
<img alt="Statping-ng" src="https://raw.githubusercontent.com/statping-ng/statping-ng/dev/frontend/public/img/banner.png" width="60%" style="width:60%"/>
</h1>
<p align="center" style="text-align:center">
<strong>Statping-ng</strong> - <em>Web and App Status Monitoring for Any Type of Project</em>
</p>
<p align="center">
<b>Statping-ng - Web and App Status Monitoring for Any Type of Project</b><br>
<a href="https://statping-ng.github.io">Website</a> | <a href="https://github.com/statping-ng/statping-ng/wiki">View Wiki</a> | <a href="http://docs.statping.com">API</a>
<p align="center" style="text-align:center">
<a href="https://statping-ng.github.io" >Website</a> |
<a href="https://github.com/statping-ng/statping-ng/wiki" >Wiki</a>
<br/>
<a href="https://github.com/statping-ng/statping-ng/wiki/Docker">Docker</a> | <a href="https://github.com/statping-ng/statping-ng/wiki/Linux">Linux</a> | <a href="https://github.com/statping-ng/statping-ng/wiki/Mac">Mac</a> | <a href="https://github.com/statping-ng/statping-ng/wiki/Windows">Windows</a>
<a href="https://github.com/statping-ng/statping-ng/wiki/Linux" >Linux</a> |
<a href="https://github.com/statping-ng/statping-ng/wiki/Windows" >Windows</a> |
<a href="https://github.com/statping-ng/statping-ng/wiki/Mac" >Mac</a> |
<a href="https://github.com/statping-ng/statping-ng/wiki/Docker" >Containers</a>
</p>
# Statping-ng - Status Page & Monitoring Server
An easy to use Status Page for your websites and applications. Statping will automatically fetch the application and render a beautiful status page with tons of features for you to build an even better status page. This Status Page generator allows you to use MySQL, Postgres, or SQLite on multiple operating systems.
<h2> Statping-ng - <em>Status Page & Monitoring Server</em></h2>
<p>An easy to use Status Page for your websites and applications. Statping will automatically fetch the application and render a beautiful status page with tons of features for you to build an even better status page. This Status Page generator allows you to use MySQL, Postgres, or SQLite on multiple operating systems.
</p><p>
Statping-ng aims to be an updated drop-in replacement of statping after development stopped on the original fork.
![GitHub license](https://img.shields.io/github/license/statping-ng/statping-ng?color=green&style=for-the-badge) ![GitHub last commit](https://img.shields.io/github/last-commit/statping-ng/statping-ng?style=for-the-badge) ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/statping-ng/statping-ng/2.%20Unstable%20Build,%20Test%20and%20Deploy?label=Dev%20Build&style=for-the-badge) ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/statping-ng/statping-ng/3.%20Stable%20Build,%20Test%20and%20Deploy?label=Stable%20Build&style=for-the-badge) ![Docker Pulls](https://img.shields.io/docker/pulls/adamboutcher/statping-ng?style=for-the-badge) ![Docker Image Size (tag)](https://img.shields.io/docker/image-size/adamboutcher/statping-ng/latest?style=for-the-badge)
<br><br>
<img align="left" width="320" height="235" src="https://img.cjx.io/statupsiterun.gif">
<h2>A Future-Proof Status Page</h2>
Statping-ng strives to remain future-proof and remain intact if a failure is created. Your Statping service should not be running on the same instance you're trying to monitor. If your server crashes your Status Page should still remaining online to notify your users of downtime.
<br><a href="https://labs.play-with-docker.com/?stack=https://raw.githubusercontent.com/statping-ng/statping-ng/stable/dev/pwd-stack.yml"><img height=25 src="https://assets.statping.com/docker-pwd.png"></a> (dashboard login is `admin`, password `admin`)
<br><br><br>
<h2>No Requirements</h2>
Statping-ng is built in Go Language so all you need is the precompile binary based on your operating system. You won't need to install anything extra once you have the Statping binary installed. You can even run Statping on a Raspberry Pi.
<br><br>
<p align="center">
<a href="https://github.com/statping-ng/statping-ng/wiki/Linux"><img width="5%" src="https://img.cjx.io/linux.png"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://github.com/statping-ng/statping-ng/wiki/Mac"><img width="5%" src="https://img.cjx.io/apple.png"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://github.com/statping-ng/statping-ng/wiki/Windows"><img width="5%" src="https://img.cjx.io/windows.png"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://play.google.com/store/apps/details?id=com.statping"><img width="5%" src="https://img.cjx.io/android.png"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://itunes.apple.com/us/app/apple-store/id1445513219"><img width="5%" src="https://img.cjx.io/appstore.png"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://hub.docker.com/r/statping/statping"><img width="5%" src="https://img.cjx.io/dockericon.png"></a>
<br><br></p>
<img align="right" width="320" height="235" src="https://gitimgs.s3-us-west-2.amazonaws.com/slack-notifer.png">
<h2>Lightweight and Fast</h2>
Statping-ng is a very lightweight application and is available for Linux, Mac, and Windows. The Docker image is only ~16Mb so you know that this application won't be filling up your hard drive space.
The Status binary for all other OS's is ~17Mb at most.
<br><br><br><br><br><br>
<img align="left" width="320" height="235" src="https://img.cjx.io/statping_iphone_bk.png">
<h2>Mobile App is Gorgeous</h2>
The Statping app is available on the App Store and Google Play for free. The app will allow you to view services, receive notifications when a service is offline, update groups, users, services, messages, and more! Start your own Statping-ng server and then connect it to the app by scanning the QR code in settings.
<p align="center">
<a href="https://play.google.com/store/apps/details?id=com.statping"><img src="https://img.cjx.io/google-play.svg"></a>
<a href="https://itunes.apple.com/us/app/apple-store/id1445513219"><img src="https://img.cjx.io/app-store-badge.svg"></a>
</p>
<br><br>
<p align="center" style="text-align:center">
<a href="https://github.com/statping-ng/statping-ng/blob/stable/LICENSE"><img alt="License" src="https://img.shields.io/github/license/statping-ng/statping-ng?color=success&style=for-the-badge&logo" /></a>
</p><p align="center" style="text-align:center">
<img alt="Last Commit" src="https://img.shields.io/github/last-commit/statping-ng/statping-ng?style=for-the-badge&logo=github" />
<img alt="Dev Build Status" src="https://img.shields.io/github/workflow/status/statping-ng/statping-ng/1.%20Development%20Build%20and%20Testing?label=Dev&style=for-the-badge&logo=github" />
<img alt="Unstable Build Status" src="https://img.shields.io/github/workflow/status/statping-ng/statping-ng/2.%20Unstable%20Build,%20Test%20and%20Deploy?label=Unstable&style=for-the-badge&logo=github" />
<img alt="Stable Build Status" src="https://img.shields.io/github/workflow/status/statping-ng/statping-ng/3.%20Stable%20Build,%20Test%20and%20Deploy?label=Stable&style=for-the-badge&logo=github" />
</p><p align="center" style="text-align:center">
<a href="https://hub.docker.com/r/adamboutcher/statping-ng"><img alt="Docker Pulls" src="https://img.shields.io/docker/pulls/adamboutcher/statping-ng?style=for-the-badge&logo=docker&logoColor=white" /></a>
<a href="https://hub.docker.com/r/adamboutcher/statping-ng"><img alt="Docker Image Size" src="https://img.shields.io/docker/image-size/adamboutcher/statping-ng/latest?style=for-the-badge&logo=docker&logoColor=white" /></a>
</p><p align="center" style="text-align:center">
<img alt="Go Version" src="https://img.shields.io/github/go-mod/go-version/statping-ng/statping-ng?style=for-the-badge" />
<a href="https://goreportcard.com/badge/github.com/statping-ng/statping-ng"><img alt="Go Report" src="https://goreportcard.com/badge/github.com/statping-ng/statping-ng?style=for-the-badge" /></a>
</p>
## Run on Any Server
Want to run it on your own Docker server? Awesome! Statping-ng has multiple docker-compose.yml files to work with. Statping-ng can automatically create a SSL Certification for your status page.
<br><br><br><br>
<hr/>
<h2 align="center" style="text-align:center">About Statping-ng</h2>
<img align="left" width="320" height="205" src="https://img.cjx.io/statping_theme.gif">
<h2>Custom SASS Styling</h2>
Statping-ng will allow you to completely customize your Status Page using SASS styling with easy to use variables. The Docker image actually contains a prebuilt SASS binary so you won't even need to setup anything!
<br><br><br><br>
<img style="margin-right:10px;float:left;width:320px;height:235px;" align="left" width="320" height="235" src="https://statping-ng.github.io/assets/external/statupsiterun.gif" />
<h3>A Future-Proof Status Page</h3>
<p>
Statping-ng strives to remain future-proof and remain intact if a failure is created. Your Statping-ng service should not be running on the same instance you're trying to monitor. If your server crashes your Status Page should still remaining online to notify your users of downtime.
</p>
<p>
<a href="https://labs.play-with-docker.com/?stack=https://raw.githubusercontent.com/statping-ng/statping-ng/stable/dev/pwd-stack.yml"><img alt="Try Statping-ng via Play with Docker" src="https://statping-ng.github.io/assets/external/docker-pwd.png" height="25px" style="height:25px" /></a> - Login is <kbd>admin</kbd>, password <kbd>admin</kbd>.
</p>
<div style="clear:both;"><br/><br/></div>
## Slack, Email, Twilio and more
Statping-ng includes email notification via SMTP and Slack integration using [Incoming Webhook](https://api.slack.com/incoming-webhooks). Insert the webhook URL into the Settings page in Statping-ng and enable the Slack integration. Anytime a service fails, the channel that you specified on Slack will receive a message.
<br><br><br><br>
<h2>User Created Notifiers</h2>
View the [Plugin Wiki](https://github.com/statping-ng/statping-ng/wiki/Statping-Plugins) to see detailed information about Golang Plugins. Statping-ng isn't just another Status Page for your applications, it's a framework that allows you to create your own plugins to interact with every element of your status page. [Notifier's](https://github.com/statping-ng/statping-ng/wiki/Notifiers) can also be create with only 1 golang file.
<br><br><br><br>
<h3>No Requirements - Run on Any Server</h3>
<p>
Statping-ng is built in Go Language so all you need is the pre-compiled binary based on your operating system. You won't need to install anything extra once you have the Statping binary installed. Windows, Linux or Mac, We compile to all the popular systems, including Raspberry Pi!
</p>
<p align="center" style="text-align:center">
<a href="https://github.com/statping-ng/statping-ng/wiki/Linux"><img alt="Linux" src="https://statping-ng.github.io/assets/external/linux.png" style="width:5%;margin-right:5px;" width=5% /></a>
<a href="https://github.com/statping-ng/statping-ng/wiki/Windows"><img alt="Windows" src="https://statping-ng.github.io/assets/external/windows.png" style="width:5%;margin-right:5px;" width=5% /></a>
<a href="https://github.com/statping-ng/statping-ng/wiki/Mac"><img alt="Apple Mac" src="https://statping-ng.github.io/assets/external/apple.png" style="width:5%;margin-right:5px;" width=5% /></a>
<a href="https://github.com/statping-ng/statping-ng/wiki/Docker"><img alt="Containers" src="https://statping-ng.github.io/assets/external/dockericon.png" style="width:5%;margin-right:5px;" width=5% /></a>
<a href="https://statping-ng.github.io/assets/external/android.png)](https://play.google.com/store/apps/details?id=com.statping"><img alt="Android Play Store" src="https://statping-ng.github.io/assets/external/android.png" style="width:5%;margin-right:5px;" width=5% /></a>
<a href="https://itunes.apple.com/us/app/apple-store/id1445513219"><img alt="Apple Apps Store" src="https://statping-ng.github.io/assets/external/appstore.png" style="width:5%;margin-right:5px;" width=5% /></a>
</p>
<br/>
<div style="clear:both;"><br/><br/></div>
<img align="center" width="100%" height="250" src="https://img.cjx.io/statupsc2.png">
<br><br><br><br>
<img style="margin-left:10px;float:right;width:320px;height:235px;" align="right" width="320" height="235" src="https://statping-ng.github.io/assets/external/slack-notifer.png" />
<h3>Lightweight and Fast</h3>
<p>
Statping-ng is a very lightweight application and is available for Linux, Mac, and Windows. The Docker image is only ~20Mb so you know that this application won't be filling up your hard drive space.
The Status binary for all other OS's is ~17Mb at most.
</p>
<div style="clear:both;"><br/><br/><br/></div>
<img align="right" width="320" height="235" src="https://img.cjx.io/statping_settings.gif">
<h3>Want easy containers?</h3>
<p>
No Worries, we provide docker containers for many different system architectures, with multiple docker-compose files to suit your needs, you can even bring your own SSL Certificate or automatically leverage <a href="https://letsencrypt.org/">Lets Encrypt</a> to keep things secure. But it's can be as simple as a docker run!
</p>
<div style="clear:both;"><br/><br/></div>
<img style="margin-left:10px;float:right;width:320px;height:235px;" align="right" width="320" height="235" src="https://statping-ng.github.io/assets/external/statping_theme.gif" />
<h3>Custom SASS Styling</h3>
Statping-ng will allow you to completely customize your Status Page using SASS styling with easy to use variables. The container image actually contains a pre-built SASS binary so you won't even need to setup anything!
<div style="clear:both;"><br/><br/><br/></div>
<img style="margin-right:10px;float:left;width:320px;height:235px;" align="left" width="320" height="235" src="https://statping-ng.github.io/assets/external/statping_iphone_bk.png" />
<h3>Compatible with the Statping App</h3>
<p>
Statping-ng is 100% compatible with the statping app which is available on the Apple App Store and Google Play for free. The app will allow you to view services, receive notifications when a service is offline, update groups, users, services, messages, and more! Start your own Statping-ng server and then connect it to the app by scanning the QR code in settings.</p>
<p align="center" style="text-align:center">
<a href="https://play.google.com/store/apps/details?id=com.statping"><img src="https://statping-ng.github.io/assets/external/google-play.svg"></a>
<a href="https://itunes.apple.com/us/app/apple-store/id1445513219"><img src="https://statping-ng.github.io/assets/external/app-store-badge.svg"></a>
</p>
<p align="center" style="text-align:center"><small>The mobile app is not maintained by statping-ng and includes in-app purchases to the developer of statping.</small></p>
<div style="clear:both;"><br/><br/></div>
<h3>Notifications - Slack, Email, Twilio and more</h3>
<p>Statping-ng includes email notification via SMTP and Slack integration using <a href="https://api.slack.com/incoming-webhooks">Incoming Webhook</a>. Insert the webhook URL into the Settings page in Statping-ng and enable the Slack integration. Anytime a service fails, the channel that you specified on Slack will receive a message.</p>
<p>View the <a href="https://github.com/statping-ng/statping-ng/wiki/Statping-Plugins">Plugin Wiki</a> to see detailed information about Golang Plugins. Statping-ng isn't just another Status Page for your applications, it's a framework that allows you to create your own plugins to interact with every element of your status page. <a href="https://github.com/statping-ng/statping-ng/wiki/Notifiers">Notifier's</a> can also be create with only 1 golang file.</p>
<div style="clear:both;"><br/><br/><br/></div>
<img style="margin-left:10px;float:right;width:320px;height:235px;" width="320" height="235" align="right" src="https://statping-ng.github.io/assets/external/statping_settings.gif" />
<h2>Easy to use Dashboard</h2>
Having a straight forward dashboard makes Statping-ng that much better. Monitor your websites and applications with a basic HTTP GET request, or add a POST request with your own JSON to post to the endpoint.
<br><br><br><br>
<p>
Having a straight forward dashboard makes Statping-ng that much better. Quickly and Easy view statuses. Monitor your websites and applications with a basic HTTP GET request, or add a POST request with your own JSON to post to the endpoint.</p>
<div style="clear:both;"><br/><br/><br/><br/></div>
<img style="margin:35px 0;width:100%;height:250px;" align="center" width="100%" height="250" src="https://statping-ng.github.io/assets/external/statupsc2.png" />
<h2 align="center" style="text-align:center">Quick Start</h2>
<p>Here's a few quick start guides to get you going, fast.</p>
<h3>Docker</h3>
<p>Use the <a href="https://hub.docker.com/r/adamboutcher/statping-ng">Statping Docker Image</a> to create a status page in seconds. Checkout the <a href="https://github.com/statping-ng/statping-ng/wiki/Docker">Docker Wiki</a> to view more details on how to get started using Docker.
</p>
## Run on Docker
Use the [Statping Docker Image](https://hub.docker.com/r/adamboutcher/statping-ng) to create a status page in seconds. Checkout the [Docker Wiki](https://github.com/statping-ng/statping-ng/wiki/Docker) to view more details on how to get started using Docker.
```bash
docker run -it -p 8080:8080 adamboutcher/statping-ng
```
There are multiple ways to startup a Statping-ng server. You want to make sure Statping-ng is on it's own instance that is not on the same server as the applications you wish to monitor. It doesn't look good when your Status Page goes down.
<br><br><br><br>
## Docker Compose
In this folder there is a standard docker-compose file that include nginx, postgres, and Statping-ng.
<h3>Docker Compose</h3>
<p>In the root (base) folder there is a standard docker-compose file that includes nginx, postgres, and Statping-ng.</p>
```bash
docker-compose up -d
```
<br><br><br><br>
## Docker Compose with Automatic SSL
You can automatically start a Statping-ng server with automatic SSL encryption using this docker-compose file. First point your domain's DNS to the Statping-ng server, and then run this docker-compose command with DOMAIN and EMAIL. Email is for letsencrypt services.
<h3>Docker Compose with Automatic SSL</h3>
<p>You can automatically start a Statping-ng server with automatic SSL encryption using this docker-compose file. First point your domain's DNS to the Statping-ng server, and then run this docker-compose command with DOMAIN and EMAIL. Email is for <a href="https://letsencrypt.org/">letsencrypt</a> services.</p>
```bash
LETSENCRYPT_HOST=mydomain.com \
LETSENCRYPT_EMAIL=info@mydomain.com \
docker-compose -f docker-compose-ssl.yml up -d
```
Once your instance has started, it will take a moment to get your SSL certificate. Make sure you have a A or CNAME record on your domain that points to the IP/DNS of your server running Statping-ng.
<br><br><br><br>
## Prometheus Exporter
Statping-ng includes a [Prometheus Exporter](https://github.com/statping-ng/statping-ng/wiki/Prometheus-Exporter) so you can have even more monitoring power with your services. The Prometheus exporter can be seen on `/metrics`, simply create another exporter in your prometheus config. Use your Statping-ng API Secret for the Authorization Bearer header, the `/metrics` URL is dedicated for Prometheus and requires the correct API Secret has `Authorization` header.
<p>Once your instance has started, it will take a moment to get your SSL certificate. Make sure you have a A or CNAME record on your domain that points to the IP/DNS of your server running Statping-ng.</p>
<h3>Prometheus Exporter</h3>
<p>Statping-ng includes a <a href="https://github.com/statping-ng/statping-ng/wiki/Prometheus-Exporter">Prometheus Exporter</a> so you can have even more monitoring power with your services. The Prometheus exporter can be seen on <kbd>/metrics</kbd>, simply create another exporter in your prometheus config. Use your Statping-ng API Secret for the Authorization Bearer header, the <kbd>/metrics</kbd> URL is dedicated for Prometheus and requires the correct API Secret has <kbd>Authorization</kbd> header.</p>
```yaml
scrape_configs:
- job_name: 'statping'
@ -114,9 +154,9 @@ scrape_configs:
static_configs:
- targets: ['statping:8080']
```
<br><br><br><br>
## Contributing
Statping-ng accepts Push Requests to the `dev` branch! Feel free to add your own features and notifiers. You probably want to checkout the [Notifier Wiki](https://github.com/statping-ng/statping-ng/wiki/Notifiers) to get a better understanding on how to create your own notification methods for failing/successful services. Testing on Statping-ng will test each function on MySQL, Postgres, and SQLite. I recommend running MySQL and Postgres Docker containers for testing. You can find multiple docker-compose files in the dev directory.
[![Go Report Card](https://goreportcard.com/badge/github.com/statping-ng/statping-ng)](https://goreportcard.com/report/github.com/statping-ng/statping-ng)
<h2>Contributing</h2>
<p>Statping-ng accepts Push Requests to the <kbd>dev</kbd> branch!</p>
<p>Feel free to add your own features and notifiers.You probably want to checkout the <a href="https://github.com/statping-ng/statping-ng/wiki/Notifiers">Notifier Wiki</a> to get a better understanding on how to create your own notification methods for failing/successful services.</p>
<p>Testing on Statping-ng will test each function on MySQL, Postgres, and SQLite. I recommend running MySQL and Postgres Docker containers for testing.</p>
<p>You can find multiple docker-compose files in the <kbd>dev</kbd> directory.</p>

View File

@ -4,7 +4,7 @@ services:
statping_dev:
container_name: statping_dev
image: statping/statping:dev
image: statping-ng/statping-ng:dev
restart: on-failure
volumes:
- ./cmd:/go/src/github.com/statping-ng/statping-ng/cmd/

4
dev/postman.json vendored
View File

@ -4205,7 +4205,7 @@
"",
"pm.test(\"View All Notifiers\", function () {",
" var jsonData = pm.response.json();",
" pm.expect(jsonData.length).to.eql(13);",
" pm.expect(jsonData.length).to.eql(14);",
"});"
],
"type": "text/javascript"
@ -6242,4 +6242,4 @@
}
],
"protocolProfileBehavior": {}
}
}

View File

@ -3,7 +3,7 @@ version: '2.3'
services:
statping:
container_name: statping
image: aboutcher/statping-ng:dev
image: adamboutcher/statping-ng:latest
restart: always
volumes:
- statping_data:/app

View File

@ -25,7 +25,7 @@
<meta property="twitter:description" content="{{CoreApp.Description}} {{CoreApp.Name}}">
{{if USE_CDN}}
<link rel="stylesheet" href="https://assets.statping.com/css/vendor.css">
<link rel="stylesheet" href="https://statping-ng.github.io/assets/hosted/vendor.css" />
{{else}}
<% _.each(htmlWebpackPlugin.tags.headTags, function(headTag) { %>
<%= headTag %> <% }) %>
@ -39,10 +39,10 @@
<div id="app" class="statping_container"></div>
{{if USE_CDN}}
<script src="https://assets.statping.com/js/bundle.js"></script>
<script src="https://assets.statping.com/js/vendor.chunk.js"></script>
<script src="https://assets.statping.com/js/polyfill.chunk.js"></script>
<script src="https://assets.statping.com/js/main.chunk.js"></script>
<script src="https://statping-ng.github.io/assets/hosted/bundle.js"></script>
<script src="https://statping-ng.github.io/assets/hosted/vendor.chunk.js"></script>
<script src="https://statping-ng.github.io/assets/hosted/polyfill.chunk.js"></script>
<script src="https://statping-ng.github.io/assets/hosted/main.chunk.js"></script>
{{else}}
<% _.each(htmlWebpackPlugin.tags.bodyTags, function(bodyTag) { %>
<%= bodyTag %> <% }) %>

View File

@ -1,6 +1,6 @@
<template>
<nav class="navbar navbar-expand-lg">
<router-link to="/" class="navbar-brand">Statping</router-link>
<router-link to="/" class="navbar-brand">Statping-ng</router-link>
<button @click="navopen = !navopen" class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
<font-awesome-icon v-if="!navopen" icon="bars"/>
<font-awesome-icon v-if="navopen" icon="times"/>

View File

@ -42,6 +42,7 @@
<option value="fr">French</option>
<option value="ru">Russian</option>
<option value="de">German</option>
<option value="cs">Czech</option>
<option value="ja">Japanese</option>
<option value="it">Italian</option>
<option value="ko">Korean</option>

View File

@ -282,7 +282,7 @@ export default {
this.notifier.form.forEach((f) => {
let field = f.field.toLowerCase()
let val = this.notifier[field]
if (this.isNumeric(val)) {
if (this.isNumeric(val) && this.form.method!='telegram') {
val = parseInt(val)
}
this.form[field] = val
@ -304,7 +304,7 @@ export default {
this.notifier.form.forEach((f) => {
let field = f.field.toLowerCase()
let val = this.notifier[field]
if (this.isNumeric(val)) {
if (this.isNumeric(val) && this.form.method!='telegram') {
val = parseInt(val)
}
this.form[field] = val

View File

@ -16,6 +16,7 @@
<option value="fr">French</option>
<option value="ru">Russian</option>
<option value="de">German</option>
<option value="cs">Czech</option>
<option value="ja">Japanese</option>
<option value="ko">Korean</option>
<option value="it">Italian</option>

View File

@ -0,0 +1,142 @@
const czech = {
settings: "Nastavení",
dashboard: "Nástěnka",
services: "Služby",
service: "Služba",
failures: "Selhání",
users: "Uživatelé",
login: "Přihlásit se",
logout: "Odhlásit se",
online: "Online",
offline: "Offline",
configs: "Konfigurace",
username: "Uživatelské jméno",
password: "Heslo",
email: "E-mail",
confirm_password: "Potvrzení hesla",
uptime: "Doba provozu",
name: "Název",
copy: "Zkopírovat",
close: "Zavřít",
secret: "Tajný klíč",
regen_api: "Znovu vygenerovat API klíče",
regen_desc: "Tajný API klíč se používá ke trasám read, create, update a delete. Pokud potřebujete, můžete znovu vygenerovat vaše API klíče.",
visibility: "Viditelnost",
group: "Skupina",
group_create: "Vytvořit skupinu",
group_update: "Aktualizovat skupinu",
group_public_desc: "Zobrazit skupiny veřejně",
groups: "Skupiny",
no_group: "Žádná skupina",
public: "Veřejné",
private: "Soukromé",
announcements: "Oznámení",
notifiers: "Oznamovače",
logs: "Protokol",
help: "Podpora",
type: "Typ",
edit: "Upravit",
update: "Aktualizovat",
create: "Vytvořot",
view: "Zobrazit",
save: "Uložit",
title: "Název",
status: "Stav",
begins: "Začíná",
total_services: "Celkový počet služeb",
online_services: "Online služby",
request_timeout: "Časový limit požadavku vypršel",
service_never_online: "Služba nikdy nebyla online",
service_online_check: "Online zkontrolováno",
service_offline_time: "Služba je offline",
days_ago: "dny",
today: "Dnes",
week: "Týden",
month: "Měsíc",
day: "Den",
hour: "Hodina",
minute: "Minuta",
failures_24_hours: "Selhání v posledních 24 hodinách",
no_services: "Momentálně nemáte žádné služby!",
theme: "Téma",
cache: "Cache",
authentication: "Autentifikace",
import: "Importovat",
main_settings: "Obecná nastavení",
variables: "Proměnné",
docs: "Dokumentace",
links: "Odkazy",
changelog: "Seznam změn",
repo: "Repozitář",
language: "Jazyk",
db_connection: "Spojení s databází",
db_host: "Host databáze",
db_port: "Database Port",
db_username: "Uživatelské jméno databáze",
db_password: "Heslo databáze",
db_database: "Název databáze",
send_reports: "Posílat hlášení o chybách",
send_reports_desc: "Posílat hlášení o chybách Statpingu pro ladění",
project_name: "Název stavové stránky",
description: "Popis",
domain: "Doména",
enable_cdn: "Povolit CDN",
newsletter: "Newsletter",
newsletter_note: "Budeme vám posílat e-maily pouze s velkými změnami",
loading: "Načítání",
save_settings: "Uložit nastavení",
average_response: "Průměrná odpověď",
last_uptime: "Poslední doba provozu",
sign_in: "Přihlásit se",
last_login: "Poslední přihlášení",
admin: "Správce",
user: "Uživatel",
failed: "Selhání",
wrong_login: "Nesprávné uživatelské jméno nebo heslo",
theme_editor: "Editor témat",
enable_assets: "Povolit lokální assety",
assets_desc: "Přizpůsobte si vaši stavovou stránku povolením lokálních assetů. Vytvoříme adresář s názvem 'assets' obsahující všechno CSS.",
assets_btn: "Povolit lokální assety",
assets_loading: "Vytváření assetů",
assets_dir: "Adresář assetů",
footer: "Zápatí",
footer_notes: "V zápatí můžete používat HTML značky",
global_announcement: "Globální oznámení",
announcement_date: "Rozsah data oznámení",
notify_users: "Oznámit uživatelům",
notify_desc: "Oznámit uživatelům před naplánovanou dobou",
notify_method: "Metoda oznámení",
notify_before: "Oznámit před",
message_create: "Vytvořit oznámení",
message_edit: "Upravit oznámení",
minutes: "Minut",
hours: "Hodin",
days: "Dnů",
user_create: "Vytvořit uživatele",
user_update: "Aktualizovat uživatele",
administrator: "Správce",
checkins: "Kontroly",
incidents: "Incidenty",
service_info: "Informace o službě",
service_name: "Název služby",
service_type: "Typ služby",
permalink: "Pevná URL",
service_public: "Veřejná služba",
check_interval: "Interval kontroly",
service_endpoint: "Koncový bod služby",
service_check: "Typ kontroly služby",
service_timeout: "Vypršení času",
expected_resp: "Očekávaná odpověď",
expected_code: "Očekávaný stavový kód",
follow_redir: "Následovaná přesměrování",
verify_ssl: "Ověřit SSL",
tls_cert: "Použít TLS certifikát",
notification_opts: "Možnosti oznámení",
notifications_enable: "Povolit oznámení",
notify_after: "Oznámit po selháních",
notify_all: "Oznamovat vše",
service_update: "Aktualizovat službu",
service_create: "Vytvořit službu"
}
export default czech

View File

@ -1,8 +1,8 @@
const german = {
settings: "Einstellungen",
dashboard: "Armaturenbrett",
services: "Dienstleistungen",
service: "Service",
dashboard: "Dashboard",
services: "Dienste",
service: "Dienst",
failures: "Ausfälle",
users: "Benutzer",
login: "Login",
@ -20,43 +20,43 @@ const german = {
close: "Schließen",
secret: "Geheimnis",
regen_api: "API-Schlüssel neu generieren",
regen_desc: "API Secret wird für Lesen erstellen Update und Löschen Routen verwendet. Sie können API-Schlüssel bei Bedarf neu generieren.",
regen_desc: "Der API-Schlüssel wird für das Lesen, Erstellen, Updaten und Löschen von Routen verwendet. Sie können API-Schlüssel bei Bedarf neu generieren.",
visibility: "Sichtbarkeit",
group: "Gruppe",
group_create: "Gruppe erstellen",
group_update: "Gruppe aktualisieren",
group_public_desc: "Gruppendienste für die Öffentlichkeit anzeigen",
group_public_desc: "Gruppendienste öffentlich anzeigen",
groups: "Gruppen",
no_group: "Keine Gruppe",
public: "Öffentlichkeit",
public: "Öffentlich",
private: "Privat",
announcements: "Ankündigungen",
notifiers: "Notifizierer",
notifiers: "Benachrichtigungen",
logs: "Protokolle",
help: "Helfen",
help: "Hilfe",
type: "Typ",
edit: "Bearbeiten",
update: "Update",
create: "Schaffen",
view: "Ansicht",
save: "sparen",
create: "Erstellen",
view: "Anzeigen",
save: "Speichern",
title: "Titel",
status: "Status",
begins: "Beginnt",
total_services: "Dienstleistungen insgesamt",
total_services: "Dienste insgesamt",
online_services: "Online-Dienste",
request_timeout: "Zeitüberschreitung anfordern",
service_never_online: "Service war noch nie online",
request_timeout: "Zeitüberschreitung bei Anforderung",
service_never_online: "Dienst war noch nie online",
service_online_check: "Online geprüft",
service_offline_time: "Dienst war offline für",
days_ago: "Vor Tagen",
days_ago: "Tage vergangen",
today: "Heute",
week: "Woche",
month: "Monat",
day: "Tag",
hour: "Stunde",
minute: "Minute",
failures_24_hours: "Ausfälle dauern 24 Stunden",
failures_24_hours: "Ausfälle letzte 24 Stunden",
no_services: "Sie haben derzeit keine Dienste!",
theme: "Thema",
cache: "Cache",
@ -66,8 +66,8 @@ const german = {
variables: "Variablen",
docs: "Dokumentation",
links: "Links",
changelog: "Protokoll ändern",
repo: "Depot",
changelog: "Änderungsprotokoll",
repo: "Repo",
language: "Sprache",
db_connection: "Datenbankverbindung",
db_host: "Datenbank-Host",
@ -77,7 +77,7 @@ const german = {
db_database: "Name der Datenbank",
send_reports: "Fehlerberichte senden",
send_reports_desc: "Fehler zum Debuggen an Statping senden",
project_name: "Name der Seite „Status“",
project_name: "Name der Statusseite",
description: "Beschreibung",
domain: "Domäne",
enable_cdn: "CDN aktivieren",
@ -95,7 +95,7 @@ const german = {
wrong_login: "Falscher Benutzername oder Passwort",
theme_editor: "Theme-Editor",
enable_assets: "Lokale Assets aktivieren",
assets_desc: "Passen Sie das Design Ihrer Statusseite an, indem Sie lokale Elemente aktivieren. Dadurch wird ein Verzeichnis „Assets“ erstellt, das alle CSS enthält.",
assets_desc: "Passen Sie das Design Ihrer Statusseite an, indem Sie lokale Assets aktivieren. Dadurch wird ein Verzeichnis „Assets“ erstellt, das das gesamte CSS enthält.",
assets_btn: "Lokale Assets aktivieren",
assets_loading: "Erstellen von Assets",
assets_dir: "Assets Verzeichnis",
@ -106,7 +106,7 @@ const german = {
notify_users: "Benutzer benachrichtigen",
notify_desc: "Benutzer vor geplanter Zeit benachrichtigen",
notify_method: "Benachrichtigungsmethode",
notify_before: "Vor benachrichtigen",
notify_before: "Benachrichtigen vor",
message_create: "Ankündigung erstellen",
message_edit: "Ankündigung bearbeiten",
minutes: "Protokoll",
@ -117,15 +117,15 @@ const german = {
administrator: "Administrator",
checkins: "Checkins",
incidents: "Vorfälle",
service_info: "Service-Info",
service_info: "Dienstinfo",
service_name: "Dienstname",
service_type: "Service-Art",
service_type: "Dienstart",
permalink: "Permalink-URL",
service_public: "Öffentlicher Dienst",
check_interval: "Intervall prüfen",
service_endpoint: "Service-Endpunkt",
service_check: "Service-Prüfungstyp",
service_timeout: "Zeitüberschreitung anfordern",
service_endpoint: "Dienst-Endpunkt",
service_check: "Dienst-Prüfungstyp",
service_timeout: "Dienst Zeitüberschreitung",
expected_resp: "Erwartete Antwort",
expected_code: "Erwarteter Statuscode",
follow_redir: "Weiterleitungen folgen",
@ -134,9 +134,9 @@ const german = {
notification_opts: "Benachrichtigungsoptionen",
notifications_enable: "Benachrichtigungen aktivieren",
notify_after: "Benachrichtigung nach Fehlern",
notify_all: "Alle Änderungen benachrichtigen",
notify_all: "Benachrichtigung nach allen Änderungen",
service_update: "Dienst aktualisieren",
service_create: "Dienst erstellen"
}
export default german
export default german

View File

@ -1,6 +1,7 @@
import english from "./english"
import spanish from "./spanish"
import german from "./german"
import czech from "./czech"
import russian from "./russian";
import french from "./french";
import japanese from "./japanese";
@ -12,6 +13,7 @@ const language = {
en: english,
es: spanish,
de: german,
cs: czech,
ru: russian,
fr: french,
ja: japanese,

View File

@ -24,7 +24,7 @@ statping_get_tarball() {
printf "$cyan> Downloading latest version for $OS $ARCH...\n$url $reset\n"
# Get both the tarball and its GPG signature
tarball_tmp=`mktemp -t statping.tar.gz.XXXXXXXXXX`
if curl --fail -L -o "$tarball_tmp" "$url"; then
if curl --fail -L -s -o "$tarball_tmp" "$url"; then
# All this dance is because `tar --strip=1` does not work everywhere
temp=$(mktemp -d statping.XXXXXXXXXX)
if [ ${OS} == 'windows' ]; then
@ -32,11 +32,11 @@ statping_get_tarball() {
else
tar xzf $tarball_tmp -C "$temp"
fi
printf "$green> Installing to $DEST/statping\n"
printf "$green> Installing to $DEST/statping-ng\n"
mv "$temp"/statping "$DEST"
rm -rf "$temp"
rm $tarball_tmp*
printf "$cyan> Statping is now installed! $reset\n"
printf "$cyan> Statping-ng is now installed! $reset\n"
printf "$white> Repo: $repo $reset\n"
printf "$white> Wiki: $repo/wiki $reset\n"
printf "$white> Issues: $repo/issues $reset\n"
@ -66,7 +66,7 @@ statping_brew_install() {
}
statping_install() {
printf "${white}Installing Statping!$reset\n"
printf "${white}Installing Statping-ng!$reset\n"
getOS
getArch
statping_get_tarball $OS $ARCH

98
notifiers/mattermost.go Normal file
View File

@ -0,0 +1,98 @@
package notifiers
import (
"bytes"
"errors"
"strings"
"time"
"github.com/statping-ng/statping-ng/types/failures"
"github.com/statping-ng/statping-ng/types/notifications"
"github.com/statping-ng/statping-ng/types/notifier"
"github.com/statping-ng/statping-ng/types/null"
"github.com/statping-ng/statping-ng/types/services"
"github.com/statping-ng/statping-ng/utils"
)
var _ notifier.Notifier = (*mattermost)(nil)
const (
mattermostMethod = "mattermost"
)
type mattermost struct {
*notifications.Notification
}
func (s *mattermost) Select() *notifications.Notification {
return s.Notification
}
var mattermoster = &mattermost{&notifications.Notification{
Method: mattermostMethod,
Title: "Mattermost",
Description: "Send notifications to your mattermost channel when a service is offline. Insert your Incoming webhook URL for your channel to receive notifications. Based on the <a href=\"https://docs.mattermost.com/developer/webhooks-incoming.html\">Mattermost API</a>.",
Author: "Adam Boutcher",
AuthorUrl: "https://github.com/adamboutcher",
Delay: time.Duration(10 * time.Second),
Icon: "far fa-comments",
SuccessData: null.NewNullString(`{"icon_emoji":":white_check_mark:", "text": "The service {{.Service.Name}} is back online."}`),
FailureData: null.NewNullString(`{"icon_emoji":":x:", "text": "The service {{.Service.Name}} has gone offline."}`),
DataType: "json",
RequestInfo: "Mattermost allows you to customize your own messages with many complex components.",
Limits: 60,
Form: []notifications.NotificationForm{{
Type: "text",
Title: "Incoming Webhook Url",
Placeholder: "https://mattermost.example.com/hooks/abcd1234efgh5678ijkl9012xy",
SmallText: "Incoming Webhook URL generated on your mattermost server.",
DbField: "Host",
Required: true,
}}},
}
// Send will send a HTTP Post to the mattermost webhooker API. It accepts type: string
func (s *mattermost) sendMattermost(msg string) (string, error) {
resp, _, err := utils.HttpRequest(s.Host.String, "POST", "application/json", nil, strings.NewReader(msg), time.Duration(10*time.Second), true, nil)
if err != nil {
return "", err
}
return string(resp), nil
}
func (s *mattermost) OnTest() (string, error) {
example := services.Example(true)
testMsg := ReplaceVars(s.SuccessData.String, example, failures.Failure{})
contents, resp, err := utils.HttpRequest(s.Host.String, "POST", "application/json", nil, bytes.NewBuffer([]byte(testMsg)), time.Duration(10*time.Second), true, nil)
if err != nil {
return "", err
}
defer resp.Body.Close()
if string(contents) != "ok" {
return string(contents), errors.New("the mattermost response was incorrect, check the URL")
}
return string(contents), nil
}
// OnFailure will trigger failing service
func (s *mattermost) OnFailure(srv services.Service, f failures.Failure) (string, error) {
msg := ReplaceVars(s.FailureData.String, srv, f)
out, err := s.sendMattermost(msg)
return out, err
}
// OnSuccess will trigger successful service
func (s *mattermost) OnSuccess(srv services.Service) (string, error) {
msg := ReplaceVars(s.SuccessData.String, srv, failures.Failure{})
out, err := s.sendMattermost(msg)
return out, err
}
// OnSave will trigger when this notifier is saved
func (s *mattermost) OnSave() (string, error) {
return "", nil
}
func (s *mattermost) Valid(values notifications.Values) error {
return nil
}

View File

@ -0,0 +1,70 @@
package notifiers
import (
"github.com/statping-ng/statping-ng/database"
"github.com/statping-ng/statping-ng/types/core"
"github.com/statping-ng/statping-ng/types/failures"
"github.com/statping-ng/statping-ng/types/notifications"
"github.com/statping-ng/statping-ng/types/null"
"github.com/statping-ng/statping-ng/types/services"
"github.com/statping-ng/statping-ng/utils"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"testing"
"time"
)
var (
MATTERMOST_URL string
)
func TestMattermostNotifier(t *testing.T) {
err := utils.InitLogs()
require.Nil(t, err)
t.Parallel()
db, err := database.OpenTester()
require.Nil(t, err)
db.AutoMigrate(&notifications.Notification{})
notifications.SetDB(db)
core.Example()
MATTERMOST_URL = utils.Params.GetString("MATTERMOST_URL")
if MATTERMOST_URL == "" {
t.Log("mattermost notifier testing skipped, missing MATTERMOST_URL environment variable")
t.SkipNow()
}
mattermoster.Host = null.NewNullString(MATTERMOST_URL)
mattermoster.Enabled = null.NewNullBool(true)
t.Run("Load mattermost", func(t *testing.T) {
mattermoster.Host = null.NewNullString(MATTERMOST_URL)
mattermoster.Delay = 100 * time.Millisecond
mattermoster.Limits = 3
Add(mattermoster)
assert.Equal(t, "Adam Boutcher", mattermoster.Author)
assert.Equal(t, MATTERMOST_URL, mattermoster.Host.String)
})
t.Run("mattermost Within Limits", func(t *testing.T) {
ok := mattermoster.CanSend()
assert.True(t, ok)
})
t.Run("mattermost OnSave", func(t *testing.T) {
_, err := mattermoster.OnSave()
assert.Nil(t, err)
})
t.Run("mattermost OnFailure", func(t *testing.T) {
_, err := mattermoster.OnFailure(services.Example(false), failures.Example())
assert.Nil(t, err)
})
t.Run("mattermost OnSuccess", func(t *testing.T) {
_, err := mattermoster.OnSuccess(services.Example(true))
assert.Nil(t, err)
})
}

View File

@ -26,6 +26,7 @@ type replacer struct {
func InitNotifiers() {
Add(
slacker,
mattermoster,
Command,
Discorder,
email,

View File

@ -52,8 +52,8 @@ var Telegram = &telegram{&notifications.Notification{
}, {
Type: "text",
Title: "Channel",
Placeholder: "@statping_channel",
SmallText: "Insert your Telegram Channel including the @ symbol. The bot will need to be an administrator of this channel.",
Placeholder: "@statping_channel/-123123512312",
SmallText: "Insert your Telegram Channel including the @ symbol. The bot will need to be an administrator of this channel. You can also supply a chat_id.",
DbField: "var1",
Required: true,
}}},

View File

@ -3,16 +3,17 @@ package notifiers
import (
"bytes"
"fmt"
"io/ioutil"
"net/http"
"strings"
"time"
"github.com/statping-ng/statping-ng/types/failures"
"github.com/statping-ng/statping-ng/types/notifications"
"github.com/statping-ng/statping-ng/types/notifier"
"github.com/statping-ng/statping-ng/types/null"
"github.com/statping-ng/statping-ng/types/services"
"github.com/statping-ng/statping-ng/utils"
"io/ioutil"
"net/http"
"strings"
"time"
)
var _ notifier.Notifier = (*webhooker)(nil)
@ -85,15 +86,30 @@ func (w *webhooker) Valid(values notifications.Values) error {
}
func (w *webhooker) sendHttpWebhook(body string) (*http.Response, error) {
utils.Log.Infoln(fmt.Sprintf("sending body: '%v' to %v as a %v request", body, w.Host.String, w.Var1.String))
client := new(http.Client)
client.Timeout = 10 * time.Second
req, err := http.NewRequest(w.Var1.String, w.Host.String, bytes.NewBufferString(body))
if err != nil {
return nil, err
}
if w.ApiKey.String != "" {
req.Header.Add("Content-Type", w.ApiKey.String)
} else {
req.Header.Add("Content-Type", "application/json")
}
req.Header.Set("User-Agent", "Statping-ng")
req.Header.Set("Statping-Version", utils.Params.GetString("VERSION"))
var customHeaders []string
if w.ApiSecret.String != "" {
keyVal := strings.SplitN(w.ApiSecret.String, "=", 2)
customHeaders = strings.Split(w.ApiSecret.String, ",")
} else {
customHeaders = nil
}
for _, h := range customHeaders {
keyVal := strings.SplitN(h, "=", 2)
if len(keyVal) == 2 {
if keyVal[0] != "" && keyVal[1] != "" {
if strings.ToLower(keyVal[0]) == "host" {
@ -104,13 +120,7 @@ func (w *webhooker) sendHttpWebhook(body string) (*http.Response, error) {
}
}
}
if w.ApiKey.String != "" {
req.Header.Add("Content-Type", w.ApiKey.String)
} else {
req.Header.Add("Content-Type", "application/json")
}
req.Header.Set("User-Agent", "Statping")
req.Header.Set("Statping-Version", utils.Params.GetString("VERSION"))
resp, err := client.Do(req)
if err != nil {
return nil, err

View File

@ -1,28 +1,31 @@
name: statping-ng
version-script: cat version.txt
version: "stable"
version-script: cat version.txt
summary: Statping-ng Server Monitoring with Status Page
description: >
description: |
An easy to use Status Page for your websites and applications.
Statping will automatically fetch the application and render a beautiful
status page with tons of features for you to build an even better status page.
This Status Page generator allows you to use MySQL, Postgres, or SQLite
on multiple operating systems.
base: base
base: core18
build-base: core18
type: app
confinement: strict
grade: stable
issues: https://github.com/statping-ng/statping-ng/issues
license: GPL-3.0
architectures:
- build-on: i386
- build-on: amd64
- build-on: armhf
- build-on: arm64
- build-on: i386
apps:
statping:
command: statping
command: bin/statping
daemon: simple
plugs:
- home
- network
@ -33,7 +36,10 @@ parts:
source: .
plugin: nil
override-build: |
apt-get update
apt-get install -y curl tar
curl -o- -L https://raw.githubusercontent.com/statping-ng/statping-ng/stable/install.sh | bash
mv /usr/local/bin/statping ./
curl -o- -L https://raw.githubusercontent.com/adamboutcher/statping-ng/dev/install.sh | bash
build-packages:
- tar
- curl
- bash
organize:
/usr/local/bin/statping: bin/

View File

@ -174,7 +174,7 @@ func HttpRequest(endpoint, method string, contentType interface{}, headers []str
return nil, nil, err
}
// set default headers so end user can overwrite them if needed
req.Header.Set("User-Agent", "Statping")
req.Header.Set("User-Agent", "Statping-ng")
req.Header.Set("Statping-Version", Params.GetString("VERSION"))
req.Header.Set("Accept", "text/html")

View File

@ -1 +1 @@
0.90.78
0.90.79