Skip to the page
DataMosaic

Docs · Monitors

How monitors work

What a monitor is, the five kinds and what each needs before you start, the monitor's page, its display, the workflow behind it, and how to be told when something goes red.

A Check asks whether two systems agree. A monitor asks a plainer question, every few minutes: is it up? Is every store's server answering? Is the point-of-sale service running on each of them? Does the web shop's certificate run out this month? Did last night's sales files arrive?

A monitor is a page in the tree, in its own Monitors section between Checks and Apps. Each one is drawn from the last answer of a workflow: a table of what the workflow found, one row for each thing it looked at, with a coloured dot and a word for its state, and the counts of each state above it.

#The five kinds

The + beside Monitors offers five kinds. Each has a page of its own in this manual:

KindAsksEvery
Live HostsWhether each server answers on a port5 minutes
CertificatesWhen each TLS certificate runs out, and whether it would be accepted6 hours
WebsitesWhether each web address answers with the right page, and how fast5 minutes
FilesWhether the files that should arrive have, and the ones that should leave did15 minutes
ServicesWhether the services that should run on each server are running5 minutes

The last column is where each starts. Each monitor's setup has a Check every (minutes) you can change, from once a minute to once a day.

#Before you start

What each kind needs, so the first check comes back green rather than full of reasons:

Live HostsCertificatesWebsitesFilesServices
Works on Mosaic CloudPublic addresses onlyPublic addresses onlyPublic addresses onlyNoNo
Needs Mosaic started with MOSAIC_ACTIONS_HOST=onNoNoNoYesYes
Needs each store's server address in Business LocationsYesFor the storesFor the storesFor the storesFor the stores
Signs in to the serversNoNoNoAs the account Mosaic runs asYes: see Services
Something to set up on the serversA port that answersNoNoShare rightsYes

Three of those deserve a word:

  • Where Mosaic runs. A store's server, its tills and its back office are almost always inside a private network. Mosaic Cloud does not call addresses inside a network, so a monitor of them belongs on a Mosaic installed inside it. See Run Mosaic.
  • The host switch. Files and Services read folders and ask other machines from the machine Mosaic runs on. That is a host feature: off on Mosaic Cloud, and off on your own server until whoever runs Mosaic starts it with MOSAIC_ACTIONS_HOST=on. The setup says so when it is off. See Commands, scripts, code and files.
  • A network that answers for everyone. Some security gateways and tunnel clients complete every connection themselves, whether or not a machine is there. A monitor behind one sees every address as up. Test once with an address you know has no machine: it must come out red. See Live Hosts.

#A list, or the stores

Certificates, Websites, Files and Services ask about one of two sets of things, chosen under Look at.

A list is written in the setup, one a line. Use it for the central systems, which are not stores: the web shop, the ERP portal, the payment gateway, the share the nightly exports land in. A name before a | is shown in the table:

Web shop | https://shop.example.com
Payment gateway | https://pay.example.com/health
# The old portal, back in March
# Old portal | https://portal.example.com

Blank lines, and lines starting with #, are left out, which is how to set a line aside without losing it.

Stores are the places a place query chooses, each one's server address read from a place property, the way Live Hosts reads them:

FieldNotes
StoresWhich places: $Country = Italy AND $Fascia = Outlet. Empty is every open place. It says how many match as you type
Server addressThe place property that holds each store server's hostname or IP. It says how many of the places have one

Websites and Files then ask for a pattern with {host} where each store's address goes: https://{host}:8443/, \\{host}\pos\outbox. A store whose property is empty comes out No address, in grey, and is not looked at.

The workflow starts with Items from a list for a list and Places from Business Locations for the stores. Switching one for the other under Settings swaps that node where it stands, and leaves the rest of the workflow as it is.

#Making one

  1. Hover over Monitors in the tree and press +.
  2. Choose the kind.
  3. Fill in the setup. Each field has a line under it saying what it takes, and every kind starts with values that work for most estates.
  4. Press Create monitor.

