@@ -7,6 +7,8 @@ import Pushover from 'node-pushover';
7
7
import { Webhook } from 'discord-webhook-node' ;
8
8
import { NtfyClient } from 'ntfy' ;
9
9
import { WebClient } from '@slack/web-api' ;
10
+ import { gotify } from 'gotify' ;
11
+
10
12
process . on ( 'warning' , ( warning ) => {
11
13
console . log ( warning . stack ) ;
12
14
} ) ;
@@ -50,6 +52,7 @@ let runClock;
50
52
console . log ( "-------------------------------------------------------" ) ;
51
53
console . log ( " Monocker - MONitor dOCKER container states" ) ;
52
54
console . log ( " Developed by Matt Petersen - Brisbane Australia" ) ;
55
+ console . log ( " Donate: https://www.paypal.com/paypalme/thanksmp" )
53
56
console . log ( " " ) ;
54
57
console . log ( " Version: " + pjson . version ) ;
55
58
console . log ( "-------------------------------------------------------" ) ;
@@ -80,6 +83,16 @@ async function sendPushbullet(title, message) {
80
83
} ) ;
81
84
}
82
85
86
+ async function sendGotify ( title , message ) {
87
+ await gotify ( {
88
+ server : msgDetails [ 1 ] ,
89
+ app : msgDetails [ 2 ] ,
90
+ title : title ,
91
+ message : message ,
92
+ priority : 5
93
+ } ) ;
94
+ }
95
+
83
96
async function sendPushover ( title , message ) {
84
97
var push = new Pushover ( {
85
98
token : msgDetails [ 2 ] ,
@@ -174,6 +187,9 @@ async function send(message) {
174
187
case "slack" :
175
188
sendSlack ( title , message ) ;
176
189
break ;
190
+ case "gotify" :
191
+ sendGotify ( title , message ) ;
192
+ break ;
177
193
case "default" :
178
194
// do nothing
179
195
break ;
@@ -234,15 +250,14 @@ async function list() {
234
250
}
235
251
if ( ONLY_OFFLINE_STATES == 'true' ) {
236
252
if ( offlineStates . includes ( c . State ) || offlineStates . includes ( c . State + " " + hcStatus ) ) {
237
- console . log ( " - " + output ) ;
253
+ console . log ( " - " + output ) ;
238
254
//send(output);
239
255
messages += output + "\r\n" ;
240
256
}
241
257
}
242
258
else {
243
259
console . log ( " - " + output ) ;
244
260
//send(output);
245
- console . log ( '*****' + output ) ;
246
261
messages += output + "\r\n" ;
247
262
}
248
263
}
@@ -257,16 +272,16 @@ async function list() {
257
272
console . log ( " - Currently monitoring " + newConArray . length + " (running) containers" ) ;
258
273
if ( DISABLE_STARTUP_MSG . toLowerCase ( ) != 'true' ) {
259
274
//send("Currently monitoring " + newConArray.length + " (running) containers");
260
- messages = ` Monitoring started
261
- - - Version: ` + pjson . version + `
262
- - - Messaging platform: ` + MESSAGE_PLATFORM . split ( "@" ) [ 0 ] + `
263
- - - Polling period: ` + PERIOD + ` seconds` + `
264
- - - Only offline state monitoring: ` + ONLY_OFFLINE_STATES + `
265
- - - Only include labelled containers: ` + LABEL_ENABLE + `
266
- - - Do not monitor 'Exited': ` + EXCLUDE_EXITED + `
267
- - - Disable Startup Messages: ` + DISABLE_STARTUP_MSG + `
268
- - - Display SHA ID: ` + SHA + `
269
- `;
275
+ messages = " Monitoring started" + `
276
+ - Version: ` + pjson . version + `
277
+ - Messaging platform: ` + MESSAGE_PLATFORM . split ( "@" ) [ 0 ] + `
278
+ - Polling period: ` + PERIOD + ` seconds` + `
279
+ - Only offline state monitoring: ` + ONLY_OFFLINE_STATES + `
280
+ - Only include labelled containers: ` + LABEL_ENABLE + `
281
+ - Do not monitor 'Exited': ` + EXCLUDE_EXITED + `
282
+ - Disable Startup Messages: ` + DISABLE_STARTUP_MSG + `
283
+ - Display SHA ID: ` + SHA + `
284
+ ` ;
270
285
messages += "Currently monitoring " + newConArray . length + " (running) containers" + "\r\n" ;
271
286
}
272
287
isFirstRun = false ;
0 commit comments