晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
|
Server : Apache System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64 User : rainic ( 1014) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /usr/lib/python3.6/site-packages/sos/report/plugins/ |
Upload File : |
# Copyright (C) 2014 Michele Baldessari <michele at acksyn.org>
# This file is part of the sos project: https://github.com/sosreport/sos
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# version 2 of the GNU General Public License.
#
# See the LICENSE file in the source distribution for further information.
from socket import gethostname
from sos.report.plugins import Plugin, RedHatPlugin, DebianPlugin, PluginOpt
class Pcp(Plugin, RedHatPlugin, DebianPlugin):
short_desc = 'Performance Co-Pilot data'
plugin_name = 'pcp'
profiles = ('system', 'performance')
packages = ('pcp',)
pcp_conffile = '/etc/pcp.conf'
# size-limit of PCP logger and manager data collected by default (MB)
option_list = [
PluginOpt('pmmgrlogs', default=100,
desc='size limit in MB of pmmgr logs'),
PluginOpt('pmloggerfiles', default=12,
desc='number of pmlogger files to collect')
]
pcp_sysconf_dir = None
pcp_var_dir = None
pcp_log_dir = None
pcp_hostname = ''
def pcp_parse_conffile(self):
""" Parse PCP configuration """
try:
with open(self.pcp_conffile, "r", encoding='UTF-8') as pcpconf:
lines = pcpconf.readlines()
except IOError:
return False
env_vars = {}
for line in lines:
if line.startswith('#'):
continue
try:
(key, value) = line.strip().split('=')
env_vars[key] = value
except (ValueError, KeyError):
# not a line for a key, value pair. Ignore the line.
pass
try:
self.pcp_sysconf_dir = env_vars['PCP_SYSCONF_DIR']
self.pcp_var_dir = env_vars['PCP_VAR_DIR']
self.pcp_log_dir = env_vars['PCP_LOG_DIR']
except Exception: # pylint: disable=broad-except
# Fail if all three env variables are not found
return False
return True
def setup(self):
sizelimit = (None if self.get_option("all_logs")
else self.get_option("pmmgrlogs"))
countlimit = (None if self.get_option("all_logs")
else self.get_option("pmloggerfiles"))
if not self.pcp_parse_conffile():
self._log_warn(f"could not parse {self.pcp_conffile}")
return
# Add PCP_SYSCONF_DIR (/etc/pcp) and PCP_VAR_DIR (/var/lib/pcp/config)
# unconditionally. Obviously if someone messes up their /etc/pcp.conf
# in a ridiculous way (i.e. setting PCP_SYSCONF_DIR to '/') this will
# break badly.
var_conf_dir = self.path_join(self.pcp_var_dir, 'config')
self.add_copy_spec([
self.pcp_sysconf_dir,
self.pcp_conffile,
var_conf_dir
])
# We explicitly avoid /var/lib/pcp/config/{pmchart,pmlogconf,pmieconf,
# pmlogrewrite} as in 99% of the cases they are just copies from the
# rpms. It does not make up for a lot of size but it contains many
# files
self.add_forbidden_path([
self.path_join(var_conf_dir, 'pmchart'),
self.path_join(var_conf_dir, 'pmlogconf'),
self.path_join(var_conf_dir, 'pmieconf'),
self.path_join(var_conf_dir, 'pmlogrewrite')
])
# Take PCP_LOG_DIR/pmlogger/`hostname` + PCP_LOG_DIR/pmmgr/`hostname`
# The *default* directory structure for pmlogger is the following:
# Dir: PCP_LOG_DIR/pmlogger/HOST/ (we only collect the HOST data
# itself)
# - YYYYMMDD.HH.MM.{N,N.index,N.meta} N in [0,1,...]
# - Latest
# - pmlogger.{log,log.prior}
#
# Can be changed via configuration in PCP_SYSCONF_DIR/pmlogger/control
# As a default strategy, collect up to 100MB data from each dir.
# Can be overwritten either via pcp.pcplogsize option or all_logs.
self.pcp_hostname = gethostname()
# Make sure we only add the two dirs if hostname is set, otherwise
# we would collect everything
if self.pcp_hostname != '':
# collect pmmgr logs up to 'pmmgrlogs' size limit
path = self.path_join(self.pcp_log_dir, 'pmmgr',
self.pcp_hostname, '*')
self.add_copy_spec(path, sizelimit=sizelimit, tailit=False)
# collect newest pmlogger logs up to 'pmloggerfiles' count
files_collected = 0
path = self.path_join(self.pcp_log_dir, 'pmlogger',
self.pcp_hostname, '*')
pmlogger_ls = self.exec_cmd(f"ls -t1 {path}")
if pmlogger_ls['status'] == 0:
for line in pmlogger_ls['output'].splitlines():
self.add_copy_spec(line, sizelimit=0)
files_collected = files_collected + 1
if countlimit and files_collected == countlimit:
break
self.add_copy_spec([
# Collect PCP_LOG_DIR/pmcd and PCP_LOG_DIR/NOTICES
self.path_join(self.pcp_log_dir, 'pmcd'),
self.path_join(self.pcp_log_dir, 'NOTICES*'),
# Collect PCP_VAR_DIR/pmns
self.path_join(self.pcp_var_dir, 'pmns'),
# Also collect any other log and config files
# (as suggested by fche)
self.path_join(self.pcp_log_dir, '*/*.log*'),
self.path_join(self.pcp_log_dir, '*/*/*.log*'),
self.path_join(self.pcp_log_dir, '*/*/config*')
])
# Collect a summary for the current day
res = self.collect_cmd_output('pcp')
if res['status'] == 0:
for line in res['output'].splitlines():
if line.startswith(' pmlogger:'):
arc = line.split()[-1]
self.add_cmd_output(
f"pmstat -S 00:00 -T 23:59 -t 5m -x -a {arc}",
root_symlink="pmstat"
)
break
# vim: set et ts=4 sw=4 :