Skip to content

Commit

Permalink
Rename collector -> bot
Browse files Browse the repository at this point in the history
  • Loading branch information
Anze committed Dec 13, 2019
1 parent f847a96 commit eedda1a
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ deploy to docker hub:
variables:
- $CI_COMMIT_TAG =~ /^v[0-9]+[.][0-9]+[.][0-9]+([.][^.]+)?$/
variables:
CI_REGISTRY_IMAGE: grafolean/grafolean-collector-snmp
CI_REGISTRY_IMAGE: grafolean/grafolean-snmp-bot
script:
- apk add --no-cache git
# check that we are deploying the latest version:
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ ARG VCS_REF
ARG BUILD_DATE
LABEL org.label-schema.vendor="Grafolean" \
org.label-schema.url="https://grafolean.com/" \
org.label-schema.name="Grafolean SNMP Collector" \
org.label-schema.description="SNMP collector for Grafolean" \
org.label-schema.name="Grafolean SNMP bot" \
org.label-schema.description="SNMP bot for Grafolean" \
org.label-schema.version=$VERSION \
org.label-schema.vcs-url="https://gitlab.com/grafolean/grafolean-collector-snmp/" \
org.label-schema.vcs-url="https://github.com/grafolean/grafolean-snmp-bot/" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.build-date=$BUILD_DATE \
org.label-schema.docker.schema-version="1.0"
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# About Grafolean SNMP Collector
# About Grafolean SNMP bot

This package is a SNMP Collector for Grafolean, an easy to use generic monitoring system.
This package is a SNMP bot for Grafolean, an easy to use generic monitoring system.

Once installed, all the configuration of SNMP sensors is done through Grafolean's web-based user interface. Depending on permissions,
a single SNMP Collector instance can be fetching data for multiple accounts and entities. The fetching intervals can be specified with
a single SNMP bot instance can be fetching data for multiple accounts and entities. The fetching intervals can be specified with
up to a second precision.

