Skip to content

mongodb_exporter service fails to start on Amazon linux #912

Open
@Eric-Tyrrell22

Description

@Eric-Tyrrell22

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

Sep 17 16:15:57 ip-172-31-31-213.ec2.internal systemd[1]: mongodb_exporter.service: Main process exited, code=exited, status=216/GROUP
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ An ExecStart= process belonging to unit mongodb_exporter.service has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 216.
Sep 17 16:15:57 ip-172-31-31-213.ec2.internal systemd[1]: mongodb_exporter.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░
░░ The unit mongodb_exporter.service has entered the 'failed' state with result 'exit-code'.
Sep 17 16:15:57 ip-172-31-31-213.ec2.internal systemd[1]: mongodb_exporter.service: Scheduled restart job, restart counter is at 5.

Environment

cat /etc/os-release

NAME="Amazon Linux"
VERSION="2023"
ID="amzn"
ID_LIKE="fedora"
VERSION_ID="2023"
PLATFORM_ID="platform:al2023"
PRETTY_NAME="Amazon Linux 2023.5.20240916"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2023"
HOME_URL="https://aws.amazon.com/linux/amazon-linux-2023/"
DOCUMENTATION_URL="https://docs.aws.amazon.com/linux/"
SUPPORT_URL="https://aws.amazon.com/premiumsupport/"
BUG_REPORT_URL="https://github.com/amazonlinux/amazon-linux-2023"
VENDOR_NAME="AWS"
VENDOR_URL="https://aws.amazon.com/"
SUPPORT_END="2028-03-15"

Additional context
Issue has been ran into before:
#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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions