Process / Log file / Application monitoring app?

Hey all, first post. I asked in the Keyboard Maestro forum, but this place might be more ‘on topic’.

I was wondering if anybody knows of a good process monitoring app.

Requirements:
Watch processes (by name) on my mac to make sure they are running
Notify me if processes are down / not running

Nice to have:
Monitor ‘other’ things (web sites, files, etc…)
Track stats (uptime, etc…)
Monitor log files

I’ve used ‘Simon’ by Dejal, but it’s SUPER buggy, and the latest version has lost all my custom monitoring scripts.

You could use a shell script and display the results on the desktop using GeekTool, or in the menu bar using BitBar.

1 Like

well that’s a bummer. I own the app and have always meant to get it set up and running, but this doesn’t really encourage me to take the time to do that.

Are these Mac apps, or some kind of background process, or…?

macOS does have the ability to keep a process running (automatically reload it if it crashes) using launchd.

As for the rest, well, I’m not aware of apps that do those things, but I’d be tempted to write a shell script to log whatever it is you wanted to log. (He said, surprising no one.)

Let me know specifics and I might be able to help with parts of it.

Thanks for the responses!

I do like the “keep it simple” approach to just custom shell scripts and BitBar.

Yes, they’re mac apps, and they are indeed managed by launchd, but sometimes they fail in ways launchd cannot recover, it’s at these times I want to be notified.

I’d need more information before I could really suggest something more specific, but here is an example launchd plist which is going to keep a specific app (BBEdit) running all of the time, no matter what, from the time that I log in to my Mac until the time I log out.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>KeepAlive</key>
	<true/>
	<key>Label</key>
	<string>com.tjluoma.keepalive-bbedit</string>
	<key>ProgramArguments</key>
	<array>
		<string>/usr/bin/open</string>
		<string>-W</string>
		<string>-a</string>
		<string>BBEdit</string>
	</array>
	<key>RunAtLoad</key>
	<true/>
</dict>
</plist>

To those who don’t speak launchd – what the above does it tells launchd to run the program

/usr/bin/open -W -a BBEdit

and if that process quits, for whatever reason (either because it crashed or the user manually quit the app), it’s going to re-launch BBEdit. This is going to start when the user logs in and stop only when the user logs out.

The command open -W tells launchd to “wait” until the program (in this case, BBEdit) quits. The -a BBEdit tells open which app to wait for.

I’ve run this before and I’ve never encountered a situation where it did not work unless there was a problem with the application itself.

However, if you wanted to make absolutely sure that BBEdit was always running on your computer, and get notified if it is not, then you could use something like:

pgrep -iq BBEdit

which should tell you if BBEdit is running and what the PID (Process ID) is.

If I was doing this, I would make a shell script that runs every minute or so, and looks like this:

#!/bin/zsh -f

PATH='/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:'

# if BBEdit is running, this program will immediately exit with no output.
pgrep -iq BBEdit && exit 0

echo "BBEdit is NOT running!"

exit 0

Of course if you aren’t there to see the echo command, you’ll need some way to alert yourself. I use

Pushover: Simple Notifications for Android, iPhone, iPad, and Desktop

to send me notifications from shell scripts which send an alert to my iPhone.

As I mentioned, I’d need more information before I could really suggest something more specific.

I use https://healthchecks.io for my monitoring a bunch of systems and processes, including backup systems and web servers.

Recently it detected that the Keyboard Maestro Remote trigger server was not always responding reliably, which turned out to be caused by limits on the number of connections the server could handle (Keyboard Maestro’s user based continues to grow). This was relatively easily solved, but without the monitoring I would not have known it was occasionally failing.

It may or may not meet your needs, but I highly recommend it.

Alongside this is Lingon X for running servers - much easier than editing XML and dealing with launchd manually.

2 Likes

Sorry it took me a while to respond to this, but what I mean by ‘fails in a way launchd cannot recover’ is simply this:

Launchd will not run a broken script. There are cases where I have a script that was running, but breaks either due to a change I made to the way it runs, or an external dependency. In these cases, I need to be notified.

1 Like