Docs · Monitors
Services
Whether the services that should run on each server are running, on Windows and Linux — who it asks as, keeping the password out of the workflow, and what each reason in the Why column means.
A server can answer on every port and still not be doing its job: the point-of-sale service fell over at 06:40, the sync agent was set to start by hand after an update, the database never came back after the reboot. A Services monitor asks each server for the state of the services that should be running on it, and shows one row for each service on each server.
| Status | Colour | Means |
|---|---|---|
| Running | Green | The service is running |
| Starting or stopping | Amber | Caught on its way up or down |
| Stopped | Red | Stopped, or on Linux failed. Why says how it is set to start |
| Not installed | Red | The server answered and has no service of that name |
| No answer | Red | The server could not be asked. Why says why |
| No address | Grey | A store with no server address |
In the answer, status is running, pending, stopped, missing, unreachable or nohost.
Mosaic only reads. It never starts, stops or restarts a service.
#Before you start
- Mosaic on your own server, inside the network, with the host switch on. Asking other machines is a host feature: off on Mosaic Cloud, and off on a 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. - For Windows servers, Mosaic running on Windows. It asks them through Windows PowerShell, which is only on Windows.
- An account the servers let in, and its password in a secret variable. See Who it asks as.
- The servers ready to be asked. On Windows, the firewall and the account's rights; on Linux, a login with a password. See Preparing the servers.
#Setting it up
Press + beside Monitors and choose Services. Under Look at, choose a list or the stores.
| Field | Notes |
|---|---|
| Servers | For a list, one a line: a server's name or address. A name before a | is shown in the table |
| Services | With commas between them, 20 at most: PosService, StoreSync. See Naming the services |
| The servers run | Either, Windows or Linux. See How each server is asked |
| User | Who to ask as: DOMAIN\name or name@domain on Windows, a login on Linux. Empty, a Windows server is asked as the account Mosaic runs as. Linux always needs one |
| Password variable | The name of the secret variable that holds the password: STORE_PASSWORD. Never the password itself |
| Environment | The environment the workflow runs in, which holds that variable. The setup says so when it has none of that name |
| Wait (seconds) | 10 to start with |
| Check every (minutes) | 5 to start with |
An example list for a head office:
Central POS | pos-central01.example.local
Price server | price01.example.local
Integration | int-app01.example.local#Naming the services
A Windows service by its name or its display name: PosService or Store POS Service. The name is the one Get-Service shows in its Name column, and the Services console in each service's properties. Case does not matter.
A Linux service by its unit: pos-agent or pos-agent.service. A name without a dot is taken as a .service.
* stands for any run of letters: Oracle* catches every service whose name or display name starts Oracle, and each one found is a row of its own. A name that finds nothing on a server is Not installed there.
Ask for the same names on every server of the monitor. Servers that run different services belong in separate monitors: the store servers in one, the central systems in another.
#Who it asks as
On Windows, with User empty, each server is asked as the account Mosaic runs as. Where Mosaic runs as a named domain account that the servers let in, nothing more is needed. Where it runs as the machine's own account (SYSTEM), the servers see the machine's account in the domain, which is rarely an administrator of them, so name a User.
On Linux, a user and a password are always needed: Mosaic logs in over SSH with them.
The password never sits in the workflow. A workflow is read by everyone who can open it, and a password typed into it would be saved with it. So:
- Under Environments, open the environment the workflow will run in, such as Production.
- Add a variable,
STORE_PASSWORD, holding the password, marked secret. - In the setup, write
STORE_PASSWORDunder Password variable and choose that environment under Environment.
The node is written {{ STORE_PASSWORD }}, and the password is read from the environment each time it runs. A password typed straight into the node is refused when it runs, and so is a variable the environment does not hold. User can be a variable too: {{ STORE_USER }}.
The account should be one made for this, used for nothing else, that can read services and do nothing more on Linux. See Preparing the servers.
#How each server is asked
Windows, through CIM, as Get-Service and Get-CimInstance Win32_Service ask:
- over Windows Remote Management (port 5985) where the server answers on it,
- over plain RPC (port 135) where it does not.
Most store estates never switched Remote Management on, and RPC needs nothing switched on: it is how Windows' own management consoles have always asked another machine. The servers are asked eight at a time.
Linux, over SSH (port 22), with systemctl show, which any user who can log in may run; no root and no sudo. A failed unit is Stopped. The servers are asked sixteen at a time.
Either, which is where it starts, knocks first: a server that answers on 5985 or 135 is Windows, one that answers on 22 alone is Linux, and one that answers on none is No answer at once, without waiting for a login to time out. Choose Windows or Linux where every server is the one or the other, and the knock asks only their ports.
#The table
| Column | Field | Holds |
|---|---|---|
| Store and Code, or Name | name, code | Who |
| Server | host | The address asked |
| Service | service | The service's name; for a name that found nothing, the name asked |
| Status | status | As above |
| Starts | startMode | How it is set to start: Auto, Manual or Disabled on Windows; enabled, disabled or static on Linux |
| System | system | windows or linux: how the server was asked |
| Why | error | Empty while running |
| Checked | checkedAt | When it was asked |
displayName and state, the state as the server said it (Running, Stopped, Start Pending on Windows; active (running), inactive (dead), failed (failed) on Linux), are there to add under Display.
Starts is half the story of a red row. A stopped service set to start by itself has fallen over; one set to start by hand was perhaps never meant to run; a disabled one was stopped on purpose.
#What Why says
| Why | Means | What to do |
|---|---|---|
| Store POS Service is stopped, though it is set to start by itself. | It has fallen over, or was stopped by someone | Start it, and look at the server's event log for why |
| … is stopped, and it is started by hand. | Its start type is Manual | If it should always run, set it to Automatic |
| … is stopped, and it is disabled. | Someone switched it off | Ask why before starting it |
| No service called PosService on pos-central01.example.local. | The server answered and has no such service | Check the name with Get-Service or systemctl list-units on that server |
| None of the ports a server is asked on answers: 5985, 135, 22. | Nothing answered the knock | The server is down, or a firewall stops all three. See Preparing the servers |
| Neither Windows Remote Management (5985) nor RPC (135) answers. | The same, with Windows chosen | Open 135 or 5985 to the machine Mosaic runs on |
| SSH (22) does not answer. | The same, with Linux chosen | Open 22 to the machine Mosaic runs on |
| It answered on RPC (135) but said nothing more within 10 s. | Port 135 is open, and the ports RPC carries on over are not | Let the server's dynamic RPC ports through: see Windows servers |
| It answered on Windows Remote Management (5985) but said nothing more within 10 s. | Remote Management took the connection and did not answer | The server is very busy, or Remote Management is unwell on it |
| Access denied: the account asking may not read the services there. Name a user who may, or run Mosaic as one. | Windows let the account in, and not to read services | See The account on Windows |
| The WinRM client cannot process the request … | Remote Management will not talk to that address as written | Write the server by its name. See the note under How each server is asked |
| SSH refused that user and password. | The login failed | Check the user, and the variable's value in the environment; check the server accepts passwords. See Linux servers |
| SSH did not answer within 10 s. | Port 22 is open and the login did not finish | The server is slow, or SSH is unwell on it |
| A Linux server is asked over SSH, which needs a user and a password. | User is empty and the server is Linux | Name a user and a password variable |
| A Windows server is asked through Windows PowerShell, which needs Mosaic to run on Windows. | Mosaic runs on Linux and the server is Windows | Run this monitor on a Mosaic installed on Windows |
| The server is shutting down. | Caught mid-reboot | Look again at the next check |
| No address. | The store has no server address | Fill it in under Business Locations |
Some problems stop the whole run rather than one row, and show in the workflow's executions rather than on the page: a password typed into the node, a variable the environment does not hold, or services named in a way that cannot be asked.
#Host keys
Over SSH, a server's own key is not checked against one kept from before: Mosaic has nowhere to keep it yet. On a network you do not trust end to end, give the monitor a user that can do nothing but log in and read, as Linux servers describes.