Mosaic builds a workflow, switches it on and opens the monitor, which checks straight away. From then on the workflow's schedule checks it.

#The monitor's page

At the top: the monitor's name, its kind and when it was last checked, with Workflow, Settings and Display.

Below, a bar:

  • The counts. One for each colour on the page, word then number: Running 212, Stopped 3. Click one to show only those rows; All shows them all again. Where one colour covers several states, the count names them: Expired / Not trusted 3.
  • Search. Narrows the rows to those holding what you type, in any column. Press / to jump to it.
  • Check now. Runs the workflow at once rather than at its next scheduled time.

Then the table, one row for each thing looked at.

While the page is open, it reads the answer again every 30 seconds. A monitor keeps up to 5,000 rows of an answer; one that held more says how many it shows of how many.

#The Why column

Every kind has a Why column, empty while a row is fine and saying what is wrong when it is not: Refused: the machine answered, but nothing is listening on any of 22, 3389. Answered 503, not 2xx, 3xx. Store POS is stopped, though it is set to start by itself. Each kind's page lists what its Why can say, what each one means and what to do about it.

#Settings

Settings reopens the monitor's setup, filled in from its workflow: what it looks at, what counts as a problem, the wait and how often. Saving writes them back into the workflow's nodes and checks again at once.

The workflow is the one place those settings live, so its canvas shows the change, and a change made on the canvas shows in Settings. A workflow rebuilt by hand without the nodes they live in has no settings to show, and the page says so.

#Display

Display decides how the answer is drawn:

  • Which fields of the answer are columns, in what order, under what heading.
  • Which columns are shown as a status. Each value a status column can hold is given a colour (green, amber, red or grey) and a word: online is a green dot and Online. * stands for any value not named above it.

Each kind starts with its own columns, listed on its page. The answer holds more fields than the table shows: a certificate's fingerprint, a page's final address after redirects, a service's display name. Add them as columns under Display. From then on the columns are yours, and Settings leaves them alone.

#The workflow behind it

Under each monitor in the tree, a Workflow folder lists the workflows that feed it: every workflow with a Show on a monitor node that names it.

It is an ordinary workflow:

  1. A schedule trigger.
  2. Items from a list or Places from Business Locations: one item for each thing to look at.
  3. The node that looks: Check a port, Read a certificate, Check a web address, Check a folder or Check services. Each is in the node picker for any workflow. See Workflow nodes.
  4. Show on a monitor: what reaches it becomes the monitor's answer.

So it can do more than the setup asks. Put a Filter before Show on a monitor to drop rows nobody needs to see. Swap Check a port for a Run a script that asks each till for its software version. Anything that ends in Show on a monitor draws on the page.

#Being told when something goes red

A monitor is a page; it does not mail anyone by itself. Its workflow can. Show on a monitor passes its items on, so whatever follows it sees every row:

  1. Open the monitor's workflow from Workflow.
  2. After Show on a monitor, add a Filter that keeps the red rows: Text, {{ $json.status }} is in stopped, missing, unreachable for Services, offline for Live Hosts, down for Websites, and so on. Each kind's page lists its values.
  3. After the Filter, add Send an email or Post to chat, set to one message for each item, with a subject such as {{ $json.name }}: {{ $json.service }} is {{ $json.status }} and Why in the message: {{ $json.error }}.

Mail needs a mail server where Mosaic runs. See Send an email.

#On the Overview

A monitor can be a tile on the Overview: its counts, one figure, what needs attention, or the whole table.

#Who can do what

A viewer reads a monitor. Making one, changing its settings or display, pressing Check now and deleting it are an administrator's, as building a workflow is.

A monitor that has never been checked checks itself once, the first time an administrator opens it.

Deleting a monitor moves it to the bin and switches off the workflows that feed it. They are kept, not deleted. Restoring the monitor brings back its page; switch its workflows on again to have it checked.