Open Eric-Tyrrell22 opened 5 days ago
Hello @Eric-Tyrrell22, have you passed options to service? could you replace $OPTIONS with flags you need.
@BupycHuk I actually did replace the $OPTIONS with the flags I needed, but this issue was still present. It seems like not all operating systems have the group nogroup
which is what's causing this issue. Amazon linux has nobody
instead of nogroup
# Debian OS
$ cat /etc/group | grep no
nogroup:x:65534:
# Amazon linux
$ cat /etc/group | grep no
nobody:x:65534:
For reference this is the service file I'm using now.
[Unit]
Description=Prometheus MongoDB Exporter
Documentation=https://github.com/percona/mongodb_exporter
After=network.target
[Service]
Type=simple
User=mongodb_exporter
Group=mongodb_exporter
ExecStart=/usr/bin/mongodb_exporter --mongodb.uri="mongodb://localhost:27017/" --discovering-mode --collector.dbstats --collector.dbstatsfreestorage --collector.collstats
Restart=always
[Install]
WantedBy=multi-user.target
Describe the bug mongodb_exporter systemd service failing to start on
al2023-ami-2023.5.20240916.0-kernel-6.1-x86_64
To Reproduce
wget 'https://github.com/percona/mongodb_exporter/releases/download/v0.41.0/mongodb_exporter-0.41.0.linux-64-bit.rpm'
sudo yum install ./mongodb_exporter-0.41.0.linux-64-bit.rpm
systemctl start mongodb_exporter
journalctl -u mongodb_exporter
Expected behavior mongodb_exporter service starts
Logs
Environment
Additional context Issue has been ran into before: https://github.com/percona/mongodb_exporter/issues/815
I fixed this by changing the group in the service file to mongodb_exporter.
I'm not 100% sure if changing the group to
mongodb_exporter
would have security implications, but I have the feeling that it would be negligble at worst.taking a look at the mongod service file, they specify the same user and group, for example. https://github.com/mongodb/mongo/blob/master/debian/mongod.service#L8-L9
This change can be made here: https://github.com/percona/mongodb_exporter/blob/main/.scripts/systemd/mongodb_exporter.service#L10