README.md 952 Bytes
Newer Older
remy's avatar
remy committed
1
This formula checks services/daemon from a pillar (pillar:machines/hosts\*.sls).
remy's avatar
remy committed
2

remy's avatar
remy committed
3
4
5
6
7
8
9
10
11
12
13
14
15
Usage:

```bash
salt '*' state.sls check_services
```

Actually, I am using it with json output. Then I read the results with a specific php file every morning (cron).

`services.new.sls` was written to avoid old legacy style for `module.run` ( https://docs.saltproject.io/en/3000/ref/states/all/salt.states.module.html ) calls, and the custom module (`_modules/customservice.py`) [^1], but the new style, by including all services in only one `module.run` does not allow me to check each service (not a `dict` returned).

A cleaner way to do this would be by including all the logic into one pillar file, or with `file.managed` to the json written file + a dedicated salt mine.

[^1] Indeed, I had some synchronziation issues with custom modules on salt minions version > 2019. I needed to run `salt '*' saltutil.sync_all` or at least `salt '*' saltutil.sync_modules`.