observer_cli


observer_cli

Authors: zhongwencool (zhongwencool@gmail.com).

Observer CLI is a library to be dropped into any beam nodes, to be used to assist DevOps people diagnose problems in production nodes, included panels are:

== Home == Home

erlang:system_info/1 returns specified information about the current system by below item. When the ratio is greater than 85%, it becomes red.
Proc Count process_count/process_limit Smp Support smp_support
Port Count port_count/port_limit Multi Scheduling multi_scheduling
Atom Count atom_count/atom_limit Logical Processors logical_processors
PS report a snapshot of the beam process.
ps -o pcpu cpu utilization of the process in "##.#" format. Currently, it is the CPU time used divided by the time the process has been running (cputime/realtime ratio), expressed as a percentage. It will not add up to 100% unless you are lucky. .
ps -o pmem ratio of the process's resident set size to the physical memory on the machine, expressed as a percentage.
erlang:memory/0 Returns a list with information about memory dynamically allocated by the Erlang emulator.
Total The total amount of memory currently allocated.
Process The total amount of memory currently used by the Erlang processes.
Atom The total amount of memory currently used for atoms.
ETS The total amount of memory currently allocated for ETS tables.
Binary The total amount of memory currently allocated for binaries.
Code The total amount of memory currently allocated for Erlang code.
erlang:statistics/1
active task returns the same as statistics(active_tasks_all) with the exception that no information about the dirty IO run queue and its associated schedulers is part of the result. That is, only tasks that are expected to be CPU bound are part of the result.
context switches returns the total number of context switches since the system started.
reductions(total/sinceLastCall) total reductions/reductions since last call.
io The total number of bytes received/send through ports and the receive/send bytes through ports of growth during the refresh interval.
garbage_collection erlang:statistcs(garbage_collection) which is return total value and the {Number_of_GCs, Words_Reclaimed} of growth during the refresh interval.
run_queue The total length of all normal run-queues. That is, the number of processes and ports that are ready to run on all available normal run-queues. Dirty run queues are not part of the result.

Increments are values that are mostly useful when compared to a previous one to have an idea what they're doing, because otherwise they'd never stop increasing: bytes in and out of the node, number of garbage colelctor runs, words of memory that were garbage collected, and the global reductions count for the node.

Scheduler utilization by erlang:statistics(scheduler_wall_time):

== Process == When looking for high memory usage, for example it's interesting to be able to list all of a node's processes and find the top N consumers. Enter m then press Enter will use the recon:proc_count(memory, N) function, we can get: Top recon:proc_count/2 and recon:proc_window/3 are to be used when you require information about processes in a larger sense: biggest consumers of given process memory, reductions, binary, total_heap_size, message_queue_len, either absolutely or over a sliding time window, respectively.

More detail about sliding time windows see recon:proc_window/3

When an abnormal process is found, enter the suspected process sequence(Integer) then press Enter will use erlang:process_info/2 to show a lot of information available(which is safe to use in production) about processes. Process

== Network ==

Network Fetches a given attribute from all inet ports (TCP, UDP, SCTP) and returns the biggest Num consumers by recon:inet_count/2 and recon:inet_windows/3 . Attribute name refer to inet:getstat/1. When find out who is slowly but surely eating up all your bandwidth, enter the suspected port sequence(Integer) then press Enter will use recon:port_info/2 to show a lot of information available about port. Port

== System ==

System

== ETS ==

Ets ETS tables are never garbage collected, and will maintain their memory usage as long as records will be left undeleted in a table. Only removing records manually (or deleting the table) will reclaim memory.

Top N list sort by memory size, all items defined in ets:info/2

== Mnesia ==

Mnesia

Top N list sort by memory size, all items defined in mnesia:table_info/2

== Application ==

Application

Find application debug information by application_controller:info().