Skip to content

Systemd unit #261

@jcaesar

Description

@jcaesar

Problem

I'd like to run scaphandre on some plain old bare metal servers. Is there a systemd unit file somewhere I can use?

Solution

I'd think something like this?

[Unit]
Description=Scaphandre Prometheus
Wants=network.target
After=network.target

[Service]
# systemctl edit and add these if you want to further limit access
#IPAddressAllow=localhost
#IPAddressDeny=any

ExecStartPre=-+/usr/bin/modprobe intel_rapl_common
ExecStartPre=+/usr/bin/find /sys/devices/virtual/powercap -name energy_uj -exec chmod g+r -R {} + -exec chown root:powercap {} +
ExecStart=/usr/local/bin/scaphandre $SCAPHANDRE_ARGS
EnvironmentFile=/etc/conf.d/scaphandre

CapabilityBoundingSet=CAP_NET_BIND_SERVICE
DevicePolicy=closed
DynamicUser=yes
Group=powercap
IPAccounting=yes
LockPersonality=yes
MemoryDenyWriteExecute=yes
MemoryMax=100M
NoNewPrivileges=yes
PrivateDevices=yes
PrivateTmp=yes
PrivateUsers=yes
ProtectClock=yes
ProtectControlGroups=yes
ProtectHome=yes
ProtectHostname=yes
ProtectKernelLogs=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
ProtectSystem=strict
RestrictAddressFamilies=AF_INET AF_INET6
RestrictNamespaces=yes
RestrictRealtime=yes
RestrictSUIDSGID=yes
SyslogIdentifier=scaphandre
SystemCallFilter=~@cpu-emulation
SystemCallFilter=~@debug
SystemCallFilter=~@keyring
SystemCallFilter=~@module
SystemCallFilter=~@mount
SystemCallFilter=~@obsolete
SystemCallFilter=~@privileged
SystemCallFilter=~@raw-io
SystemCallFilter=~@reboot
SystemCallFilter=~@resources
SystemCallFilter=~@swap
UMask=0777

[Install]
WantedBy=multi-user.target

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Status

Previous releases

Relationships

None yet

Development

No branches or pull requests

Issue actions