Skip to content

Commit

Permalink
bluechictl: doc updates for latest option changes
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Kemel <[email protected]>
  • Loading branch information
mkemel authored and engelmi committed Jan 16, 2024
1 parent c5176eb commit 7ebc2b3
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 10 deletions.
31 changes: 29 additions & 2 deletions doc/docs/getting_started/examples_bluechictl.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ laptop |bluechi-agent.service
pi |bluechi-agent.service | active| running
```

## Monitoring of units and nodes
## Monitoring of units

The `bluechictl monitor <node-name> <unit-name>` command enables to view changes in real-time. For example, to monitor all state changes of `cow.service` on `pi` the following command can be issued:

Expand Down Expand Up @@ -48,10 +48,12 @@ Subscribing to node '*' and unit '*'

This enables an observer to do the necessary re-queries since state changes could have happened while the node was disconnected.

## Monitoring of nodes

In addition to monitoring units, BlueChi's APIs can be used to query and monitor the node connection states:

```bash
$ bluechictl monitor node-connection
$ bluechictl status

NODE | STATE | LAST SEEN
=========================================================================
Expand All @@ -68,6 +70,18 @@ laptop | online | now
pi | online | 2023-10-06 08:38:20,000+0200
```

It is also possible to show the status of a specific node

```bash
$ bluechictl status laptop

NODE | STATE | LAST SEEN
=========================================================================
laptop | online | now
```

In addition, a flag `-w/--watch` can be used with `bluechictl status` to continuously display the nodes status, refreshing on node status change.

## Operations on units

The `bluechictl start` command can be used to start systemd units on managed nodes:
Expand Down Expand Up @@ -114,3 +128,16 @@ $ bluechictl freeze pi cow.service
# revert the previous freeze
$ bluechictl thaw pi cow.service
```

## Print unit status

The `bluechictl status <node-name> <unit-name>` will print the specific unit info and status

```bash
$ bluechictl status laptop httpd.service

UNIT | LOADED | ACTIVE | SUBSTATE | FREEZERSTATE | ENABLED |
---------------------------------------------------------------------------------
httpd.service | loaded | active | running | running | enabled |

```
56 changes: 49 additions & 7 deletions doc/man/bluechictl.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,44 @@ Print current bluechictl version

Performs one of the listed lifecycle operations on the given systemd unit for the `bluechi-agent`.

### **bluechictl** [*enable|disable*] [*agent*] [*unit1*,*...*]
### **bluechictl** [*enable*] [*agent*] [*unit1*,*...*]

Enable/Disable the list of systemd unit files for the `bluechi-agent`.
Enable the list of systemd unit files for the `bluechi-agent`.


**Options:**

**--force**, **-f**
Override existing symlinks

**--runtime**
Enable unit files temporarily until next reboot

**--no-reload**
Don't reload daemon after enabling unit files

### **bluechictl** [*disable*] [*agent*] [*unit1*,*...*]

Disable the list of systemd unit files for the `bluechi-agent`.


**Options:**

**--no-reload**
Don't reload daemon after disabling unit files

### **bluechictl** *list-units* [*agent*]

Fetches information about all systemd units on the bluechi-agents. If [bluechi-agent] is not specified, all agents are queried.

### **bluechictl** *monitor* [*agent*] [*unit1*,*unit2*,*...*]
**Options:**

Creates a monitor on the given agent to observe changes in the specified units. Wildcards **\*** to match all agents and/or units are also supported.
**--filter**
Use glob filter for the unit names

### **bluechictl** *monitor* *node-connection*
### **bluechictl** *monitor* [*agent*] [*unit1*,*unit2*,*...*]

Creates a monitor to observe connection state changes for all nodes.
Creates a monitor on the given agent to observe changes in the specified units. Wildcards **\*** to match all agents and/or units are also supported.


**Example:**
Expand All @@ -59,6 +82,25 @@ bluechictl monitor \\\* dbus.service,apache2.service

Performs `daemon-reload` for the `bluechi-agent`.

### **bluechictl** [*status*] [*agent*] [*unit1*,*...*]
### **bluechictl** *status* [*agent*]

Fetches the status of all the agents or a specific agent: state (online/offline) and when was it last seen


**Options:**

**--watch**, **-w**
Continuously display agent(s) status, updating when state change update received


**Example:**

bluechictl status

bluechictl status rpi

bluechictl status -w

### **bluechictl** *status* [*agent*] [*unit1*,*...*]

Fetches the status of the systemd units for the `bluechi-agent`.
2 changes: 1 addition & 1 deletion src/client/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const Method methods[] = {
{ "monitor", 0, 2, OPT_NONE, method_monitor, usage_bluechi},
{ "metrics", 1, 1, OPT_NONE, method_metrics, usage_bluechi},
{ "enable", 2, ARG_ANY, OPT_FORCE | OPT_RUNTIME | OPT_NO_RELOAD, method_enable, usage_bluechi},
{ "disable", 2, ARG_ANY, OPT_NONE, method_disable, usage_bluechi},
{ "disable", 2, ARG_ANY, OPT_NO_RELOAD, method_disable, usage_bluechi},
{ "daemon-reload", 1, 1, OPT_NONE, method_daemon_reload, usage_bluechi},
{ "status", 0, ARG_ANY, OPT_WATCH, method_status, usage_bluechi},
{ "set-loglevel", 1, 2, OPT_NONE, method_set_loglevel, usage_bluechi},
Expand Down

0 comments on commit 7ebc2b3

Please sign in to comment.