API documentation

class metlog_psutils.psutil_plugin.LazyPSUtil(pid, server_addr=None)

This class can only be used outside the process that is being inspected

get_busy_stats()

Get process busy stats.

Return 3 statsd messages for total_cpu time in seconds, total uptime in seconds, and the percentage of time the process has been active.

get_connections()

Return details of each network connection as a list of dictionaries.

Keys in each connection dictionary are:

local - host:port for the local side of the connection

remote - host:port of the remote side of the connection

status - TCP Connection status. One of :
  • “ESTABLISHED”
  • “SYN_SENT”
  • “SYN_RECV”
  • “FIN_WAIT1”
  • “FIN_WAIT2”
  • “TIME_WAIT”
  • “CLOSE”
  • “CLOSE_WAIT”
  • “LAST_ACK”
  • “LISTEN”
  • “CLOSING”
get_cpu_info()

Return CPU usages in seconds split by system and user for the whole process. Also provides CPU % used for a 0.1 second interval.

Note that this method will block for 0.1 seconds.

get_io_counters()

Return the number of bytes read, written and the number of read and write syscalls that have invoked.

get_memory_info()

Return the percentage of physical memory used, RSS and VMS memory used

get_thread_cpuinfo()

Return CPU usages in seconds split by system and user on a per thread basis.

summarize_network(network_data)

Summarizes network connection information into something that is friendly to statsd.

From a metrics standpoint, we only really care about the number of connections in each state.

Connections are sorted into 2 buckets
  • server connections

For each listening host:port, a dictionary of connection states to connection counts is created

metlog_psutils.psutil_plugin.check_osx_perm()

psutil can’t do the right thing on OSX because of weird permissioning rules in Darwin.

http://code.google.com/p/psutil/issues/detail?id=108

metlog_psutils.psutil_plugin.config_plugin(config)

Configure the metlog plugin prior to binding it to the metlog client.

Project Versions

Previous topic

Detailed message layout

This Page