How to deploy librenms with docker-compsoe
Librenms is a very light and easy handle moniting software. It is suitable for us to monitoring server,network device, printers etc. via snmp.
At now, docker is easy for software deployment. After deploy librenms in ubuntu vm, I have a try to deploy librenms with docker-compose.
Download config files
1
2
3
4
5
6
7
8
9
10
11
12
13
| mkdir librenms-docker-compose
cd librenms-docker-compose
#Download .env file
wget https://raw.githubusercontent.com/librenms/docker/master/examples/compose/.env
# Download docker-compose file
wget https://raw.githubusercontent.com/librenms/docker/master/examples/compose/docker-compose.yml
# Download librenms.env file
wget https://raw.githubusercontent.com/librenms/docker/master/examples/compose/librenms.env
touch acme.json
chmod 600 acme.json
|
librenms server configuration
As show below , I will deploy a librenms via docker in my lan network. the host name is mylibrenms
,my local domain name is private.local
.
Type | value |
---|
Librenms host name | mylibrenms |
Domain name | private.local |
Name | myname |
mail account | myname@private.local |
snmp community | public |
Modify .env
Change configure :
1
2
3
4
5
6
7
8
9
10
11
| MYSQL_DATABASE=mylibrenms
MYSQL_USER=mylibrenms
MYSQL_PASSWORD=mylibrenmspassword
SMTP_SERVER=smtp.private.local
SMTP_USERNAME=myname@private.local
SMTP_PASSWORD=myPassword
TZ=Asia/Chongqing
PUID=1000
PGID=1000
|
Modify docker-compose.yml
Change treafik config
- Change
services: | treafik: | command: | - "--docker.domain="
to --docker.domain=private.local
1
| sed -i 's/\"--docker.domain=example.com\"/\"--docker.domain=private.local\"/g' docker-compose.yml
|
- Change
services: | treafik: | command: | - "--acme.email="
to - "--acme.email="myname@private.local"
1
| sed -i 's/\"--acme.email=webmaster@example.com\"/\"--acme.email=myname@private.local\"/g' docker-compose.yml
|
Change smtp config
- Change
services: | smtp: | environment: | - "SERVER_HOSTNAME="
to - "SERVER_HOSTNAME=mylibrenms.private.local"
1
| sed -i 's/-\ \"SERVER_HOSTNAME=librenms.example.com\"/-\ \"SERVER_HOSTNAME=mylibrenms.private.local\"/g' docker-compose.yml
|
Change librenms config
- Change
services: | librenms: | domainname:
to domainname: private.local
.
1
| sed -i 's/domainname:\ example.com/domainname:\ private.local/g' docker-compose.yml
|
- Change
services: | librenms: | hostname:
to hostname; mylibrenms
.
1
| sed -i 's/hostname:\ librenms/hostname:\ mylibrenms/g' docker-compose.yml
|
- Change
services: | librenms: | labels: | - " traefik.frontend.rule="
to - "traefik.frontend.rule=Host:mylibrenms"
.
1
| sed -i 's/-\ \"traefik.frontend.rule=Host:librenms.example.com\"/-\ \"traefik.frontend.rule=Host:mylibrenms.private.local\"/g' docker-compose.yml
|
Change cron config
Change syslog-ng:
- Change
services: | syslog-ng: | domainname:
to domainname: private.local
. - Change
services: | syslog-ng: | hostname:
to hostname: mylibrenms
.
Modify librenms.env
- Change
LIBRENMS_SNMP_COMMUNITY=
to LIBRENMS_SNMP_COMMUNITY=public
.
1
| sed -i 's/LIBRENMS_SNMP_COMMUNITY=librenmsdocker/LIBRENMS_SNMP_COMMUNITY=public/g' librenms.env
|
Run docker-compose to up librenms containers
enable proxmox app moniting
1
2
3
4
5
|
cat << EOF > librenms/config.php
<?php
$config['enable_proxmox'] = true;
EOF
|