The event system in Salt is a local ZeroMQ PUB interface, which fires salt events. It is performed by the following components.
Event Sockets − It is used to publish events.
Event library − It is used to listen to events and send the events into the salt system.
A Salt master provides different types of events, which are explained in detail below −
Let us go through each of the event types in detail.
These authentication events fire when a minion performs an authentication check with the master. It is represented by salt/auth.
The start events fire whenever a minion connects to the Salt master and it is represented by salt/minion//start.
The Key events are fired when the salt master is accepting and rejecting keys on the Salt minion. You can access this event using the salt-key command.
A Job event is fired whenever a new job is going to start. It is represented by salt/job//new. Here, JID - Job id new - new job
When a runner begins execution, a runner event is fired. It is represented by salt/run//new.
When minions are connected or newly connected or disconnected, this event is fired on a regular interval. It is represented by – salt/presence/present and salt/presence/change. Here,
Present − means the Salt master is currently connected to the minions list.
Change − used to detect a new minion – connected or disconnected.
The salt-cloud events are fired on a virtual machine. Unless other events, it is not performed on the minion. You can access it using – salt/cloud//creating. It is fired when a Salt cloud starts the virtual machine execution process.
Now, let us go through the event tools and scripts. You can access the event bus using CLI. It is accessed by the following command.
salt-run state.event pretty = True
Here, the runner is designed to interact with the event bus from external tools and shell scripts. Salt’s event bus can be accessed remotely via the REST API. It is represented by – (sample URL).
curl -SsNk https://salt-api.example.com:8000/events?token = 05A3.
Similarly, you can access events from the Python scripts as well.