-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yaml
42 lines (41 loc) · 1.73 KB
/
config.yaml
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
---
# The YAML configuration file allows you to define the rules, actions,
# and command execution settings for YAML Runner Go.
# Defines the settings for the YAML Runner Go daemon, including
# the interval at which the actions should be executed. The interval value
# should be specified in a valid duration format (e.g., "5s" for 5 seconds).
daemon:
interval: 5s
# Specifies the logging settings for the application. It includes
# the log file path, whether to enable quiet mode (suppressing non-error
# log messages), the log level (e.g., "debug", "info", "warn", "error"),
# and whether to format log output in JSON.
logging:
file: ./yaml-runner-go.log
quiet: false
level: debug
json: false
# Describes the facts or variables that can be used in the rules section.
# Each fact has a unique name and a command associated with it. The command
# will be executed to obtain the value of the fact.
facts:
- name: apacheIsRunning
command: "curl --connect-timeout 1 -s http://localhost:80/; echo $?;"
- name: loadAverage1
command: "[[ -e /proc/loadavg ]] && awk '{print $(NF-2)}' /proc/loadavg | cut -d. -f1 || sysctl -n vm.loadavg | awk '{print $2}' | cut -d, -f1"
shell: /bin/bash
# Defines the actions to be executed based on the specified rules. Each action
# consists of a command to be executed when the rules evaluate to true.
# The rules are expressed using boolean expressions that can reference
# the facts defined earlier.
actions:
- command: "echo \"Stopping apache\""
rules:
- "[[ ${loadAverage1} -gt 15 ]]"
- "[[ ${apacheIsRunning} -eq 0 ]]"
shell: /bin/bash
- command: "echo \"Starting apache\""
rules:
- "[[ ${loadAverage1} -lt 15 ]]"
- "[[ ${apacheIsRunning} -ne 0 ]]"
shell: /bin/bash