Book Image

Mastering SaltStack

By : Joseph Hall
Book Image

Mastering SaltStack

By: Joseph Hall

Overview of this book

Table of Contents (19 chapters)
Mastering SaltStack
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Monitoring with Returners


As we discussed in the previous chapter, Returners have the ability to store the job return data from Minions in an external data store. This is ideal for monitoring situations because the external data store can be used to establish a baseline.

One of the best ways to set up Salt so that it starts to collect data is to use the Minion's scheduler. For our example, we'll assume that you're using the mysql Returner. Go ahead and add the following code to your Minion configuration:

schedule:
  loadavg_monitoring:
    function: status.loadavg
    minutes: 10
    returner: mysql
  diskusage_monitoring:
    function: status.diskusage
    minutes: 10
    returner: mysql

Note that both of these have the returner set to mysql. If you are scheduling a lot of tasks that use the same Returner, you may just want to add a schedule_returner line instead:

schedule_returner: mysql
schedule:
  loadavg_monitoring:
    function: status.loadavg
    minutes: 10
  diskusage_monitoring:
 ...