Simon script example: Show & Screenshot

One of the major strengths of Simon, my website and server monitoring tool, is the flexibility it offers through the ability to write custom scripts in many scripting languages. Simon is plenty useful with the built-in services, filters, and notifiers, but the ability for customers to enhance it themselves makes it even better.

There are several script-based services, filters, and notifiers built in to the app, and others can be downloaded from the Simon Extras page.

One such example is the Show & Screenshot notifier script (click that link to download it). To install it, go to the Notifiers page in Simon, add a new notifier, choose Script for the notifier kind, click the Open Script… button, and choose the downloaded script.

This script simply opens the page in the default web browser, waits a few seconds for the page to render, then takes a screenshot of it. By default it’ll wait 10 seconds, and save to the Desktop, but you can customize those values; enter the path of a folder to save them to (the folder must already exist). Also specify how long to wait before performing the screenshot, in seconds:

Browser screenshot

And of course to use the notifier, specify it in the Notifiers page of a test:

Use notifier

Note that when this notifier is first used, macOS will ask for permission to capture the screen; until you grant that, it’ll capture an empty desktop.

Check out the Simon Extras page for other scripts. And if you create a useful script for Simon, please share it with others!

Simon 5.1 released

I’m pleased to announce the general release of an update of my website and server monitoring app for macOS: Simon version 5.1.

It includes the ability to disable rendering a Web Page test, the addition of an automatic data backup, support for macOS Ventura, updated example tests, and several other improvements and fixes.

Please Note

  • Simon 5.1 requires a minimum of macOS 10.13 (High Sierra).

New Web Page test option to render the page in the Preview

  • Added a new option to the Other page when editing a Web Page test to control whether or not to render the page in the Preview.
  • By default it is on, preserving the usual behavior.
  • But if you turn it off for a test, the Preview pane only shows the HTML source and filter output, instead of the rendered page.
  • Reload the Preview to show or hide the rendered page after changing the option.
  • This option is independent of the “Capture rendered source” option; that will render the page in a separate process.
  • This is useful for performance, or if you want to minimize the risk of malicious JavaScript on the page, or other side effects.

Web Page render option

Added an automatic data backup

  • Once per hour Simon will make a copy of its data into a dated folder within a Backups folder in the data folder.
  • Added a slider on the Advanced settings page to control how many backups to keep; defaults to 10.
  • Set to zero to disable the automatic backups.
  • When the maximum has been reached, it’ll remove older ones, so that half of the backups are for the most recent hours, and half are for previous days.
  • If you need to restore your data, turn off syncing if it’s on, use the new File ▸ Reveal Data Folder menu command to show the data folder in the Finder, quit Simon, then copy the folders from one of the backup folders to replace the Filters, Notifiers, etc folders.
  • If in doubt, contact Dejal for assistance.

Backups

Support for Ventura

  • Updated for Ventura (macOS 13), but still compatible back to High Sierra (10.13).

Plus several other improvements

  • Updated the example tests.
  • Added a File ▸ Reveal Data Folder menu command, to show the Simon data folder in the Finder.
  • Added an option on the Advanced settings page to show the Debug menu, as an easier way to toggle it.
  • Fixed filters not completing if the {FilterStatusNumber} variable was used.
  • Fixed an issue with loading data that doesn’t have any reports.
  • Fixed an issue with the font in the script editor and elsewhere.
  • Fixed a localization issue, and updated the French localization.
  • Fixed a crash with the Preview.

Want to try it?

If you are using the Setapp edition, it will handle that update for you.

If you are using the direct edition, you can use the Check for Updates feature in the app to update.

Otherwise, download Simon 5.1 now!

Simon’s preview pane

As you know, Simon is a website and server monitoring tool. This mouthful is to try to describe two of the levels at which Simon operates. At the very basic level, Simon is a very simple utility to watch web pages, and let you know when they change or go down. But Simon has much more depth to it — it enables you to monitor all sorts of internet servers and services, local applications, disk volumes, and more.

The Preview pane has this duality, too. When used with a web-based test (i.e. one using the Web Page service), it displays the rendered web page and graphics on the left (which can be interacted with like in a web browser), and the HTML source, web page headers, and filter output on the right:

Web preview

This is really handy, both to quickly see the page while in Simon, without having to switch to a web browser (which is easy too, via the File ▸ Visit Site command), and when setting up the test in the first place.

The service and filter output are useful, too; you can see the HTML (or other) output, and the output of each filter.

The filters are one of Simon’s key features. This is a page of the test editor, where you can tell Simon to only look at the HTML source between two blocks of text, or find required text, or evaluate numbers, or reformat text, and much more. This enables you to focus on the part of the page you care about, and avoid dynamic portions like banner ads etc. You can easily set this up via the Preview window. With the test editor open, after entering the URL, show the Preview to display the preview of the page. Then search through the HTML source for interesting portions of the text (click in the HTML then press ⌘F to find text), select it, copy the relevant text, and paste into filter fields.

For example, here’s Apple’s RSS feed, with filters to extract and format the title and body text of the latest news:

RSS prevoew

