pcm icon indicating copy to clipboard operation
pcm copied to clipboard

Include a systemd.service for pcm-sensor-server

Open sscargal opened this issue 2 years ago • 2 comments

In my blog post How To Monitor Persistent Memory Performance on Linux using PCM, Prometheus, and Grafana, I created a systemd.service to start and stop the pcm-sensor-server. It would be helpful to bundle this service with the tool.

Create a PCM-Sensor-Server Systemd Service

To run pcm-sensor-server as a systemd service, you need to create a service file, /etc/systemd/system/pcm-sensor-server.service, with the following content. Make any necessary changes for your environment.

$ sudo vi /etc/systemd/system/pcm-sensor-server.service
[Unit]
Description=Process Counter Monitor (PCM) Sensor Service
Wants=network-online.target
After=network-online.target

[Service]
User=root
Group=root
Type=simple
ExecStart=/usr/sbin/pcm-sensor-server

[Install]
WantedBy=multi-user.target

Reload systemd daemon configuration.

$ sudo systemctl daemon-reload

Start and Enable the pcm-sensor-service service to run at boot time.

$ sudo systemctl start pcm-sensor-server
$ sudo systemctl enable pcm-sensor-server

Confirm the service is running

$ systemctl status pcm-sensor-server
● pcm-sensor-server.service - Process Counter Monitor (PCM) Sensor Service
     Loaded: loaded (/etc/systemd/system/pcm-sensor-server.service; disabled; vendor preset: disabled)
     Active: active (running) since Sat 2021-03-13 14:08:35 PST; 4s ago
   Main PID: 82447 (pcm-sensor-serv)
      Tasks: 549 (limit: 629145)
     Memory: 24.3M
        CPU: 952ms
     CGroup: /system.slice/pcm-sensor-server.service
             └─82447 /usr/sbin/pcm-sensor-server

[...]
Mar 13 14:08:35 a4bf0157a780.jf.intel.com pcm-sensor-server[82447]: Starting plain HTTP server on http://localhost:9738/

sscargal avatar Mar 19 '22 19:03 sscargal

Sounds good to me. @opcm and @MarkovaMaria is there a way to automatically adjust installation path with the cmake framework in the service file by using it as a template or so?

ogbrugge avatar Mar 19 '22 20:03 ogbrugge

Sounds good to me. @opcm and @MarkovaMaria is there a way to automatically adjust installation path with the cmake framework in the service file by using it as a template or so?

I think it can be considered.

markovamaria avatar Mar 22 '22 18:03 markovamaria

done

rdementi avatar Nov 20 '23 20:11 rdementi