Skip to the page
DataMosaic

Docs · Monitors

Preparing the servers

What to set up so monitors can ask your servers — the Windows firewall and account for Services, a Linux login, share rights for Files, ports for Live Hosts — and how to test each from the machine Mosaic runs on.

Certificates and Websites ask nothing of the servers they look at: a certificate and a page are what a server shows anyone. Live Hosts needs a port that answers. Files and Services sign in, and need the servers to let them. This page is what to set up for each, written for whoever looks after the servers.

Every test on this page is run from the machine Mosaic runs on, since that is where the monitor asks from. A test from your own laptop proves only that your laptop can.

#The account Mosaic runs as

Files reads folders, and Services asks Windows servers with no User named, as the account Mosaic runs as:

  • Started by hand, in a window: the account of whoever started it.
  • Started with the machine, as a service or a task: the account the service runs as. Often the machine's own account, SYSTEM, which other machines in the domain see as the machine's account: EXAMPLE\MOSAIC01$ for a machine called MOSAIC01.

Granting rights to a machine account works, but surprises whoever reads the permissions later. Running Mosaic's service as a named domain account made for it, EXAMPLE\svc-mosaic, is plainer: the shares and servers then name that account.

#Windows servers

For a Services monitor, each Windows server must be reachable over one of two routes, and the account must be allowed to read its services.

#Over RPC

Nothing is switched on: RPC is how Windows' own management consoles ask another machine. It does need the firewall to let it in.

On each server, Windows Defender Firewall has a rule group for it, Windows Management Instrumentation (WMI), off to start with on most server builds. Switch it on for the domain profile, by Group Policy for every server at once, or on one server in PowerShell as its administrator:

Enable-NetFirewallRule -DisplayGroup "Windows Management Instrumentation (WMI)"

The group's name is in the server's language. To find it on a server installed in another one:

Get-NetFirewallRule -Name "WMI-*" | Select-Object -ExpandProperty DisplayGroup -Unique

RPC starts on port 135 and carries on over a port the server picks, between 49152 and 65535. A firewall between the machine Mosaic runs on and the stores must let both through. A network firewall that understands RPC opens the second port by itself; one that does not needs the range. When only 135 gets through, the monitor says It answered on RPC (135) but said nothing more within 10 s.

#Over Windows Remote Management

Where Remote Management is already on, the monitor uses it: one port, 5985, simpler through a network firewall. To switch it on, by Group Policy (Allow remote server management through WinRM) or on one server as its administrator:

Enable-PSRemoting -Force

Remote Management signs in by the server's name, through the domain. Write the servers by name, not by IP address: see the note under How each server is asked.

#The account on Windows

Reading a server's services from another machine is, by Windows' own defaults, an administrator's right. The dependable setup:

  1. A domain account made for this, EXAMPLE\svc-mosaic-monitor, with a long password and nothing else to do.
  2. A domain group, Mosaic monitoring, holding it.
  3. A Group Policy that adds the group to the local Administrators group of the store servers.
  4. The password in a secret variable of the workflow's environment: see Who it asks as.

Two things refuse an account that looks as if it should work:

  • A local account is not enough. An account made on the server itself is refused from another machine even when it is in the server's Administrators group: Windows takes the administrator's rights away from a local account that signs in over the network. Use a domain account.
  • A non-administrator needs three changes on each server: membership of Distributed COM Users (or Remote Management Users, for the Remote Management route); Remote Enable on the WMI namespace root\cimv2; and the right to list services from another machine, which Windows gives only to administrators until the service control manager's security is changed. It can be done, and is worth testing on one server before the estate.

If every service comes out Not installed on a server where you know they run, the account got in and could not list them: it is the third of those.

#Testing it

From the machine Mosaic runs on, as the account the monitor will ask as, in Windows PowerShell:

$option  = New-CimSessionOption -Protocol Dcom
$session = New-CimSession -ComputerName pos-central01 -SessionOption $option -Credential (Get-Credential)
Get-CimInstance -CimSession $session -ClassName Win32_Service -Filter "Name='PosService'" | Select-Object Name, State, StartMode

-Protocol Wsman tests the Remote Management route instead. Leave out -Credential (Get-Credential) to ask as yourself. A row with the service's State is what the monitor will see.

#Linux servers

For a Services monitor, each Linux server needs a login Mosaic can sign in with by password, over SSH on port 22. Reading a service's state with systemctl show needs no root and no sudo, so the login should have neither.

On each server, as root:

useradd --create-home --shell /bin/bash mosaic-monitor
passwd mosaic-monitor

Many servers accept SSH keys only. To let this one login use a password and leave everyone else on keys, add at the end of /etc/ssh/sshd_config:

Match User mosaic-monitor
    PasswordAuthentication yes

and reload SSH: systemctl reload sshd, or systemctl reload ssh on Debian and Ubuntu. Mosaic answers a password prompt whichever way SSH asks: as a password, or keyboard-interactive.

Mosaic does not check a server's SSH key against one kept from before: it has nowhere to keep it yet. That is one more reason for a login that can do nothing but read.

#Testing it

From the machine Mosaic runs on, where ssh is installed (Windows 10 and Server 2019 onwards have it):

ssh mosaic-monitor@pos-central01 systemctl show pos-agent.service --property=ActiveState,UnitFileState

ActiveState=active is what the monitor will show as Running.

#Shares for a Files monitor

A Files monitor reads each folder as the account Mosaic runs as. For a folder on another machine:

  • Write the share's full path, \\fileserver\exports\sales, never a mapped drive letter. A drive letter is mapped for one person's sign-in, and Mosaic running as a service does not see it.
  • Give the account read on both the share and the folder. Windows checks two sets of permissions, the share's and the folder's, and the narrower wins. Read is enough: Mosaic lists the files, their names, sizes and times, and opens none.
  • For a machine account, EXAMPLE\MOSAIC01$, choose Computers as the object type when adding it, or add a group that holds it.
  • For a Certificates monitor reading certificate files, the same, with read on the files themselves: those are opened, to see the certificates in them. An administrative share such as \\store-001\d$ lets in only the server's administrators; a share of the certificate folder alone, read-only, asks for less. On a Linux server, the login needs read on the folder and the files, through a group such as the application's, never by being root.

#Testing it

As the account Mosaic runs as, from the machine it runs on:

Get-ChildItem \\fileserver\exports\sales | Sort-Object LastWriteTime | Select-Object -Last 3

The three newest files, with their times, are what the monitor judges.

#Ports for Live Hosts

A Live Hosts monitor needs one port each server answers on, open from the machine Mosaic runs on: 22 on Linux, 3389, 445, 135 or 5985 on Windows. Nothing listens for it specially; it borrows a port the server already answers on.

Test-NetConnection pos-central01 -Port 3389

TcpTestSucceeded : True is a port to use.

#Certificates your company signs

Certificates and Websites judge a certificate the way every connection out of Mosaic does. Where your company signs its own, trust its root certificate once under Tenancy → Network, and every monitor, check and connection trusts what it signs.