Skip to content

Commit e55765d

Browse files
committed
examples: standalone: try to fix snmp-eaton-ups
1 parent 3e94643 commit e55765d

File tree

5 files changed

+64
-45
lines changed

5 files changed

+64
-45
lines changed

examples/standalone/snmp-eaton-ups/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.10-alpine3.16
1+
FROM python:3.13-alpine
22

33
WORKDIR /app
44

examples/standalone/snmp-eaton-ups/README.md

Lines changed: 58 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,59 @@
1-
# Eaton UPS Standalone UCM (SNMP)
1+
# Eaton UPS Standalone Device (SNMP)
22

3-
This example describes the implementation of the [Standalone UCM](https://handbook.enapter.com/software/virtual_ucm/) concept using the opensource [Enapter python-sdk](https://github.com/Enapter/python-sdk) for monitoring Eaton UPS using SNMP protocol.
3+
This example describes the implementation of the Standalone Device concept
4+
using the opensource [Enapter
5+
python-sdk](https://github.com/Enapter/python-sdk) for monitoring Eaton UPS
6+
using SNMP protocol.
47

5-
In order to use this UCM you need to enable SNMPv1 protocol in the Web Interface of your UPS and set unique community name for the read only access. The default port for SNMP is 161 but also can be changed.
8+
In order to use this standalone device you need to enable SNMPv1 protocol in
9+
the Web Interface of your UPS and set unique community name for the read only
10+
access. The default port for SNMP is 161 but also can be changed.
611

7-
As an example in this guide we will use the following dummy settings for configuration:
12+
As an example in this guide we will use the following dummy settings for
13+
configuration:
814

9-
UPS IP Address: 192.168.192.192
10-
11-
Community Name: public
12-
13-
SNMP Port: 161
15+
- UPS IP Address: 192.168.192.192
16+
- Community Name: public
17+
- SNMP Port: 161
1418

1519
## Requirements
1620

17-
It is recommended to run this UCM using Docker and Docker Compose. This will ensure that environment is correct.
21+
It is recommended to run this standalone device using Docker and Docker
22+
Compose. This will ensure that environment is correct.
1823

19-
The UPS must be reachable from the computer where the Docker Container will be running. You can check availability and settings with `snmpget` command on Linux or Mac:
24+
The UPS must be reachable from the computer where the Docker Container will be
25+
running. You can check availability and settings with `snmpget` command on
26+
Linux or Mac:
2027

2128
```bash
2229
user@pc snmp-eaton-ups % snmpget -v1 -c public 192.168.192.192:161 1.3.6.1.2.1.33.1.1.1.0
2330
SNMPv2-SMI::mib-2.33.1.1.1.0 = STRING: "EATON"
2431
```
2532

26-
## Step 1. Create Standalone UCM in Enapter Cloud
27-
28-
Log in to the Enapter Cloud, navigate to the Site where you want to create Standalone UCM and click on `Add new` button in the Standalone Device section.
33+
## Step 1. Create Standalone Device in Enapter Cloud
2934

30-
After creating Standalone UCM, you need to Generate and save Configuration string also known as ENAPTER_VUCM_BLOB as well as save UCM ID which will be needed for the next step
35+
Log in to the Enapter Cloud, navigate to the Site where you want to create a
36+
Standalone Device and click on `Add new` button in the Standalone Device
37+
section.
3138

32-
More information you can find on [this page](https://developers.enapter.com/docs/tutorial/software-ucms/standalone).
39+
After creating Standalone Device, you need to Generate and save Configuration
40+
string also known as `ENAPTER_STANDALONE_COMMUNICATION_CONFIG` as well as save
41+
UCM ID which will be needed for the next step.
3342

3443
## Step 2. Upload Blueprint into the Cloud
3544

36-
The general case [Enapter Blueprint](https://marketplace.enapter.com/about) consists of two files - declaration in YAML format (manifest.yaml) and logic written in Lua. Howerver for this case the logic is written in Python as Lua implementation doesn't have SNMP integration.
45+
The general case [Enapter Blueprint](https://marketplace.enapter.com/about)
46+
consists of two files - declaration in YAML format (manifest.yaml) and logic
47+
written in Lua. Howerver for this case the logic is written in Python as Lua
48+
implementation doesn't have SNMP integration.
3749

38-
But for both cases we need to tell Enapter Cloud which telemetry we are going to send and store and how to name it.
50+
But for both cases we need to tell Enapter Cloud which telemetry we are going
51+
to send and store and how to name it.
3952

40-
The easiest way to do that - using [Enapter CLI](https://github.com/Enapter/enapter-cli) to upload manifest.yaml into Cloud. The other option is to use [Web IDE](https://developers.enapter.com/docs/tutorial/uploading-blueprint).
53+
The easiest way to do that - using [Enapter
54+
CLI](https://github.com/Enapter/enapter-cli) to upload manifest.yaml into
55+
Cloud. The other option is to use [Web
56+
IDE](https://developers.enapter.com/docs/tutorial/uploading-blueprint).
4157

4258
```bash
4359
user@pc snmp-eaton-ups % enapter devices upload --blueprint-dir . --hardware-id REAL_UCM_ID
@@ -50,31 +66,33 @@ upload started with operation id 25721
5066
Done!
5167
```
5268
53-
## Step 3. Configuring Standalone UCM
69+
## Step 3. Configuring Standalone Device
5470
5571
Open `docker-compose.yaml` in any editor.
5672
57-
Set environment variables according to your configuration settings. With dummy settings your file will look like this:
73+
Set environment variables according to your configuration settings. With dummy
74+
settings your file will look like this:
5875
5976
```yaml
6077
version: "3"
6178
services:
6279
snmp-eaton-ups-ucm:
6380
build: .
64-
image: enapter-vucm-examples/snmp-eaton-ups:latest
81+
image: enapter-standalone-examples/snmp-eaton-ups:latest
6582
environment:
66-
ENAPTER_VUCM_BLOB: "REALENAPTERVUCMBLOBMUSTBEHERE="
83+
ENAPTER_STANDALONE_COMMUNICATION_CONFIG: "PUT_YOUR_CONFIG_HERE"
6784
ENAPTER_SNMP_HOST: "192.168.192.192"
6885
ENAPTER_SNMP_PORT: "161"
6986
ENAPTER_SNMP_COMMUNITY: "public"
7087
```
7188
72-
## Step 4. Build Docker Image with Standalone UCM
89+
## Step 4. Build Docker Image with Standalone Device
7390
74-
> You can you can skip this step and go directly to th Step 5.
75-
> Docker Compose will automatically build your image before starting container.
91+
> You can you can skip this step and go directly to Step 5. Docker Compose will
92+
> automatically build your image before starting container.
7693
77-
Build your Docker image by running `bash docker_build.sh` command in directory with UCM.
94+
Build your Docker image by running `bash docker_build.sh` command in directory
95+
with Standalone Device.
7896
7997
```bash
8098
user@pc snmp-eaton-ups % bash docker_build.sh
@@ -119,29 +137,30 @@ user@pc snmp-eaton-ups % bash docker_build.sh
119137
#12 exporting to image
120138
#12 exporting layers done
121139
#12 writing image sha256:92e1050debeabaff5837c6ca5bc26b0b966d09fc6f24e21b1d10cbb2f4d9aeec done
122-
#12 naming to docker.io/enapter-vucm-examples/snmp-eaton-ups:latest done
140+
#12 naming to docker.io/enapter-standalone-examples/snmp-eaton-ups:latest done
123141
#12 DONE 0.0s
124142
```
125143
126-
Your `enapter-vucm-examples/snmp-eaton-ups` image is now built and you can see it by running `docker images` command:
144+
Your `enapter-standalone-examples/snmp-eaton-ups` image is now built and you
145+
can see it by running `docker images` command:
127146
128147
```bash
129-
user@pc snmp-eaton-ups % docker images enapter-vucm-examples/snmp-eaton-ups
130-
REPOSITORY TAG IMAGE ID CREATED SIZE
131-
enapter-vucm-examples/snmp-eaton-ups latest 92e1050debea 5 hours ago 285MB
148+
user@pc snmp-eaton-ups % docker images enapter-standalone-examples/snmp-eaton-ups
149+
REPOSITORY TAG IMAGE ID CREATED SIZE
150+
enapter-standalone-examples/snmp-eaton-ups latest 92e1050debea 5 hours ago 285MB
132151
```
133152
134-
## Step 5. Run your Standalone UCM Docker Container
153+
## Step 5. Run your Standalone Device Docker Container
135154
136-
Finally run your Standalone UCM with `docker-compose up` command:
155+
Finally run your Standalone Device with `docker-compose up` command:
137156
138157
```bash
139158
user@pc snmp-eaton-ups % docker-compose up
140159
[+] Running 1/0
141-
✔ Container snmp-eaton-ups-snmp-eaton-ups-ucm-1 Created 0.0s
142-
Attaching to snmp-eaton-ups-snmp-eaton-ups-ucm-1
143-
snmp-eaton-ups-snmp-eaton-ups-ucm-1 | {"time": "2023-07-20T15:50:01.570744", "level": "INFO", "name": "enapter.mqtt.client", "host": "10.1.1.47", "port": 8883, "message": "starting"}
144-
snmp-eaton-ups-snmp-eaton-ups-ucm-1 | {"time": "2023-07-20T15:50:21.776037", "level": "INFO", "name": "enapter.mqtt.client", "host": "10.1.1.47", "port": 8883, "message": "client ready"}
160+
✔ Container snmp-eaton-ups-snmp-eaton-ups-standalone-1 Created 0.0s
161+
Attaching to snmp-eaton-ups-snmp-eaton-ups-standalone-1
162+
snmp-eaton-ups-snmp-eaton-ups-standalone-1 | {"time": "2023-07-20T15:50:01.570744", "level": "INFO", "name": "enapter.mqtt.client", "host": "10.1.1.47", "port": 8883, "message": "starting"}
163+
snmp-eaton-ups-snmp-eaton-ups-standalone-1 | {"time": "2023-07-20T15:50:21.776037", "level": "INFO", "name": "enapter.mqtt.client", "host": "10.1.1.47", "port": 8883, "message": "client ready"}
145164
```
146165
147-
On this step you can check that your UCM is now Online in the Cloud.
166+
On this step you can check that your Device is now Online in the Cloud.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
version: "3"
22
services:
3-
snmp-eaton-ups-ucm:
3+
snmp-eaton-ups-standalone:
44
build: .
5-
image: enapter-vucm-examples/snmp-eaton-ups:latest
5+
image: enapter-standalone-examples/snmp-eaton-ups:latest
66
stop_signal: SIGINT
77
restart: "no"
88
environment:
9-
ENAPTER_VUCM_BLOB: "REALENAPTERVUCMBLOBMUSTBEHERE="
9+
ENAPTER_STANDALONE_COMMUNICATION_CONFIG: "PUT_YOUR_CONFIG_HERE"
1010
ENAPTER_SNMP_HOST: "192.168.192.192"
1111
ENAPTER_SNMP_PORT: "161"
1212
ENAPTER_SNMP_COMMUNITY: "public"

examples/standalone/snmp-eaton-ups/docker_build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ set -euo pipefail
44
IFS=$'\n\t'
55

66
SCRIPT_DIR="$(realpath "$(dirname "$0")")"
7-
IMAGE_TAG="${IMAGE_TAG:-"enapter-vucm-examples/$(basename "$SCRIPT_DIR"):latest"}"
7+
IMAGE_TAG="${IMAGE_TAG:-"enapter-standalone-examples/$(basename "$SCRIPT_DIR"):latest"}"
88

99
docker build --progress=plain --tag "$IMAGE_TAG" "$SCRIPT_DIR"

examples/standalone/snmp-eaton-ups/docker_run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -euo pipefail
44
IFS=$'\n\t'
55

66
SCRIPT_DIR="$(realpath "$(dirname "$0")")"
7-
IMAGE_TAG="${IMAGE_TAG:-"enapter-vucm-examples/$(basename "$SCRIPT_DIR"):latest"}"
7+
IMAGE_TAG="${IMAGE_TAG:-"enapter-standalone-examples/$(basename "$SCRIPT_DIR"):latest"}"
88

99
bash $SCRIPT_DIR/docker_build.sh
1010

0 commit comments

Comments
 (0)