-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbashly.yml
130 lines (109 loc) · 4.95 KB
/
bashly.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
## TODO: Debug filters and specifically filters for monitor command. Fix shellcheck notices.
name: uptime-kuma-service-push
help: |-
A bash script generator for Uptime-Kuma's Push Monitor.
This script generates a script that checks if a service is running and pushes to Uptime-Kuma's Push Monitor. It uses systemctl to check the services and then uses curl to tell Uptime-Kuma if the service is up or down. If the service is down it will also add the last 5 lines of the journalctl logs to the message through tail.
version: 0.7.0
dependencies:
- curl
- systemctl
- journalctl
- readlink
- stat
commands:
- name: generate
alias: gen
help: |-
Generate a push monitor script.
This will generate the script that pushes an update to Uptime-Kuma.
If the service is up it sends an OK status and a message saying it's running.
If the service is down it will send a DOWN status and a message saying the service is down. It will also append the last 5 lines from the log.
filters:
- "generate_directory_exists"
args:
- name: service
required: true
help: |-
Service name
Enter the name of the service that you will be checking. It will validate the service using systemctl to check if the service is active.
validate: service
- name: url
required: true
help: |-
Push URL - Requires quotations: 'URL'
It will validate the URL to make sure it contains parts of the API URL as well has the URL prefix.
Copy and paste the whole URL from Uptime-Kuma's Push Monitor inside of single quotes, otherwise the URL won't be parsed correctly. See examples.
validate: url
flags:
- long: --monitor
help: |-
Directly make a symlink to the monitored directory.
This will make a symlink between the generated script in the script directory and the monitored directory. See 'uptime-kuma-service-push config monitor --help'.
- long: --no-logs
help: |-
Disables the logging overwriting the option in the config file.
conflicts:
- "--add-logs"
- long: --add-logs
help: |-
Enables the logging overwriting the option in the config file.
conflicts:
- "--no-logs"
examples:
- uptime-kuma-service-push generate docker 'https://example.com/api/push/JSHs372KL8?status=up&msg=OK&ping='
- uptime-kuma-service-push gen hostapd 'https://example.com/api/push/a02fD177b4?status=up&msg=OK&ping=' --no-logs --monitor
- name: create
help: |-
Creates files and links for automatic creation of Uptime-Kuma-Service-Push features.
This command will help you configure your system for some of the features for Uptime-Kuma-Service-Push.
commands:
- name: systemd-unit
help: |-
Makes the Uptime-Kuma-Service-Push systemd unit files.
This will make the systemd unit files for a service and a timer that runs the monitor script.
To manage the interval change the config.ini to either seconds '60' for a minute or you can use something like '1 hour 2 minutes' or simply '1 hour'
flags:
- long: --remove
help: |-
Remove the systemd unit files
- name: monitor
help: |-
Create the monitor script to monitor services.
Creates the Uptime-Kuma-Service-Push monitor script for monitoring several services at once through one script.
The scripts location will be in the directory of Uptime-Kuma-Service-Push.
To manage monitored scripts see 'uptime-kuma-service-push monitor --help'
flags:
- long: --remove
help: |-
Remove the monitor script and script directory.
This will remove the monitor script and script directory from the Uptime-Kuma-Service-Push directory.
- name: symlink
help: |-
Create a global symlink for Uptime-Kuma-Service-Push.
This will create a symlink so you can run Uptime-Kuma-Service-Push from anywhere without having to run it in the scripts directory.
flags:
- long: --remove
help: |-
Remove the symlink from the system.
- name: monitor
help: |-
Manage Uptime-Kuma-Service-Push monitoring.
filters:
- "monitor_script_exists"
commands:
- name: enable
help: |-
Add the monitor script to monitoring directory for the monitor script.
args:
- name: service
required: true
help: |-
The generated script that will be added to monitoring.
- name: disable
help: |-
Remove a monitor script from monitoring.
args:
- name: service
required: true
help: |-
The generated script that will be removed from the monitoring directory so that the monitor script no longer will monitor it.