Skip to content

Commit 061e0ab

Browse files
author
Anze
committed
Clarify README installation instructions; clean up docker-compose.yml
1 parent 5268104 commit 061e0ab

File tree

3 files changed

+67
-12
lines changed

3 files changed

+67
-12
lines changed

README.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,53 @@ If in doubt, please [open an issue](https://gitlab.com/grafolean/grafolean-colle
2727

2828
# Install (docker / docker-compose)
2929

30-
This is the easiest and currently the only officially supported way. However other installation methods should be straightforward by studying `Dockerfile`.
30+
Docker is the easiest and currently the only officially supported way. Note that while instructions might (with possibly some modifications) work on other operating systems, Linux is assumed.
3131

3232
1) log in to Grafolean service (either https://grafolean.com/ or self-hosted), select an appropriate `Account` and create a new `Bot`. Make sure that selected protocol is `SNMP`. Copy the bot token.
33-
2) save [docker-compose.yml](https://gitlab.com/grafolean/grafolean-collector-snmp/raw/master/docker-compose.yml) to a local file
33+
34+
2) save [docker-compose.yml](https://gitlab.com/grafolean/grafolean-collector-snmp/raw/master/docker-compose.yml) to a local file:
35+
```
36+
$ mkdir ~/snmpcollector
37+
$ cd ~/snmpcollector
38+
$ wget https://gitlab.com/grafolean/grafolean-collector-snmp/raw/master/docker-compose.yml
39+
```
40+
3441
3) edit `docker-compose.yml` and change:
3542
- mandatory: `BACKEND_URL` (set to the URL of Grafolean backend, for example `https://grafolean.com/api`),
3643
- mandatory: `BOT_TOKEN` (set to the bot token from step 1),
3744
- optional: `JOBS_REFRESH_INTERVAL` (interval in seconds at which the jobs definitions will be updated)
3845
Alternatively, you can also copy `.env.example` to `.env` and change settings there (leaving `docker-compose.yml` in original state).
46+
3947
4) run: `docker-compose up -d`
4048
49+
If you get no error, congratulations! Everything else is done from within the Grafolean UI. You can however check the status of container as usually by running `docker ps` and investigate logs by running `docker logs -f grafolean-collector-snmp`.
50+
51+
In case of error make sure that the user is allowed to run `docker` (that is, that it is in `docker` group) by running `docker ps`. Alternatively, container can be run using `sudo` (line 4 then reads `sudo docker-compose up -d`).
52+
4153
## Upgrade
4254
43-
1) `docker-compose pull`
44-
2) `docker-compose down && docker-compose up -d`
55+
Upgrading should be easy:
56+
57+
1) `$ docker-compose pull`
58+
2) `$ docker-compose down`
59+
3) `$ docker-compose up -d`
4560
4661
## Debugging
4762
4863
Container logs can be checked by running:
4964
```
50-
$ docker logs grafolean-collector-snmp
65+
$ docker logs --since 5m -f grafolean-collector-snmp
5166
```
5267
68+
## Building locally
69+
70+
If you wish to build the Docker image locally (for debugging or for development purposes), you can specify a custom docker-compose YAML file:
71+
```
72+
docker-compose -f docker-compose.dev.yml build
73+
```
74+
75+
In this case `.env.example` can be copied to `.env` and all settings can be altered there, which helps us avoid commiting settings to the repository.
76+
5377
# Development
5478
5579
## Contributing
@@ -58,4 +82,4 @@ To contribute to this repository, CLA needs to be signed. Please open an issue a
5882
5983
## Issues
6084
61-
If you encounter any problems installing or running the software, please let us know in the [issues](https://gitlab.com/grafolean/grafolean-collector-snmp/issues). If possible, please make sure to describe the issue in a way that will allow us to reproduce it.
85+
If you encounter any problems installing or running the software, please let us know in the [issues](https://gitlab.com/grafolean/grafolean-collector-snmp/issues). Please make an effort when describing the issue. If we can reproduce the problem, we can also fix it much faster.

docker-compose.dev.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
version: '2.1'
2+
services:
3+
4+
#
5+
# Welcome to Grafolean SNMP Collector!
6+
#
7+
# This file is meant for development purposes only. Please use `docker-compose.yml` for usual installation.
8+
#
9+
# Feel free to investigate this file (and comments), but the preferred way of changing development settings is to:
10+
# - copy .env.example to .env (which is already in .gitignore)
11+
# - change the settings in .env
12+
#
13+
14+
snmpcollector:
15+
# If you wish to load an explicit version, change the next line. For example:
16+
# image: grafolean/grafolean-collector-snmp:v1.0.0
17+
image: grafolean/grafolean-collector-snmp
18+
build:
19+
context: .
20+
dockerfile: Dockerfile
21+
container_name: grafolean-collector-snmp
22+
environment:
23+
# Backend url must be set to the address of the Grafolean backend, for example this uses Grafolean hosted service:
24+
# - BACKEND_URL=https://grafolean.com/api
25+
- BACKEND_URL=${BACKEND_URL}
26+
# To use SNMP Collector, a bot with the protocol "snmp" must be added via user interface, then the token needs to be copied here:
27+
- BOT_TOKEN=${BOT_TOKEN}
28+
# Interval between fetching information about jobs:
29+
- JOBS_REFRESH_INTERVAL=${JOBS_REFRESH_INTERVAL}
30+
restart: always
31+
# Grafolean backend must be accessible on BACKEND_URL *from the point of view of container*. If running
32+
# on the same host, '127.0.0.1' translates to container, not host - this directive changes network mode
33+
# so that Docker networking is bypassed.
34+
network_mode: "host"

docker-compose.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,15 @@ services:
1212
# If you wish to load an explicit version, change the next line. For example:
1313
# image: grafolean/grafolean-collector-snmp:v1.0.0
1414
image: grafolean/grafolean-collector-snmp
15-
build:
16-
context: .
17-
dockerfile: Dockerfile
1815
container_name: grafolean-collector-snmp
1916
environment:
2017
# Backend url must be set to the address of the Grafolean backend, for example this uses Grafolean hosted service:
2118
# - BACKEND_URL=https://grafolean.com/api
22-
- BACKEND_URL=${BACKEND_URL}
19+
- BACKEND_URL=
2320
# To use SNMP Collector, a bot with the protocol "snmp" must be added via user interface, then the token needs to be copied here:
24-
- BOT_TOKEN=${BOT_TOKEN}
21+
- BOT_TOKEN=
2522
# Interval between fetching information about jobs:
26-
- JOBS_REFRESH_INTERVAL=${JOBS_REFRESH_INTERVAL}
23+
- JOBS_REFRESH_INTERVAL=60
2724
restart: always
2825
# Grafolean backend must be accessible on BACKEND_URL *from the point of view of container*. If running
2926
# on the same host, '127.0.0.1' translates to container, not host - this directive changes network mode

0 commit comments

Comments
 (0)