As useful as this is, it’s not done yet. The Preview is also supported by many other services, in a slightly different way. For non-web services, the Preview looks much the same, but without the rendered content. Instead of the HTML source, it shows the output of the service. This is all plain text, since that’s what these services deal with.

For example, here’s the preview of a Ping test:

Ping preview

These services support the filters, too: just like with web pages, you can use filters to analyze the output and extract interesting nuggets.

I hope you’ll use the Preview to good advantage when configuring and using Simon.

Simon’s automatic offline support

A useful feature of Simon is how it handles the situation when your computer loses its internet connection.

People sometimes ask me what Simon does in this situation, concerned that it would count as a failure for tests. Simon is smarter than that, though. Every time it starts a check, it first checks if the computer has a current internet connection, and only then performs the check.

If it determines that your internet connection has been disrupted, it places the test in an “offline” state, where it shows a blinking “lightning bolt” for the status icon until the connection is restored. This offline state doesn’t count as a failure (or success).

Simon works out if you have a connection by seeing if it can resolve one of two popular domain names; if either work, your connection is probably fine, but if both fail, it is likely disconnected. Using two domains avoids a temporary outage of either one.

You can disable this internet connection check on a per-test basis via the Can check when offline checkbox on the test editor’s Options page. This is useful if you want to create a test to notify you when your connection goes down, or for tests that don’t require an internet connection (e.g. using the Application or Script service kinds):

Offline option

Simon 5.1b2 released

A second beta of Simon version 5.1 is now available. Version 5.1b2 just has a few improvements:

  • Added an option on the Advanced settings page to show the Debug menu, as an easier way to toggle it.
  • Updated the example tests.
  • Updated French localization.

As a reminder, version 5.1 includes lots more changes since the previous release, including:

New Web Page test option to render the page in the Preview

  • Added a new option to the Other page when editing a Web Page test to control whether or not to render the page in the Preview.
  • By default it is on, preserving the usual behavior.
  • But if you turn it off for a test, the Preview pane only shows the HTML source and filter output, instead of the rendered page.
  • Reload the Preview to show or hide the rendered page after changing the option.
  • This option is independent of the “Capture rendered source” option; that will render the page in a separate process.
  • This is useful for performance, or if you want to minimize the risk of malicious JavaScript on the page, or other side effects.

Added an automatic data backup

  • Once per hour Simon will make a copy of its data into a dated folder within a Backups folder in the data folder.
  • Added a slider on the Advanced settings page to control how many backups to keep; defaults to 10.
  • Set to zero to disable the automatic backups.
  • When the maximum has been reached, it’ll remove older ones, so that half of the backups are for the most recent hours, and half are for previous days.
  • If you need to restore your data, turn off syncing if it’s on, use the new File ▸ Reveal Data Folder menu command to show the data folder in the Finder, quit Simon, then copy the folders from one of the backup folders to replace the Filters, Notifiers, etc folders.
  • If in doubt, contact Dejal for assistance.

Support for Ventura

  • Updated for Ventura (macOS 13), but still compatible back to High Sierra (10.13).

Plus several other improvements

  • Added a File ▸ Reveal Data Folder menu command, to show the Simon data folder in the Finder.
  • Fixed filters not completing if the {FilterStatusNumber} variable was used.
  • Fixed an issue with loading data that doesn’t have any reports.
  • Fixed an issue with the font in the script editor and elsewhere.
  • Fixed a localization issue.
  • Fixed a crash with the Preview.

Want to try it?

If you are using the direct edition, you can change your Updates settings to include beta releases, then use the Check for Updates feature in the app to update.

Otherwise, download the beta now!

Can Simon notify via email?

I sometimes receive a question from a potential customer, asking whether Simon has the ability to send a notification via email.

Although I do mention it in a number of places, this isn’t an unreasonable question, particularly if you just download Simon and start playing with it, as no email options appear in the list of available notifiers in the Edit Test pane by default.

Why is this? Because unlike the Speech and Sound kinds of notifiers, the Email one requires some configuration before it can be used, so it can’t be offered by default.

The way notifiers work is (I hope) pretty intuitive, but a little indirect. Simon provides a number of notifier kinds that do the work of notifications, and you configure notifiers to use those, then choose notifiers for each test.

These levels of abstraction allow easy re-use of notifiers: a single kind of notifier can be used by multiple notifiers, and a single notifier can be used by multiple tests, without having to set up the same things over and over again.

For example, you can add a notifier to email yourself for some failures, another email notifier to your clients for other failures, another one for recoveries, and so on, and use whichever ones of those are desired in tens or hundreds of tests, as required, as simply as choosing them from a pop-up menu.

So, as I said, there is no email notifier set up by default, since it needs configuration, but you can easily add one. If you’re editing a test and realize that you want to receive an email when this test changes, fails, and/or recovers, you can click the New Notifier… button in the Notifiers section of the Edit Test pane, which will switch to the Notifiers page, and start editing a new notifier. You can then choose Email from the Notifier Kind pop-up menu, and the controls below will change to those for an email, with a sample email pre-populated, which you can edit as desired:

