How to Monitor CPU and MEM of Datameers Java Process

Goal

After integrating Datameer into an enterprise infrastructure, monitor the CPU and memory consumption of Datameer's Java process.

Learn

For this task, use the ps command:

while true; echo -n "["$(date +"%Y-%m-%d %H:%M:%S")"] "; do ps -p `dmpid` -o %cpu,%mem --no-heading; sleep 10; done

Introduce another alias:

alias dmmon='while true; echo -n "["$(date +"%Y-%m-%d %H:%M:%S")"] "; do ps -p `dmpid` -o %cpu,%mem --no-heading; sleep 10; done' 

It would also be possible to include the number of threads using nlwp.

To generate CSV output for logging into a file you could use the following approach:

echo -n "$(date +"%Y-%m-%d %H:%M:%S")"; ps -p `dmpid` -o "%cpu,%mem" --no-heading | tr ' ' ','
while true; do echo -n "$(date +"%Y-%m-%d %H:%M:%S")"; ps -p `dmpid` -o %cpu,%mem --no-heading | tr ' ' ','; sleep 10; done

Further Information

See man ps and

How to Set Up Bash Shell Aliases
Java Memory and CPU Monitoring Tools and Techniques