pfds - report a snapshot of the current processes fd
pfds is one-binary and supports multi process. It's simple and powerful.
usage
- short version
$ sudo pfds short `pgrep nginx` `pgrep httpd` | head
13963 matsumoto_r /usr/local/apache-2.4.16/htdocs/blog/wp-includes/js/jquery/jquery-migrate.min.js
13963 matsumoto_r /usr/local/apache-2.4.16/htdocs/blog/wp-includes/js/jquery/jquery.js
13963 matsumoto_r /usr/local/apache-2.4.16/htdocs/blog/wp-includes/js/wp-emoji-release.min.js
13963 matsumoto_r /usr/local/apache-2.4.16/htdocs/moblog/robots.txt
13964 matsumoto_r /usr/local/apache-2.4.16/htdocs/blog/favicon.ico
13964 matsumoto_r /usr/local/apache-2.4.16/htdocs/blog/wp-content/plugins/akismet/_inc/form.js
13964 matsumoto_r /usr/local/apache-2.4.16/htdocs/blog/wp-content/plugins/codecolorer/codecolorer.css
13964 matsumoto_r /usr/local/apache-2.4.16/htdocs/blog/wp-content/plugins/oembed-instagram/oembed-instagram.js
13964 matsumoto_r /usr/local/apache-2.4.16/htdocs/blog/wp-content/plugins/shadowbox-js/css/extras.css
19940 matsumoto_r /usr/local/apache-2.4.16/htdocs/moblog/wp-content/uploads/2012/12/20121229-180225.jpg
19940 matsumoto_r /usr/local/apache-2.4.16/htdocs/moblog/wp-content/uploads/2012/12/20121224-202408.jpg
- output with cpu and memory usage
$ sudo pfds `pgrep nginx` `pgrep httpd` | sort -nk2 | tail
13963 0.0 0.3 matsumoto_r /usr/local/apache-2.4.16/htdocs/blog/wp-includes/js/jquery/jquery-migrate.min.js
13963 0.0 0.3 matsumoto_r /usr/local/apache-2.4.16/htdocs/blog/wp-includes/js/jquery/jquery.js
13963 0.0 0.3 matsumoto_r /usr/local/apache-2.4.16/htdocs/blog/wp-includes/js/wp-emoji-release.min.js
13963 0.0 0.3 matsumoto_r /usr/local/apache-2.4.16/htdocs/moblog/robots.txt
13964 0.0 0.3 matsumoto_r /usr/local/apache-2.4.16/htdocs/blog/favicon.ico
13964 0.0 0.3 matsumoto_r /usr/local/apache-2.4.16/htdocs/blog/wp-content/plugins/akismet/_inc/form.js
13964 0.0 0.3 matsumoto_r /usr/local/apache-2.4.16/htdocs/blog/wp-content/plugins/codecolorer/codecolorer.css
13964 0.0 0.3 matsumoto_r /usr/local/apache-2.4.16/htdocs/blog/wp-content/plugins/oembed-instagram/oembed-instagram.js
13964 0.0 0.3 matsumoto_r /usr/local/apache-2.4.16/htdocs/blog/wp-content/plugins/shadowbox-js/css/extras.css
19940 0.0 0.3 matsumoto_r /usr/local/apache-2.4.16/htdocs/blog/wp-content/plugins/wp-social-bookmarking-light/images/hatena.gif
29391 24.5 2.4 matsumoto_r /usr/local/apache-2.4.16/htdocs/blog/index.php
29395 29.7 3.0 matsumoto_r /usr/local/apache-2.4.16/htdocs/blog/index.php
- Adjust multi process (default 4 process)
sudo MRUBY_MULTI=24 pfds `pgrep httpd`
sudo MRUBY_MULTI=1 pfds `pgrep httpd`
build
- custom
mrblib/pfds/config.rb
module Pfds
module Config
MULTI_PROCESS = (ENV["MRUBY_MULTI"] || 4).to_i
IGNORE_FILES = %w(
/dev/null
/var/log/httpd/access_log
/var/log/httpd/ssl_access_log
/var/log/httpd/error_log
/var/log/httpd/ssl_error_log
)
IGNORE_PATTERN = %w(
^pipe:
^anon_inode:
^socket:
^/dev/pts/
)
end
end
- build into
mruby/bin/pfds
rake
/usr/local/bin
install to rake install
License
under the MIT License: