Appdynamics / Appdynamics/appdynamics-cookbooks
SystemD init script for ubuntu 16.04
- Dominant language
- Ruby
- Stars
- 28
- Forks
- 35
- PR merge metrics
- No merged PRs in 30d
Description
Getting this error when trying to install the machine agent on ubuntu 16.04 with chef 12
```bash
appdynamics_machine_agent.service is not a native service, redirecting to systemd-sysv-install
Executing /lib/systemd/systemd-sysv-install enable appdynamics_machine_agent
insserv: warning: script 'appdynamics_machine_agent' missing LSB tags and overrides
update-rc.d: error: appdynamics_machine_agent Default-Start contains no runlevels, aborting.
```
```bash
Recipe: appdynamics::java_agent
* remote_file[/var/chef/cache/AppDynamicsJavaAgent.zip] action create (up to date)
* ark[javaagent] action put
* directory[/opt/appdynamics/javaagent] action create (up to date)
* remote_file[/var/chef/cache/javaagent.zip] action create (up to date)
* execute[unpack /var/chef/cache/javaagent.zip] action nothing (skipped due to action :nothing)
* execute[set owner on /opt/appdynamics/javaagent] action nothing (skipped due to action :nothing)
(up to date)
* template[/opt/appdynamics/javaagent/conf/controller-info.xml] action create (up to date)
Recipe: appdynamics::machine_agent
* apt_package[unzip] action install (up to date)
* directory[/opt/appdynamics/machineagent/conf] action create (up to date)
* remote_file[/var/chef/cache/AppDynamicsMachineAgent.zip] action createps aux | grep java
- create new file /var/chef/cache/AppDynamicsMachineAgent.zip
- update content in file /var/chef/cache/AppDynamicsMachineAgent.zip from none to 924837
(file sizes exceed 10000000 bytes, diff output suppressed)
- change mode from '' to '0444'
* execute[unzip-appdynamics-machine-agent] action run
- execute unzip -qqo /var/chef/cache/AppDynamicsMachineAgent.zip
* template[/opt/appdynamics/machineagent/run.sh] action create
- create new file /opt/appdynamics/machineagent/run.sh
- update content in file /opt/appdynamics/machineagent/run.sh from none to 1faa75
--- /opt/appdynamics/machineagent/run.sh 2017-10-19 22:55:54.161147103 +0000
+++ /opt/appdynamics/machineagent/.chef-run20171019-109208-18fa3q4.sh 2017-10-19 22:55:54.161147103 +0000
@@ -1 +1,3 @@
+#!/bin/sh
+"/usr/bin/java" -Xmx32m -jar "/opt/appdynamics/machineagent/machineagent.jar" &
- change mode from '' to '0744'
- change owner from '' to 'root'
- change group from '' to 'root'
* execute[unzip-appdynamics-machine-agent] action run
- execute unzip -qqo /var/chef/cache/AppDynamicsMachineAgent.zip
* template[/etc/init.d/appdynamics_machine_agent] action create
- create new file /etc/init.d/appdynamics_machine_agent
- update content in file /etc/init.d/appdynamics_machine_agent from none to a07c17
--- /etc/init.d/appdynamics_machine_agent 2017-10-19 22:55:57.837080954 +0000
+++ /etc/init.d/.chef-appdynamics_machine_agent20171019-109208-5mshtg 2017-10-19 22:55:57.837080954 +0000
@@ -1 +1,54 @@
+#!/bin/sh
+#
+#
+# Subsystem file for AppDynamics machine agent
+#
+# chkconfig: 2345 95 05 (1)
+# description: AppDynamics machine agent
+
+# source function library
+if [ -r /lib/lsb/init-functions ]; then
+ . /lib/lsb/init-functions
+elif [ -r /etc/rc.d/init.d/functions ]; then
+ . /etc/rc.d/init.d/functions
+elif [ -r /etc/init.d/functions ]; then
+ . /etc/init.d/functions
+fi
+
+INSTALL_DIR="/opt/appdynamics/machineagent"
+RETVAL=0
+PROG="$INSTALL_DIR/run.sh"
+
+start() {
+ echo -n $"Starting AppDynamics machine agent:"
+ "$PROG"
+ RETVAL=$?
+ echo
+}
+
+stop() {
+ echo -n $"Stopping AppDynamics machine agent:"
+ killproc "$PROG" -TERM
+ RETVAL=$?
+ echo
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|restart}"
+ RETVAL=1
+ ;;
+esac
+
+exit $RETVAL
- change mode from '' to '0744'
- change owner from '' to 'root'
- change group from '' to 'root'
* template[/opt/appdynamics/machineagent/conf/controller-info.xml] action create
- update content in file /opt/appdynamics/machineagent/conf/controller-info.xml from 282428 to 8074cc
--- /opt/appdynamics/machineagent/conf/controller-info.xml 2017-10-12 21:29:38.000000000 +0000
+++ /opt/appdynamics/machineagent/conf/.chef-controller-info20171019-109208-8wqabh.xml 2017-10-19 22:55:57.849080738 +0000
@@ -1,75 +1,48 @@
-
-
-
+
+ netdocuments2.saas.appdynamics.com
-
-
+
+ 443
-
- false
+
+ true
+ 2) Enables the agent to resolve the AppDynamics Controller host and port when the host
+ machine where this agent resides is created through AppDynamics Orchestration. -->
false
-
+ netdocuments2
+ b37f635b956e
- 1) The machine host name is not constant
- 2) You prefer to use a specific name in the UI
- 3) The machine has both a machine agent and app agents on it.
+
+ lab-ducot
+
+
- This can be overridden with the environment variable 'APPDYNAMICS_AGENT_UNIQUE_HOST_ID' or the system property
- '-Dappdynamics.agent.uniqueHostId' -->
-
-
-
-
-
-
-
-
-
- false
-
-
-
+
+ false
* service[appdynamics_machine_agent] action enable
================================================================================
Error executing action `enable` on resource 'service[appdynamics_machine_agent]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of /bin/systemctl --system enable appdynamics_machine_agent ----
STDOUT:
STDERR: appdynamics_machine_agent.service is not a native service, redirecting to systemd-sysv-install
Executing /lib/systemd/systemd-sysv-install enable appdynamics_machine_agent
insserv: warning: script 'appdynamics_machine_agent' missing LSB tags and overrides
update-rc.d: error: appdynamics_machine_agent Default-Start contains no runlevels, aborting.
---- End output of /bin/systemctl --system enable appdynamics_machine_agent ----
Ran /bin/systemctl --system enable appdynamics_machine_agent returned 1
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/appdynamics/recipes/machine_agent.rb
105: service 'appdynamics_machine_agent' do
106: supports [:start, :stop, :restart]
107: action [:enable, :start]
108: end
Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/appdynamics/recipes/machine_agent.rb:105:in `from_file'
service("appdynamics_machine_agent") do
action [:enable, :start]
supports {:restart=>true, :reload=>nil, :status=>nil, :start=>true, :stop=>true}
retries 0
retry_delay 2
default_guard_interpreter :default
service_name "appdynamics_machine_agent"
enabled nil
running nil
masked nil
pattern "appdynamics_machine_agent"
declared_type :service
cookbook_name "appdynamics"
recipe_name "machine_agent"
end
System Info:
------------
chef_version=12.21.4
platform=ubuntu
platform_version=16.04
ruby=ruby 2.3.4p301 (2017-03-30 revision 58214) [x86_64-linux]
program_name=chef-client worker: ppid=109203;start=22:55:28;
executable=/opt/chef/bin/chef-client
Starting audit phase
Finished in 0.0006 seconds (files took 0.71417 seconds to load)
0 examples, 0 failures
Auditing complete
Running handlers:
Running handlers complete
Chef Client failed. 13 resources updated in 30 seconds
```
Contributor guide
No contributing guide indexed for this repository
Research direction
The machine-agent service is created by the appdynamics::machine_agent recipe at /etc/init.d/appdynamics_machine_agent; start there and inspect the generated init script's LSB metadata. Reproduce the enable step on Ubuntu 16.04 with Chef 12, then verify systemd no longer reports missing runlevels and the service can be enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash, linux, ruby, ubuntu
- Domain
- devops, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100