Under the hood it uses [net-snmp](http://net-snmp.sourceforge.net/) (via [easysnmp](https://easysnmp.readthedocs.io)), which means
it should be compatible with any device that can respond to requests by `snmpget` and `snmpwalk`.

Requirements:
- the devices that should be queried via SNMP must be accessible *from the container* (make sure SNMP Collector is installed in correct network and that there are no firewalls in between)
- the devices that should be queried via SNMP must be accessible *from the container* (make sure that SNMP bot is installed in the correct network and that there are no firewalls in between)
- Grafolean must be accessible via HTTP(S)

Current limitations:
Expand All @@ -21,21 +21,21 @@ Current limitations:
# License

License is Commons Clause license (on top of Apache 2.0) - source is available, you can use it for free (commercially too), modify and
share, but you can't sell it. See [LICENSE.md](https://gitlab.com/grafolean/grafolean-collector-snmp/blob/master/LICENSE.md) for details.
share, but you can't sell it. See [LICENSE.md](https://github.com/grafolean/grafolean-snmp-bot/blob/master/LICENSE.md) for details.

If in doubt, please [open an issue](https://gitlab.com/grafolean/grafolean-collector-snmp/issues) to get further clarification.
If in doubt, please [open an issue](https://github.com/grafolean/grafolean-snmp-bot/issues) to get further clarification.

# Install (docker / docker-compose)

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.

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.

2) save [docker-compose.yml](https://gitlab.com/grafolean/grafolean-collector-snmp/raw/master/docker-compose.yml) to a local file:
2) save [docker-compose.yml](https://github.com/grafolean/grafolean-snmp-bot/raw/master/docker-compose.yml) to a local file:
```
$ mkdir ~/snmpbot
$ cd ~/snmpbot
$ wget https://gitlab.com/grafolean/grafolean-collector-snmp/raw/master/docker-compose.yml
$ wget https://github.com/grafolean/grafolean-snmp-bot/raw/master/docker-compose.yml
```
3) edit `docker-compose.yml` and change:
Expand All @@ -46,7 +46,7 @@ Docker is the easiest and currently the only officially supported way. Note that
4) run: `docker-compose up -d`
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`.
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-snmp-bot`.
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`).
Expand All @@ -62,7 +62,7 @@ Upgrading should be easy:
Container logs can be checked by running:
```
$ docker logs --since 5m -f grafolean-collector-snmp
$ docker logs --since 5m -f grafolean-snmp-bot
```
## Building locally
Expand All @@ -82,4 +82,4 @@ To contribute to this repository, CLA needs to be signed. Please open an issue a
## Issues
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.
If you encounter any problems installing or running the software, please let us know in the [issues](https://github.com/grafolean/grafolean-snmp-bot/issues). Please make an effort when describing the issue. If we can reproduce the problem, we can also fix it much faster.
14 changes: 7 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ version: '2.1'
services:

#
# Welcome to Grafolean SNMP Collector!
# Welcome to Grafolean SNMP bot!
#
# This file should be modified to suit your running environment. Please check the comments and change
# the settings appropriately.
#

snmpbot:
# If you wish to load an explicit version, change the next line. For example:
# image: grafolean/grafolean-collector-snmp:v1.0.0
image: grafolean/grafolean-collector-snmp
container_name: grafolean-collector-snmp
# image: grafolean/grafolean-snmp-bot:v1.0.0
image: grafolean/grafolean-snmp-bot
container_name: grafolean-snmp-bot
environment:
# Backend url must be set to the address of the Grafolean backend, for example this uses Grafolean hosted service:
# - BACKEND_URL=https://grafolean.com/api
# IMPORTANT: '127.0.0.1' and 'localhost' are _never_ correct addresses for Grafolean backend, because they translate
# to container, not host.
- BACKEND_URL=${BACKEND_URL}
# To use SNMP Collector, a bot with the protocol "snmp" must be added via user interface, then the token needs to be copied here:
# To use SNMP bot, a bot with the protocol "snmp" must be added via user interface, then the token needs to be copied here:
- BOT_TOKEN=${BOT_TOKEN}
# Interval between fetching information about jobs:
- JOBS_REFRESH_INTERVAL=${JOBS_REFRESH_INTERVAL:-60}
Expand All @@ -31,7 +31,7 @@ services:

redis:
image: redis:5-alpine
container_name: grafolean-collector-snmp-redis
container_name: grafolean-snmp-bot-redis
restart: always
networks:
- grafolean
Expand All @@ -40,7 +40,7 @@ services:
autoheal:
# This container automatically restarts any container that fails its health check. Not a bullet-proof solution, but better than nothing.
image: willfarrell/autoheal
container_name: autoheal-snmp
container_name: grafolean-snmp-bot-autoheal
environment:
- AUTOHEAL_CONTAINER_LABEL=all
volumes:
Expand Down
6 changes: 3 additions & 3 deletions snmpbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def send_results_to_grafolean(backend_url, bot_token, account_id, values):
log.exception("Error sending data to Grafolean")


class SNMPCollector(Collector):
class SNMPBot(Collector):

@staticmethod
def do_snmp(*args, **job_info):
Expand Down Expand Up @@ -310,7 +310,7 @@ def jobs(self):
intervals = list(set([sensor_info["interval"] for sensor_info in entity_info["sensors"]]))
job_info = { **entity_info, "backend_url": self.backend_url, "bot_token": self.bot_token }
job_id = str(entity_info["entity_id"])
yield job_id, intervals, SNMPCollector.do_snmp, job_info
yield job_id, intervals, SNMPBot.do_snmp, job_info


if __name__ == "__main__":
Expand All @@ -322,5 +322,5 @@ def jobs(self):
raise Exception("Please specify BACKEND_URL and BOT_TOKEN env vars.")
jobs_refresh_interval = int(os.environ.get('JOBS_REFRESH_INTERVAL', 120))

c = SNMPCollector(backend_url, bot_token, jobs_refresh_interval)
c = SNMPBot(backend_url, bot_token, jobs_refresh_interval)
c.execute()

0 comments on commit eedda1a

Please sign in to comment.