New notifier

You can then configure the email To etc fields, plus switch to the Name page to give the notifier a name, and perhaps the Options page to indicate whether this notifier is available for changes, failures and/or recoveries.

Once it all looks good, click Done to save the notifier. You can check that it is set up correctly by choosing the File ▸ Notify Now menu command; that will send an email with placeholder values. If you don’t receive the email, check the notifier settings.

The new notifier will then be available for that test and any others you want to use it in:

Test notifiers

Easy!

What are the differences between the direct, Mac App Store, and Setapp editions of Time Out?

The direct edition (available from this site), the Mac App Store edition, and the Setapp edition are very similar, but there are a few minor differences:

Download

The direct edition can be downloaded from this site.

The Mac App Store edition can be downloaded from the App Store app.

The Setapp edition can be downloaded from the Setapp app.

Installation

The direct edition will download to your Downloads folder, so simply drag it into your Applications folder to install.

The Mac App Store edition will be downloaded directly into the Applications folder.

The Setapp edition will be downloaded directly into the Setapp subfolder within the Applications folder.

Updates

The direct edition can be updated via an in-app updater.

The Mac App Store edition can be updated via the App Store app.

The Setapp edition can be updated via the Setapp app.

Beta releases

The direct edition supports beta releases to help test new updates.

The Mac App Store and Setapp editions are not updated until the general release.

Purchase

The direct edition offers optional in-app purchases via FastSpring (or from this site).

The Mac App Store edition offers optional in-app purchases via your Apple ID (Apple iCloud account).

The Setapp edition doesn’t offer any purchase; all features are always available as part of your Setapp subscription.

Proceeds

The direct edition provides 91% of the purchase price to me, the developer (after FastSpring’s cut).

The Mac App Store edition provides 85% of the purchase price to the developer (after Apple’s cut).

The Setapp edition provides a portion of your Setapp subscription to the developer, based on the number of people using it each month.

Sandbox

The direct and Setapp editions are not sandboxed, to enable updating, though they act with the same limitations as a sandboxed app.

The Mac App Store edition is sandboxed, requiring extra steps to approve keyboard usage detection and install action scripts.

Data location

The direct edition stores its data in the path “~/Library/Group Containers/6Z7QW53WB6.com.dejal.timeout/”, where “~” means your home folder.

The Mac App Store edition stores its data in the path “~/Library/Group Containers/6Z7QW53WB6.com.dejal.timeout.free/”, where “~” means your home folder.

The Setapp edition stores its data in the path “~/Library/Group Containers/6Z7QW53WB6.com.dejal.timeout-setapp/“, where “~” means your home folder.

Your choice

That’s about it. None of the differences are all that significant, so you are welcome to use whichever edition you prefer. Downloading and updating are about as easy for each, and purchasing the direct and Mac App Store editions are similar, it just depends on whether you want to buy with your credit card or PayPal account, or your Apple ID. Of course, purchasing is optional; you can use it for free if you don’t want to become a supporter. And if you have Setapp, it makes sense to use that edition, since it’s included in your Setapp subscription.

I get a warning of another copy of Time Out

Look in your Dock and menu bar; does Time Out appear more than once?

If it’s in the Dock more than once, you can long-click or right-click on the Dock icon to display the Dock menu for the app, then choose Options ▸ Show in Finder to reveal the app in the Finder. Do this for each to find the one that shouldn’t be there — it could be in your Downloads folder, or in a subfolder of Applications if you installed both from the Dejal site and the Mac App Store.

Once you find the duplicate, quit that app (by double-clicking the app icon to bring it to the front, then press ⌘Q), then move it to the Trash and empty the Trash.

Can I move the Time Out break controls, or change the buttons?

Yes, the control panel with the progress bar and buttons, that appears during breaks, can be freely moved anywhere on the screen. The position will be remembered for next time.

Having difficulty with self control, skipping breaks too often?

No problem: you can disable the buttons during the break. Simply go to the Break Appearance page, and you’ll find checkboxes to enable or disable each button, and change the number of minutes for the two postpone buttons.

There are also options to disable the buttons for a few seconds, to give you a chance to decide if you really want to skip the break. And to limit the number of times they can be used, if you need a little more help.

Break controls

No Time Out break appears when I try to start one

If no break appears when you manually start one, or as scheduled, there are a few possibilities.

  1. Firstly, look in the sidebar; it should indicate why a break didn’t occur.
  2. You should restart your Mac. That often fixes wackiness.
  3. If that doesn’t help, make sure you don’t have more than one copy of Time Out.
  4. If still no luck, there may be a permissions issue.

To fix a permissions issue, try this:

Make sure Time Out is in your Applications folder.

Paste the following command into Terminal:

xattr -d -r -s com.apple.quarantine /Applications/Time\ Out.app

If this gives a permissions error (e.g. “xattr: [Errno 13] Permission denied”), try it again with sudo before the command, to elevate the privileges. You’ll need to enter your Administrator password. This command is safe to use with sudo:

sudo xattr -d -r -s com.apple.quarantine /Applications/Time\ Out.app