diff --git a/NEWS b/NEWS index c03e33a353b493336915a6220f97d9a133327dc2..b9847652b9a33a7e13d447526a8460a50bd5085b 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,7 @@ Version 2.7 Enhancements and new features: + * Add Application Monitoring Process plugin (issue #780) * Improve IP plugin to display public IP address (issue #646) * CPU additionnal stats monitoring: Context switch, Interrupts... (issue #810) * [Folders] Differentiate permission issue and non-existence of a directory (issue #828) diff --git a/docs/_static/amps.png b/docs/_static/amps.png new file mode 100644 index 0000000000000000000000000000000000000000..bbcc7efe1e95e8c5e161d40b7ce027d26f9ab144 Binary files /dev/null and b/docs/_static/amps.png differ diff --git a/docs/aoa/index.rst b/docs/aoa/index.rst index 097555a9a347bca16b36c26c1e9135c2bf30cb03..d0b65ddbd3908ca06be15f545e6d31bbeae9830e 100644 --- a/docs/aoa/index.rst +++ b/docs/aoa/index.rst @@ -32,6 +32,7 @@ Legend: sensors ps monitor + amps logs docker actions diff --git a/docs/cmds.rst b/docs/cmds.rst index cfd5111597888cba123765ca4a1f5d1580baff82..e67bd9740f956faf854b9342bb5b3b004e7bc291 100644 --- a/docs/cmds.rst +++ b/docs/cmds.rst @@ -95,6 +95,14 @@ Command-Line Options disable process module +.. option:: --disable-monitor + + disable monitoring process list module + +.. option:: --disable-amp + + disable application monitoring process module + .. option:: --disable-log disable log module @@ -291,6 +299,9 @@ The following commands (key pressed) are supported while in Glances: - If CPU iowait ``>60%``, sort processes by I/O read and write +``A`` + Enable/disable Application Monitoring Process + ``b`` Switch between bit/s or Byte/s for network I/O diff --git a/glances/amps/glances_amp.py b/glances/amps/glances_amp.py index f3395d425b71760a4c906587520c812a469e245c..075b1d80b93b569b65c5bbfc84874649fad4b1e9 100644 --- a/glances/amps/glances_amp.py +++ b/glances/amps/glances_amp.py @@ -21,6 +21,15 @@ I am your father... ...for all Glances Application Monitoring Processes (AMP). + +AMP (Application Monitoring Process) +A Glances AMP is a Python script called (every *refresh* seconds) if: +- the AMP is *enabled* in the Glances configuration file +- a process is running (match the *regex* define in the configuration file) +The script should define a Amp (GlancesAmp) class with, at least, an update method. +The update method should call the set_result method to set the AMP return string. +The return string is a string with one or more line (\n between lines). +If the *one_line* var is true then the AMP will be displayed in one line. """ from glances.compat import u diff --git a/glances/amps/glances_nginx.py b/glances/amps/glances_nginx.py index b43da089ca5f1905e5c87ca38ff458a052f93217..c9cdcdc0fe2616f16ac37bdeb030fabd8793b3d4 100644 --- a/glances/amps/glances_nginx.py +++ b/glances/amps/glances_nginx.py @@ -17,24 +17,32 @@ # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . -""" -AMP (Application Monitoring Process) -A Glances AMP is a Python script called (every *refresh* seconds) if: -- the AMP is *enabled* in the Glances configuration file -- a process is running (match the *regex* define in the configuration file) -The script should define a Amp (GlancesAmp) class with, at least, an update method. -The update method should call the set_result method to set the AMP return string. -The return string is a string with one or more line (\n between lines). -If the *one_line* var is true then the AMP will be displayed in one line. -""" - """ Nginx AMP ========= -Monitor the Nginx process using the status page +Monitor the Nginx process using the status page. + +How to read the stats +--------------------- + +Active connections – Number of all open connections. This doesn’t mean number of users. +A single user, for a single pageview can open many concurrent connections to your server. +Server accepts handled requests – This shows three values. + First is total accepted connections. + Second is total handled connections. Usually first 2 values are same. + Third value is number of and handles requests. This is usually greater than second value. + Dividing third-value by second-one will give you number of requests per connection handled + by Nginx. In above example, 10993/7368, 1.49 requests per connections. +Reading – nginx reads request header +Writing – nginx reads request body, processes request, or writes response to a client +Waiting – keep-alive connections, actually it is active – (reading + writing). +This value depends on keepalive-timeout. Do not confuse non-zero waiting value for poor +performance. It can be ignored. +Source (https://easyengine.io/tutorials/nginx/status-page/) -Configuration file example: +Configuration file example +-------------------------- [nginx] # Nginx status page should be enable (https://easyengine.io/tutorials/nginx/status-page/) diff --git a/glances/main.py b/glances/main.py index 9be00fcb3b581f40ebf121208687bc44faeda875..4f2baece43f6281545a1ad13d6f4628c59f27c2f 100644 --- a/glances/main.py +++ b/glances/main.py @@ -138,6 +138,10 @@ Start the client browser (browser mode):\n\ help='disable network, disk I/O, FS and sensors modules') parser.add_argument('--disable-process', action='store_true', default=False, dest='disable_process', help='disable process module') + parser.add_argument('--disable-monitoring', action='store_true', default=False, + dest='disable_monitor', help='disable monitoring list module') + parser.add_argument('--disable-amp', action='store_true', default=False, + dest='disable_amp', help='disable applications monitoring process (AMP) module') parser.add_argument('--disable-log', action='store_true', default=False, dest='disable_log', help='disable log module') parser.add_argument('--disable-bold', action='store_true', default=False, diff --git a/glances/outputs/glances_curses.py b/glances/outputs/glances_curses.py index 1a67c677156c3a318c99e37de4a29d6670c72100..77c94511de7bdbc2c1a572a91b12d3a881bf7e61 100644 --- a/glances/outputs/glances_curses.py +++ b/glances/outputs/glances_curses.py @@ -328,6 +328,9 @@ class _GlancesCurses(object): # 'a' > Sort processes automatically and reset to 'cpu_percent' glances_processes.auto_sort = True glances_processes.sort_key = 'cpu_percent' + elif self.pressedkey == ord('A'): + # 'A' > enable/disable AMP module + self.args.disable_amp = not self.args.disable_amp elif self.pressedkey == ord('b'): # 'b' > Switch between bit/s and Byte/s for network IO self.args.byte = not self.args.byte diff --git a/glances/plugins/glances_amps.py b/glances/plugins/glances_amps.py index 5a47b84d649b4d4b255d7557c7412fe583598c2a..b2422fd53b6eba57ed23c7649ef1f0d04b6af5ca 100644 --- a/glances/plugins/glances_amps.py +++ b/glances/plugins/glances_amps.py @@ -73,7 +73,7 @@ class Plugin(GlancesPlugin): # Only process if stats exist and display plugin enable... ret = [] - if not self.stats or args.disable_process: + if not self.stats or args.disable_process or args.disable_amp: return ret # Build the string message diff --git a/glances/plugins/glances_monitor.py b/glances/plugins/glances_monitor.py index 98e9b6987291c1482d683eba33adbba015de4741..763e17969d51499cc52e8357328012a54e3342f4 100644 --- a/glances/plugins/glances_monitor.py +++ b/glances/plugins/glances_monitor.py @@ -88,7 +88,7 @@ class Plugin(GlancesPlugin): ret = [] # Only process if stats exist and display plugin enable... - if not self.stats or args.disable_process: + if not self.stats or args.disable_process or args.disable_monitor: return ret # Build the string message