Starting AppDynamics with play

35 views
Skip to first unread message

Patrick Hunt

unread,
Mar 13, 2018, 8:10:49 AM3/13/18
to Ansible Project
I have a play that is fairly simple, to start AppDynamics.  I am able to start/stop each part as needed, except a portion called EUM (End User Monitoring).

My test play looks like:

---
- hosts: collector
  become
: true
  become_method
: su
  become_user
: root


  tasks
:


 
- name: stop eum
    shell
: bin/eum.sh stop
    args
:
      chdir
: /opt/AppDynamics/EUEM/eum-processor/


 
- name: wait 2 minutes
    wait_for
:
      timeout
: 120
    delegate_to
: localhost


 
- name: start eum
    shell
: bin/eum.sh start
    args
:
      chdir
: /opt/AppDynamics/EUEM/eum-processor/
...


The problem is with the "start eum" task.  The output from running the playbook is:

PLAYBOOK: restart_eum.yml *************************************************************************************************************************************************************************
1 plays in restart_eum.yml


PLAY
[collector] **********************************************************************************************************************************************************************************


TASK
[Gathering Facts] ****************************************************************************************************************************************************************************
ok
: [eum-server]
META
: ran handlers


TASK
[stop eum] ***********************************************************************************************************************************************************************************
task path
: /home/phunt/ansible/test/playbooks/restart_eum.yml:9
changed
: [eum-server] => {"changed": true, "cmd": "bin/eum.sh stop", "delta": "0:00:01.047571", "end": "2018-03-13 07:52:38.369432", "rc": 0, "start": "2018-03-13 07:52:37.321861", "stderr": "", "stderr_lines": [], "stdout": "EUM Processor stopped.", "stdout_lines": ["EUM Processor stopped."]}


TASK
[wait 2 minutes] *****************************************************************************************************************************************************************************
task path
: /home/phunt/ansible/test/playbooks/restart_eum.yml:14
ok
: [eum-server -> localhost] => {"changed": false, "elapsed": 120, "path": null, "port": null, "search_regex": null, "state": "started"}


TASK
[start eum] **********************************************************************************************************************************************************************************
task path
: /home/phunt/ansible/test/playbooks/restart_eum.yml:19
changed
: [eum-server] => {"changed": true, "cmd": "bin/eum.sh start", "delta": "0:00:01.031939", "end": "2018-03-13 07:54:42.994837", "rc": 0, "start": "2018-03-13 07:54:41.962898", "stderr": "", "stderr_lines": [], "stdout": "EUM Processor started (PID=23232).", "stdout_lines": ["EUM Processor started (PID=23232)."]}
META
: ran handlers
META
: ran handlers


PLAY RECAP
****************************************************************************************************************************************************************************************
eum
-server              : ok=4    changed=2    unreachable=0    failed=0



This indicates that the EUM processor has started, however, when I log into the server EUM is not running.

When entering the commands in manually to start eum there is an additional line of output that is present 3-5 seconds after the "EUM Processor started..." bit.  The output from manual run is:



[root@collector eum-processor]# bin/eum.sh start
Using EUM_HOME:   /opt/AppDynamics/EUEM/eum-processor
Using EUM_PID:    pid.txt
EUM
Processor started (PID=23595).
[root@collector eum-processor]# INFO  [2018-03-13 12:02:05,136] org.eclipse.jetty.util.log: Logging initialized @2571ms


Is there a way for me to wait for that INFO line before marking the task as completed?


Thank you, 
Patrick

Patrick Hunt

unread,
Mar 13, 2018, 10:24:47 AM3/13/18
to Ansible Project
I used the "async" and "poll" options to work around this.  So my trouble task now looks like:

- name: start eum
    shell
: bin/eum.sh start
    args
:
      chdir
: /opt/AppDynamics/EUEM/eum-processor/

    async
: 30
    poll
: 10



If I register the output as a variable and print it, it still only displays the "EUM Processor started..." line, but the EUM process is actually, as opposed to previously where it would not be fully started before the play ended.


Hope this helps someone else out!

Kai Stian Olstad

unread,
Mar 18, 2018, 8:06:53 AM3/18/18
to ansible...@googlegroups.com
On Tuesday, 13 March 2018 13.10.49 CET Patrick Hunt wrote:
> This indicates that the EUM processor has started, however, when I log into
> the server EUM is not running.
>
> When entering the commands in manually to start eum there is an additional
> line of output that is present 3-5 seconds after the "EUM Processor
> started..." bit. The output from manual run is:

You should not start the application like this, and as you have seen it mostly failes.
Create a file for you init system and start the application with the init system.

--
Kai Stian Olstad

Patrick Hunt

unread,
Mar 20, 2018, 9:16:49 AM3/20/18
to Ansible Project
Good idea Kai, thank you.
Reply all
Reply to author
Forward
0 new messages