5

Is there anything out there to monitor SaltStack installations besides halite? I have it installed but it's not really what we are looking for.

It would be nice if we could have a web gui or even a daily email that showed the status of all the minions. I'm pretty handy with scripting but I don't know what to script.

Anybody have any ideas?

Steven
  • 57
  • 2
  • 5
  • Maybe this Nagios plugin is what you are looking for: https://github.com/jryberg/nagios-plugins/tree/master/check_salt-minion – Dirk Mar 09 '17 at 09:59

7 Answers7

6

In case by monitoring you mean operating salt, you can try one of the following:

These GUI will allow you more than just knowing whether or not minions are alive. They will allow you to operate on them in the same manner you could with the salt client.

And in case by monitoring you mean just whether the salt master and salt minions are up and running, you can use a general-purpose monitoring solutions like:

In fact, these tools can monitor different services on the hosts they know about. The host can be any machine that has an ip address and the service can be any resource that can be queried via the underlying OS. Example of host can be a server, router, printer... And example of service can be memory, disk, a process, ...

Younes
  • 1,635
  • 1
  • 19
  • 33
2

Not an absolute answer, but we're developing saltpad, which is a replacement and improvement of halite. One of its feature is to display the status of all your minions. You can give it a try: Saltpad Project page on Github

ohe
  • 3,461
  • 3
  • 26
  • 50
1

You might look into consul while it isn't specifically for SaltStack, I use it to monitor that salt-master and salt-minion are running on the hosts they should be.

Another simple test would be to run something like:

salt --output=json '*' test.ping 

And compare between different runs. It's not amazing monitoring, but at least shows your minions are up and communicating with your master.

Frank Wiles
  • 1,589
  • 11
  • 13
1

Another option might be to use the salt.runners.manage functions, which comes with a status function.

In order to print the status of all known salt minions you can run this on your salt master:

salt-run manage.status
salt-run manage.status tgt="webservers" expr_form="nodegroup"
Roald Nefs
  • 1,302
  • 10
  • 29
0

I had to write my own. To my knowledge, there is nothing out there which will do this, and halite didn't work for what I needed.

If you know Python, it's fairly easy to write an application to monitor salt. For example, my app had a thread which refreshed the list of hosts from the salt keys from time to time, and a few threads that ran various commands against that list to verify they were up. The monitor threads updated a dictionary with a timestamp and success/fail for each host after they ran. It had a hacked together HTML display color coded to reflect the status of each node. Took me a about half a day to write it.

If you don't want to use Python, you could, painfully, do something similar to this inefficient, quick, untested hack using command line tools in bash.

minion_list=$(salt-key --out=txt|grep '^minions_pre:.*'|tr ',' ' ') # You'
for minion in ${minion_list}; do
    salt "${minion}" test.ping
    if [ $? -ne 0 ]; then
        echo "${minion} is down."
    fi
done 

It would be easy enough to modify to write file or send an alert.

0

halite was depreciated in favour of paid ui version, sad, but true - still saltstack does the job. I'd just guess your best monitoring will be the one you can write yourself, happily there's a salt-api project (which I believe was part of halite, not sure about this), I'd recommend you to use this one with tornado as it's better than cherry version.

So if you want nice interface you might want to work with api once you set it up... when setting up tornado make sure you're ok with authentication (i had some trouble in here), here's how you can check it:

Using Postman/Curl/whatever:

check if api is alive: - no post data (just see if api is alive) - get request http://masterip:8000/

login (you'll need to take token returned from here to do most operations): - post to http://masterip:8000/login - (x-www-form-urlencoded data in postman), raw:
username:yourUsername
password:yourPassword
eauth:pam

  • im using pam so I have a user with yourUsername and yourPassword added on my master server (as a regular user, that's how pam's working)

get minions, http://masterip:8000/minions (you'll need to post token from login operation),

get all jobs, http://masterip:8000/jobs (you'll n need to post token from login operation),

So basically if you want to do anything with saltstack monitoring just play with that salt-api & get what you want, saltstack has output formatters so you could get all data even as a json (if your frontend is javascript like) - it lets you run cmd's or whatever you want and the monitoring is left to you (unless you switch from the community to pro versions) or unless you want to use mentioned saltpad (which, sorry guys, have been last updated a year ago according to repo).

btw. you might need to change that 8000 port to something else depending on version of saltstack/tornado/config.

Tom St
  • 908
  • 8
  • 15
0

Basically if you want to have an output where you can check the status of all the minions then you can run a command like

salt '*' test.ping

salt --output=json '*' test.ping  #To get output in Json Format

salt manage.up # Returns all minions status

Or else if you want to visualize the same with a Dashboard then you can see some of the available options like Foreman, SaltPad etc.

JJJ
  • 32,902
  • 20
  • 89
  • 102
Vipul Sharma
  • 162
  • 3
  • 8