Here is the list of steps to add a service in linux servers that uses systemd instead of the old chkconfig (Red Hat 7, latest Centos and ubuntu, etc).
- Make sure the DT_INSTALL/init.d/dynaTrace* init scripts does not specify a value for the variable
- Download the samples scripts dynatrace provides in the installation instructions (systemdSamples.zip).
- Unzip into a temporaty directory.
- Important: For each script change the name from dt<something>.service to dyna<something>.service. Example:
dtserver.service to dynaserver.service
- In the pragma Service, edit the parameters to specify the installation path, and also the username used for the installation
Example, for dynaserver.service
Do this for all the services you need (server, collectors, analysis)
- Now, as root copy the modified files to /etc/systemd/system
- As root, add the service so it will be started at server boot:
systemctl enable <service file>.service
- To start/stop the service manually (testing)
systemctl start <service file>.service
systemctl stop <service file>.service
systemctl enable dynaserver.service
systemctl start dynaserver.service
Hope it helps!
You can find the link in the dynatrace server installation manual (search for systemd string).
Anyway, this is the address:
For me the manual step (systemctl start dynaserver.service) didn't work until I performed the systemctl enable dynaserver.service before executing systemctl start dynaserver.service. Any idea why that might be so?...maybe it's the systemd related symlinks that are created...I'm not sure. Thanks to Antonio for this great post...I would like to copy the link to this post to the comments under the documentation page that discusses the systemd topic.
You are right:
sudo systemctl enable application.service
This will create a symbolic link from the system's copy of the service file (usually in /lib/systemd/systemor /etc/systemd/system) into the location on disk where systemd looks for autostart files (usually /etc/systemd/system/some_target.target.wants).
How would I setup systemd service scripts for multiple instances. I got the first collector working using this post but when I copied it and adjusted to control second instance it fails to work, no errors.
Description=Dynatrace Collector service
Changes: ExecStart/ExecStop point to dynaTraceCollector_2 init.d script.
Thank you for your help.
That rename step is rather important. It wasn't immediately obvious to me why the scripts needed to be renamed and why things break when they aren't, so I thought a quick note might be useful.
The DT_INSTALL/init.d/dynaTraceServer script sniffs for a running process if there is no valid value in the *.pid file. This sniffing will misidentify a service start command like "sudo service dtserver start" as a running DT server process and skip starting it.
See the 'PROCESSPID=$(ps -ef | grep -v "instance" ...' lines