Skip to content

Commit 5fce7ee

Browse files
fix: support for local mibs in docker compose installation (#1244)
* fix: support for local mibs in docker compose installation * doc: update documentation --------- Co-authored-by: omrozowicz-splunk <[email protected]>
1 parent c8a4394 commit 5fce7ee

File tree

5 files changed

+50
-12
lines changed

5 files changed

+50
-12
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Unreleased
44

55
### Changed
6+
- add support for local MIB files in docker compose deployment
67
- add support for Redis HA with Sentinel integration
78
- **Redis Migration**: Replaced Bitnami Redis chart with custom Kubernetes manifests
89
- Updated to official Redis image version 8.2.2 (addresses security vulnerabilities)

docker_compose/.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ SCHEDULER_CONFIG_FILE_ABSOLUTE_PATH=
55
TRAPS_CONFIG_FILE_ABSOLUTE_PATH=
66
INVENTORY_FILE_ABSOLUTE_PATH=
77
COREFILE_ABS_PATH=
8+
LOCAL_MIBS_PATH="./local_mibs"
89
SC4SNMP_VERSION="1.14.2-beta.7"
910

1011
# Network configuration

docker_compose/docker-compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ services:
9999
NGINX_ENTRYPOINT_QUIET_LOGS: ${NGINX_ENTRYPOINT_QUIET_LOGS:-1}
100100
volumes:
101101
- snmp-mibserver-tmp:/tmp/
102+
- ${LOCAL_MIBS_PATH:-./local_mibs}:/app/new_mibs/src/vendor
102103
redis:
103104
<<: [*dns_and_networks, *dependend_on_core_dns]
104105
image: ${REDIS_IMAGE}:${REDIS_TAG:-latest}

docs/dockercompose/6-env-file-configuration.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ Inside the directory with the docker compose files, there is a `.env`. Variables
44

55
## Deployment
66

7-
| Variable | Description |
8-
|---------------------------------------|------------------------------------------------------------------------------------------------------|
9-
| `SC4SNMP_IMAGE` | The registry and name of the SC4SNMP image to pull |
10-
| `SC4SNMP_TAG` | SC4SNMP image tag to pull |
11-
| `SCHEDULER_CONFIG_FILE_ABSOLUTE_PATH` | Absolute path to [scheduler-config.yaml](./4-scheduler-configuration.md) file |
12-
| `TRAPS_CONFIG_FILE_ABSOLUTE_PATH` | Absolute path to [traps-config.yaml](./5-traps-configuration.md) file |
13-
| `INVENTORY_FILE_ABSOLUTE_PATH` | Absolute path to [inventory.csv](./3-inventory-configuration.md) file |
14-
| `COREFILE_ABS_PATH` | Absolute path to Corefile used by coreDNS. Default Corefile can be found inside the `docker_compose` |
15-
| `SC4SNMP_VERSION` | Version of SC4SNMP |
7+
| Variable | Description |
8+
|---------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|
9+
| `SC4SNMP_IMAGE` | The registry and name of the SC4SNMP image to pull |
10+
| `SC4SNMP_TAG` | SC4SNMP image tag to pull |
11+
| `SCHEDULER_CONFIG_FILE_ABSOLUTE_PATH` | Absolute path to [scheduler-config.yaml](./4-scheduler-configuration.md) file |
12+
| `TRAPS_CONFIG_FILE_ABSOLUTE_PATH` | Absolute path to [traps-config.yaml](./5-traps-configuration.md) file |
13+
| `INVENTORY_FILE_ABSOLUTE_PATH` | Absolute path to [inventory.csv](./3-inventory-configuration.md) file |
14+
| `COREFILE_ABS_PATH` | Absolute path to Corefile used by coreDNS. Default Corefile can be found inside the `docker_compose` |
15+
| `LOCAL_MIBS_PATH` | Absolute path to the directory containing [local MIB files](../mib-request.md#configuring-path-to-local-mibs-for-docker-compose-installation). |
16+
| `SC4SNMP_VERSION` | Version of SC4SNMP |
1617

1718

1819
## Network configuration
@@ -128,6 +129,7 @@ Inside the directory with the docker compose files, there is a `.env`. Variables
128129
| `SNMP_V3_SECURITY_ENGINE_ID` | SNMPv3 TRAPs require the configuration SNMP Engine ID of the TRAP sending application for the USM users table of the TRAP receiving application for each USM user, for example: SNMP_V3_SECURITY_ENGINE_ID=80003a8c04,aab123456 |
129130
| `INCLUDE_SECURITY_CONTEXT_ID` | Controls whether to add the context_engine_id field to v3 trap events |
130131
| `TRAPS_PORT` | External port exposed for traps server |
132+
131133
## Scheduler
132134

133135
| Variable | Description |

docs/mib-request.md

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ microk8s kubectl rollout restart deployment snmp-splunk-connect-for-snmp-worker-
5353
microk8s kubectl rollout restart deployment snmp-splunk-connect-for-snmp-worker-poller -n sc4snmp
5454
```
5555

56-
## Beta: use MIB server with local MIBs
56+
## Use MIB server with local MIBs
5757

5858
From the `1.15.0` version of the MIB server, there is a way to use local MIB files. This may be useful when your MIB
5959
files are proprietary, or you use SC4SNMP offline. This way, you can update necessary MIBs by yourself, without having to
@@ -68,7 +68,9 @@ vendor names will not make compilation fail, this is more for the logging purpos
6868
troubleshooting easier.
6969
3. MIB files should be named the same as the contained MIB module. The MIB module name is specified at the beginning of
7070
the MIB file before `::= BEGIN` keyword.
71-
4. Add the following to the `values.yaml`:
71+
72+
### Configuring path to local MIBs for k8s installation
73+
Add the following to the `values.yaml`:
7274

7375
```yaml
7476
mibserver:
@@ -83,8 +85,9 @@ microk8s kubectl logs -f deployments/snmp-mibserver -n sc4snmp
8385
```
8486

8587
This creates a Kubernetes pvc with MIB files inside and maps it to the MIB server pod.
86-
Also, you can change the storageClass and size of persistence according to the `mibserver` schema, see https://github.com/pysnmp/mibs/blob/main/charts/mibserver/values.yaml.
88+
Also, you can change the storageClass and size of persistence according to the `mibserver` schema, see [values.yaml of the mibserver](https://github.com/pysnmp/mibs/blob/main/charts/mibserver/values.yaml).
8789
The default persistence size is 1 Gibibyte, so consider reducing or expanding it to the amount you actually need.
90+
8891
Whenever you add new MIB files, rollout restart MIB server pods to compile them again, using the following command:
8992

9093
```bash
@@ -96,3 +99,33 @@ using `persistence.existingClaim`. If you go with the `localMibs.pathToMibs` sol
9699
(with `nodeSelector` set up to schedule MIB server pods on the same node where the MIB files are),
97100
when the Node with the mapped hostPath fails, you will have to access the MIB files on another node.
98101

102+
### Configuring path to local mibs for docker-compose installation
103+
104+
To point to the directory with your local MIBs, set the `LOCAL_MIBS_PATH` variable in the `.env` file located in the `docker_compose` directory:
105+
106+
```yaml
107+
LOCAL_MIBS_PATH="./local_mibs"
108+
```
109+
110+
By default, it is set to be `./local_mibs`, which means such directory will be created anyway in the `docker_compose` directory if the variable remains unchanged.
111+
You can put your MIB files there, following the same structure as described above.
112+
113+
!!!warning
114+
Make sure that the user running docker has read and write permissions to the `LOCAL_MIBS_PATH` directory. Assign the user with permissions if necessary.
115+
116+
Whenever you add new MIB files, restart MIB service to compile them again, using the following command:
117+
118+
```bash
119+
sudo docker compose restart snmp-mibserver
120+
```
121+
122+
To verify that the process of compilation was completed successfully, check the mibserver logs using the following command:
123+
124+
```bash
125+
sudo docker logs snmp-mibserver
126+
```
127+
128+
If you want to use a different directory, you can change the mapping in the `docker-compose.yaml` file and set an absolute path to your directory.
129+
130+
!!!note
131+
It is a good practice to update `LOCAL_MIBS_PATH` to be an absolute path to `local_mibs` directory. For example `LOCAL_MIBS_PATH=/home/user/local_mibs`.

0 commit comments

Comments
 (0)