Skip to content

Commit d5bb245

Browse files
committed
readme.md
1 parent c2b4a1a commit d5bb245

2 files changed

Lines changed: 59 additions & 19 deletions

File tree

README.md

Lines changed: 47 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,28 @@ scale factor.
1919
Currently, reads rocm-smi output, but the intent it to read any JSON based
2020
on a declarative config file.
2121

22+
# Architecture
23+
24+
```mermaid
25+
graph TD;
26+
snmp-manager --> snmp-agent
27+
snmp-agent --> agentx
28+
agentx --> json-command
29+
```
30+
31+
The snmp-manager is an app like Zabbix. The SNMP Agent runs on each host. For
32+
a typical linux host this would be NET-SNMP.
33+
34+
Instead of writing a full-blown SNMP Agent for each thing you want to monitor,
35+
Net-SNMP has a plugin architecture. Net-SNMP creates a unix socket (or TCP
36+
port) and listens for connections there. This subagent reads and writes to
37+
that socket.
38+
2239
# Build
2340

2441
```shell
2542
cargo build
43+
cargo clippy
2644
```
2745

2846

@@ -33,21 +51,14 @@ Could use some help with setting up unit tests.
3351

3452
# Run
3553

36-
Customize the config and run locally
37-
38-
```
39-
cp template/config.yaml .
40-
cargo run
41-
```
42-
43-
Find the agentx socket file in /var, likely /var/agentx/master.
44-
45-
46-
# Deploy
54+
You could run this with a standalone SNMP Agent (NET-SNMP) or you can use the
55+
sytem-wide instance. Set up your agent like this.
4756

4857
## Set up SNMPd
4958

50-
Add this to SNMPd's config /etc/snmp/snmpd.conf.
59+
Add this to SNMPd's config /etc/snmp/snmpd.conf. PEN is the private enterprise
60+
number. Request one [here](https://www.iana.org/assignments/enterprise-numbers/).
61+
You can create the socket file to be used by yourself or the system.
5162

5263
```
5364
# Add your OID to the system view
@@ -60,17 +71,32 @@ agentxsocket /tmp/agentx
6071
agentxperms 770 770 <username> <groupname>
6172
```
6273

63-
Load the MIB file.
64-
65-
TODO
74+
The system-level agentx socket is `/var/agentx/master`. Maybe a better place
75+
for a user-level socket is in `~/.local/double-agentx/`.
6676

6777
Confirm the MIB file has the right structure.
6878

6979
```shell
7080
snmptranslate -M.:/usr/share/snmp/mibs/ietf -Tp AMDGPU-MIB::doubleagentx
7181
```
7282

73-
Run these commands.
83+
Load the MIB file.
84+
85+
TODO
86+
87+
88+
## Set up the app
89+
90+
Customize the config and run locally
91+
92+
```
93+
cp template/config.yaml .
94+
RUST_LOG=debug cargo run
95+
```
96+
97+
# Deploy
98+
99+
Run these commands and customize files.
74100

75101
```shell
76102
cargo build --release
@@ -84,11 +110,13 @@ Find the new binary in `target/release/double-agentx` and copy it to wherever yo
84110

85111
# Systemd
86112

113+
Systemd runs at the user-level.
114+
87115
After copying the service file and config file into place, customize them.
88116

89117
```shell
90-
cp double-agentx.service ~/.config/systemd/user/
91-
cp config.yaml ~/.config/double-agentx/
118+
cp template/double-agentx.service ~/.config/systemd/user/
119+
cp template/config.yaml ~/.config/double-agentx/
92120
systemctl daemon-reload
93121
systemctl enable --user double-agentx.service
94122
systemctl start --user double-agentx.service
@@ -97,7 +125,7 @@ systemctl start --user double-agentx.service
97125
Monitor logs
98126

99127
```shell
100-
journalctl --user -fu agentx
128+
journalctl --user -fu double-agentx
101129
```
102130

103131
# Acknowledgements

template/double-agentx.service

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[Unit]
2+
Description=Double AgentX
3+
After=network-online.target
4+
5+
[Service]
6+
ExecStart=/home/<username>/.local/double-agentx/double-agentx
7+
#WorkingDirectory=/path/to/your/rust/app/
8+
Restart=on-failure
9+
RestartSec=5
10+
11+
[Install]
12+
WantedBy=default.target

0 commit comments

Comments
 (0)