Hello Daniel,
thanks you very much for your answer. Your answer covers one part of
what I would like to to know but I still struggle with salt and so I did
not yet find a syntactically and semantically valid way to provide the
eventdata {{ data }} from the reactor
(/srv/reactor/base/filesystem.sls) to the statefile I reference in the
reactor: inform_full_filesystem.sls.
So I would like to access the event data contained in {{ data }} in the
state file in inform_full_filesystem.sls, eg to get the hostname that
triggered this event. I read that this can be done via pillars, but what
I tried up to now did not work. One not working example I found
somewhere in the net which I tried to adopt to my needs is this here :
full_fs:
local.state.apply:
- tgt: '
salt.uni-koblenz.de'
- args:
- inform_full_filesystem
- pillar:
myid: {{ data['id'] }}
anotherValue: {{ data['anotherValue'] }}
...
This resulted in an error about a wrong number of arguments for
local.state.apply (one instead of two). And even if the number of
argumnets would have been correct how would access to the defined pillar
(since it has no name) have been possible in inform_full_filesystem.sls?
Can you please give an example of how this can be done correctly?
Thanks a lot
Rainer
Am 20.07.2018 um 14:56 schrieb Daniel Wallace:
> all of the data that the beacon returns will be available in the
> `{{data}}` object, you can see that object by running `salt-run
> state.event pretty=True tagmatch="saslt/beacon/*/diskusage/` and then
> having the beacon fire an event.
>
> Everything in the {} in the event is in the event output is in the
> {{data}} object.
>
> On Fri, Jul 20, 2018 at 3:53 AM 'Rainer Krienke' via Salt-users
> <
salt-...@googlegroups.com <mailto:
salt-...@googlegroups.com>> wrote:
>
> Hello,
>
> I have a beacon that watches disk space on minions, a reactor
> master config, a reactor that manages the event and connects it
> to a state file:
>
> # beacon.sls:
> diskusage:
> - '/': 50%
> - interval: 30
>
> # reactor.conf:
> reactor:
> - 'salt/beacon/*/diskusage/':
> - /srv/reactor/base/filesystem.sls
>
> # /srv/reactor/base/filesystem.sls
> full_fs:
> local.state.apply:
> - tgt: '
saltmaster.mydomain.de <
http://saltmaster.mydomain.de>'
> - args:
> - inform_full_filesystem
>
> # /srv/salt/base/inform_full_filesystem.sls
> email-on-failure:
> smtp.send_msg:
> - name: This is my message
> - profile: mySmtpServer # defined in default pillar
> - recipient:
mym...@mydomain.de <mailto:
mym...@mydomain.de>
> - subject: test beacons
>
> This basically works, I get emails from minions for which the
> beacon is activated.
>
> My problem is how do I pass the events paramters that
> /srv/reactor/base/filesystem.sls gets to the state file
> /srv/salt/base/inform_full_filesystem, so that the email sent can
> tell me from which hosts the event came i.e which host has a full
> filesystem. So I would like to write something in the subject of
> the sent email line like this:
>
> email-on-failure:
> # ...
> - subject: Host {{ failed_host }}, filesystem {{ filesystem }}
> is full
>
> I searched a lot, but did not find a working example for reactor
> with state files.
>
> Any ideas?
>
> Thanks a lot
> Rainer
> --
> You received this message because you are subscribed to the Google
> Groups "Salt-users" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to
salt-users+...@googlegroups.com
> <mailto:
salt-users+...@googlegroups.com>.
> <
https://groups.google.com/d/msgid/salt-users/fd84512f-a2af-47a2-823c-a0fdb8393005%40googlegroups.com?utm_medium=email&utm_source=footer>.
> --
> You received this message because you are subscribed to the Google
> Groups "Salt-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
salt-users+...@googlegroups.com
> <mailto:
salt-users+...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/salt-users/CAA2%2B9hCAFLsGY5v-LvUxfZ9uTO%2BqC0HszayN%2BPxmdU9x4Hgj8A%40mail.gmail.com
> <
https://groups.google.com/d/msgid/salt-users/CAA2%2B9hCAFLsGY5v-LvUxfZ9uTO%2BqC0HszayN%2BPxmdU9x4Hgj8A%40mail.gmail.com?utm_medium=email&utm_source=footer>.