====== Vibemosphere Services ====== Service pools (expressions such as *bauer*): state of the services, start / stop (time-out, then kill) / restart through the page and the REST API at /status/services. ^ Id | ''services'' | ^ Role | ''monitoring'' - needed for the page and the REST API (administrators always may) | ^ Page | **Plugins > Open** (overlay with an X at the top right) or ''/plugins/services/'' | ^ REST | ''/api/plugins/services/...'' and, for callers with the role, ''/plugins/services/...'' | ^ Mount | ''/status/services'' | ===== Open the configuration ===== In the administration open **Plugins**, select the row of this plug-in and press **Open**. The page opens in an overlay dialog: close it with the **X** at the top right, with Esc or by clicking outside; //Open in a new tab// next to the title shows it full size. {{vibecat:plugin-services.png?900|Vibemosphere Services: the plug-in page in its overlay dialog}} ===== Step by step ===== - Press **New pool**: an id and a name, then the **include** patterns (wildcards such as ''*bauer*'' or regular expressions) and optional **exclude** patterns. - Set the stop time-out (a service that does not stop within it is killed). The pool shows how many of its services run. - Use Start all / Stop all / Restart all, or the REST API at ''/status/services'' (role ''monitoring'' reads, an administrator controls). ===== The page in detail ===== {{vibecat:plugin-services-full.png?900|services: first tab, Pools}} ===== Tabs ===== The page is divided into the tabs **Pools**, **Operations**, **Settings**. ==== Operations ==== {{vibecat:plugin-services-tab2.png?900|services: tab Operations}} ==== Settings ==== {{vibecat:plugin-services-tab3.png?900|services: tab Settings}} ===== Fields and columns ===== ^ Label ^ Meaning ^ | Pool | | | Id | Letters, digits, . _ - ; used in the REST URL | | State | | | Stop time-out (s) | Then the process is killed | | Start time-out (s) | | | One after the other | Default: all services of the pool at the same time | | Description | | | Service | | | Display name | | | PID | | | Expression | | | Stop time-out (seconds) | | | Start time-out (seconds) | | | Service list cached (seconds) | | | Pools | Column of a table | ===== Actions ===== * **Save** * **Start all** * **Stop all** * **Restart all** * **Refresh** ===== Notes from the page ===== * Expressions, one per line: *bauer* (wildcards * and ? , the whole name; no wildcard = exact name), re:^pimia-.* or /regex/ (regular expression, found anywhere). The name and the display name are compared, case-insensitive. A service is controlled only when a pool contains it. * A pool may set its own time-outs. * Roles: monitoring reads, services (plus monitoring ) controls, admin edits pools. Replace host and port by a web port of this Vibecat. ===== Reference ===== Shows the services of the computer (Windows services, systemd units) in **pools** and starts, stops and restarts them. The page is at ''/status/services'' on the administration port, the REST API at ''/status/services'' on every web port (the Plug-in REST valve; ''/plugins/services'' works too). Data: ''plugin-data\services\settings.json''. ==== Pools and expressions ==== A pool has expressions (include) and optional exceptions (exclude). An expression is compared with the service name and the display name, case-insensitive: ^ Expression ^ Meaning ^ | ''*bauer*'' | wildcards ''*'' and ''?'', the whole name: ''pimia-bauer'', ''vibecat-bauer'' | | ''pimia-bauer'' | no wildcard: exactly this name | | ''re:^pimia-(bauer%%|%%huber)$'' or ''/^pimia-/'' | regular expression, found anywhere in the name (anchor it with ^ and $) | A service may be in several pools. Only services that are in a pool can be controlled. ==== Stop, kill, restart ==== **stop** asks the service manager to stop the service and waits for the state //stopped//. After the stop time-out (default 30 s; per pool, in the settings or ''?timeout='') the process is killed (Windows: ''taskkill /F /T'', not for services in the shared ''svchost.exe''; systemd: ''systemctl kill -s SIGKILL'') unless ''kill=false''. **start** waits for //running// (start time-out). **restart** = stop (with kill), then start. **kill** kills at once. Pools run all services at the same time unless ''sequential'' is set. An operation on a service that is busy answers ''busy''. ==== REST ==== ^ Call ^ Role ^ Answer ^ | ''GET /status/services'' | monitoring | JSON: overall, counts, pools with services and states, text | | ''GET /pools'', ''GET /pools/'' | monitoring | pool(s); ''?services=true'' adds the services | | ''GET /services?pool=&state=&q='', ''GET /services/'' | monitoring | services of the pools (flat); one service | | ''GET /discover?q=*bauer*'' | monitoring | every service of the computer that matches, with its pools | | ''POST /services//start%%|%%stop%%|%%restart%%|%%kill'' | services | operation | | ''POST /pools//start%%|%%stop%%|%%restart%%|%%kill'' | services | operation (''?service=name'' limits it to one member) | | ''GET /operations'', ''GET /operations/'' | monitoring | last operations, with the result per service | | ''POST /pools'' (JSON), ''DELETE /pools/'', ''PUT /settings'' | admin | edit pools and settings | Parameters of the control calls: ''timeout'' (seconds, stop and start), ''stopTimeout'', ''startTimeout'', ''kill=false'', ''sequential=true'', ''wait=false'' (return the operation at once and ask ''/operations/''; default: wait until it is done). Operation result per service: ''ok'', ''restarted'', ''killed'', ''timeout'', ''failed'', ''busy''. curl -u monitor:secret http://host:8080/status/services curl -u ops:secret -X POST "http://host:8080/status/services/pools/bauer/restart?timeout=30" curl -u admin:secret -X POST http://host:8080/status/services/pools -H "Content-Type: application/json" \ -d '{"id":"bauer","name":"Bauer","include":["*bauer*"],"exclude":["*test*"],"stopTimeoutSeconds":30}' Users: a reader has the role ''monitoring''; a user that controls has ''monitoring'' and ''services''. Stopping the service that runs Vibecat itself ends this plug-in too: leave it out of the pools. [[vibecat:plugins:start|All plug-ins]]