/usr/lib/python3/dist-packages/glances/plugins/glances_help.py is in glances 2.7.1.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | # -*- coding: utf-8 -*-
#
# This file is part of Glances.
#
# Copyright (C) 2015 Nicolargo <nicolas@nicolargo.com>
#
# Glances is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Glances is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Help plugin.
Just a stupid plugin to display the help screen.
"""
from glances import __appname__, __version__, psutil_version
from glances.plugins.glances_plugin import GlancesPlugin
class Plugin(GlancesPlugin):
"""Glances help plugin."""
def __init__(self, args=None, config=None):
"""Init the plugin."""
super(Plugin, self).__init__(args=args)
# Set the config instance
self.config = config
# We want to display the stat in the curse interface
self.display_curse = True
# init data dictionary
self.view_data = {}
self.generate_view_data()
def update(self):
"""No stats. It is just a plugin to display the help."""
pass
def generate_view_data(self):
self.view_data['version'] = '{0} {1}'.format(__appname__.title(), __version__)
self.view_data['psutil_version'] = ' with PSutil {0}'.format(psutil_version)
try:
self.view_data['configuration_file'] = 'Configuration file: {0}'.format(self.config.loaded_config_file)
except AttributeError:
pass
msg_col = ' {0:1} {1:35}'
msg_col2 = ' {0:1} {1:35}'
self.view_data['sort_auto'] = msg_col.format('a', 'Sort processes automatically')
self.view_data['sort_network'] = msg_col2.format('b', 'Bytes or bits for network I/O')
self.view_data['sort_cpu'] = msg_col.format('c', 'Sort processes by CPU%')
self.view_data['show_hide_alert'] = msg_col2.format('l', 'Show/hide alert logs')
self.view_data['sort_mem'] = msg_col.format('m', 'Sort processes by MEM%')
self.view_data['sort_user'] = msg_col.format('u', 'Sort processes by USER')
self.view_data['delete_warning_alerts'] = msg_col2.format('w', 'Delete warning alerts')
self.view_data['sort_proc'] = msg_col.format('p', 'Sort processes by name')
self.view_data['delete_warning_critical_alerts'] = msg_col2.format('x', 'Delete warning and critical alerts')
self.view_data['sort_io'] = msg_col.format('i', 'Sort processes by I/O rate')
self.view_data['percpu'] = msg_col2.format('1', 'Global CPU or per-CPU stats')
self.view_data['sort_cpu_times'] = msg_col.format('t', 'Sort processes by TIME')
self.view_data['show_hide_help'] = msg_col2.format('h', 'Show/hide this help screen')
self.view_data['show_hide_diskio'] = msg_col.format('d', 'Show/hide disk I/O stats')
self.view_data['show_hide_irq'] = msg_col2.format('Q', 'Show/hide IRQ stats')
self.view_data['view_network_io_combination'] = msg_col2.format('T', 'View network I/O as combination')
self.view_data['show_hide_filesystem'] = msg_col.format('f', 'Show/hide filesystem stats')
self.view_data['view_cumulative_network'] = msg_col2.format('U', 'View cumulative network I/O')
self.view_data['show_hide_network'] = msg_col.format('n', 'Show/hide network stats')
self.view_data['show_hide_filesytem_freespace'] = msg_col2.format('F', 'Show filesystem free space')
self.view_data['show_hide_sensors'] = msg_col.format('s', 'Show/hide sensors stats')
self.view_data['generate_graphs'] = msg_col2.format('g', 'Generate graphs for current history')
self.view_data['show_hide_left_sidebar'] = msg_col.format('2', 'Show/hide left sidebar')
self.view_data['reset_history'] = msg_col2.format('r', 'Reset history')
self.view_data['enable_disable_process_stats'] = msg_col.format('z', 'Enable/disable processes stats')
self.view_data['quit'] = msg_col2.format('q', 'Quit (Esc and Ctrl-C also work)')
self.view_data['enable_disable_top_extends_stats'] = msg_col.format('e', 'Enable/disable top extended stats')
self.view_data['enable_disable_short_processname'] = msg_col.format('/', 'Enable/disable short processes name')
self.view_data['enable_disable_irix'] = msg_col.format('0', 'Enable/disable Irix process CPU')
self.view_data['enable_disable_docker'] = msg_col2.format('D', 'Enable/disable Docker stats')
self.view_data['enable_disable_quick_look'] = msg_col.format('3', 'Enable/disable quick look plugin')
self.view_data['show_hide_ip'] = msg_col2.format('I', 'Show/hide IP module')
self.view_data['diskio_iops'] = msg_col2.format('B', 'Count/rate for Disk I/O')
self.view_data['show_hide_top_menu'] = msg_col2.format('5', 'Show/hide top menu (QL, CPU, MEM, SWAP and LOAD)')
self.view_data['edit_pattern_filter'] = 'ENTER: Edit the process filter pattern'
def get_view_data(self, args=None):
return self.view_data
def msg_curse(self, args=None):
"""Return the list to display in the curse interface."""
# Init the return message
ret = []
# Build the string message
# Header
ret.append(self.curse_add_line(self.view_data['version'], 'TITLE'))
ret.append(self.curse_add_line(self.view_data['psutil_version']))
ret.append(self.curse_new_line())
# Configuration file path
if 'configuration_file' in self.view_data:
ret.append(self.curse_new_line())
ret.append(self.curse_add_line(self.view_data['configuration_file']))
ret.append(self.curse_new_line())
# Keys
ret.append(self.curse_new_line())
ret.append(self.curse_add_line(self.view_data['sort_auto']))
ret.append(self.curse_add_line(self.view_data['sort_network']))
ret.append(self.curse_new_line())
ret.append(self.curse_add_line(self.view_data['sort_cpu']))
ret.append(self.curse_add_line(self.view_data['show_hide_alert']))
ret.append(self.curse_new_line())
ret.append(self.curse_add_line(self.view_data['sort_mem']))
ret.append(self.curse_add_line(self.view_data['delete_warning_alerts']))
ret.append(self.curse_new_line())
ret.append(self.curse_add_line(self.view_data['sort_user']))
ret.append(self.curse_add_line(self.view_data['delete_warning_critical_alerts']))
ret.append(self.curse_new_line())
ret.append(self.curse_add_line(self.view_data['sort_proc']))
ret.append(self.curse_add_line(self.view_data['percpu']))
ret.append(self.curse_new_line())
ret.append(self.curse_add_line(self.view_data['sort_io']))
ret.append(self.curse_add_line(self.view_data['show_hide_ip']))
ret.append(self.curse_new_line())
ret.append(self.curse_add_line(self.view_data['sort_cpu_times']))
ret.append(self.curse_add_line(self.view_data['enable_disable_docker']))
ret.append(self.curse_new_line())
ret.append(self.curse_add_line(self.view_data['show_hide_diskio']))
ret.append(self.curse_add_line(self.view_data['view_network_io_combination']))
ret.append(self.curse_new_line())
ret.append(self.curse_add_line(self.view_data['show_hide_filesystem']))
ret.append(self.curse_add_line(self.view_data['view_cumulative_network']))
ret.append(self.curse_new_line())
ret.append(self.curse_add_line(self.view_data['show_hide_network']))
ret.append(self.curse_add_line(self.view_data['show_hide_filesytem_freespace']))
ret.append(self.curse_new_line())
ret.append(self.curse_add_line(self.view_data['show_hide_sensors']))
ret.append(self.curse_add_line(self.view_data['generate_graphs']))
ret.append(self.curse_new_line())
ret.append(self.curse_add_line(self.view_data['show_hide_left_sidebar']))
ret.append(self.curse_add_line(self.view_data['reset_history']))
ret.append(self.curse_new_line())
ret.append(self.curse_add_line(self.view_data['enable_disable_process_stats']))
ret.append(self.curse_add_line(self.view_data['show_hide_help']))
ret.append(self.curse_new_line())
ret.append(self.curse_add_line(self.view_data['enable_disable_quick_look']))
ret.append(self.curse_add_line(self.view_data['diskio_iops']))
ret.append(self.curse_new_line())
ret.append(self.curse_add_line(self.view_data['enable_disable_top_extends_stats']))
ret.append(self.curse_add_line(self.view_data['show_hide_top_menu']))
ret.append(self.curse_new_line())
ret.append(self.curse_add_line(self.view_data['enable_disable_short_processname']))
ret.append(self.curse_add_line(self.view_data['show_hide_irq']))
ret.append(self.curse_new_line())
ret.append(self.curse_add_line(self.view_data['enable_disable_irix']))
ret.append(self.curse_add_line(self.view_data['quit']))
ret.append(self.curse_new_line())
ret.append(self.curse_new_line())
ret.append(self.curse_add_line(self.view_data['edit_pattern_filter']))
# Return the message with decoration
return ret
|