403Webshell
Server IP : 61.19.30.66  /  Your IP : 216.73.216.15
Web Server : Apache/2.2.22 (Ubuntu)
System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64
User : www-data ( 33)
PHP Version : 5.3.10-1ubuntu3.48
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : ON  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/python2.7/dist-packages/landscape/monitor/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python2.7/dist-packages/landscape/monitor/cephusage.pyc
ó
}9Rc@s¬ddlZddlZddlZddlZddlZddlmZmZddlm	Z	ddl
mZddlm
Z
ddlmZdefd„ƒYZdS(	iÿÿÿÿN(tinlineCallbackstreturnValue(tAccumulator(tCoverageMonitor(t
spawn_process(t
MonitorPlugint	CephUsagecBs­eZdZdZdZejddejƒZ	dde
j
d„Zd„Zd„Z
ed	„Zed
„Zed„ƒZd„Zd
„Zd„Zd„Zd„ZRS(sÒ
    Plugin that captures Ceph usage information. This only works if the client
    runs on one of the Ceph monitor nodes, and it noops otherwise.

    The plugin requires the 'ceph' command to be available, which is run with a
    config file in <data_path>/ceph-client/ceph.landscape-client.conf with the
    following config:

    [global]
    auth supported = cephx
    keyring = <keyring-file>
    mon host = <ip>:6789

    The configured keyring can be generated with:

    ceph-authtool <keyring-file> --create-keyring
        --name=client.landscape-client --add-key=<key>

    The landscape-client charm automatically provides the client configuration
    and key when deployed as subordinate of a ceph node.
    s
ceph-usages9.*pgmap.*data, (\d+) MB used, (\d+) MB / (\d+) MB avail.*tflagsii<cCs:||_||_g|_d|_||_d|_dS(N(t	_intervalt_monitor_intervalt_ceph_usage_pointstNonet
_ceph_ring_idt_create_timet_ceph_config(tselftintervaltmonitor_intervaltcreate_time((s?/usr/lib/python2.7/dist-packages/landscape/monitor/cephusage.pyt__init__.s					cCsêtt|ƒj|ƒtjj|jjjddƒ|_	t
|j|jƒ|_
t|jddd|jƒ|_|jjj|j|jƒ|jjj|j|jjƒ|jjjd|jjddƒ|jd	|jtƒdS(
Nsceph-clientsceph.landscape-client.confgš™™™™™é?sCeph usage snapshotRtstoptpriorityiÐs
ceph-usage(tsuperRtregistertostpathtjointregistrytconfigt	data_pathRRt_persistRt_accumulateRR
t_monitortreactort
call_everytrunR	tlogtcall_ontcall_on_acceptedtsend_messagetTrue(RR((s?/usr/lib/python2.7/dist-packages/landscape/monitor/cephusage.pyR7s	"cCs4|j}|j}g|_idd6|d6|d6S(Ns
ceph-usagettypesceph-usagessring-id(R
R(Rtceph_pointstring_id((s?/usr/lib/python2.7/dist-packages/landscape/monitor/cephusage.pytcreate_messageHs
			cCsF|jƒ}|drB|ddk	rB|jjj|d|ƒndS(Nsceph-usagessring-idturgent(R,RRtbrokerR'(RR-tmessage((s?/usr/lib/python2.7/dist-packages/landscape/monitor/cephusage.pyR'OscCs |jjjd|j|ƒdS(Ns
ceph-usage(RR.tcall_if_acceptedR'(RR-((s?/usr/lib/python2.7/dist-packages/landscape/monitor/cephusage.pytexchangeTsccsÍ|jjƒ|jdks2tjj|jƒr?tdƒn|jdkra|j	ƒV|_nt
|jƒƒ}|jƒV}d}|dk	rª|j
||dƒ}n|dk	rÉ|jj|ƒndS(Nsceph-usage-accumulator(R tpingRRRRtexistsRRt_get_ceph_ring_idtintR
t_get_ceph_usageRR
tappend(Rt
new_timestamptnew_ceph_usaget	step_data((s?/usr/lib/python2.7/dist-packages/landscape/monitor/cephusage.pyR#Xs
%

cs"‡fd†}ˆjƒj|ƒS(sm
        Grab the ceph usage data by parsing the output of the "ceph status"
        command output.
        csv|dkrdSˆjj|ƒ}|s=tjd|ƒdS|jƒ\}}}t|ƒt|ƒ}|t|ƒS(Ns%Could not parse command output: '%s'.(Rt
_usage_regexptmatchtloggingterrortgroupsR5tfloat(toutputtresulttusedt	availablettotaltfilled(R(s?/usr/lib/python2.7/dist-packages/landscape/monitor/cephusage.pytparsews(t_get_status_command_outputtaddCallback(RRG((Rs?/usr/lib/python2.7/dist-packages/landscape/monitor/cephusage.pyR6qscCs
|jdƒS(Ntstatus(t_run_ceph_command(R((s?/usr/lib/python2.7/dist-packages/landscape/monitor/cephusage.pyRHˆscCsd„}|jƒj|ƒS(s.Extract ceph ring id from ceph command output.cSsQ|dkrdSy!tj|ƒ}|dd}Wntjd|ƒdSX|S(Ntmonmaptfsids(Could not get ring_id from output: '%s'.(RtjsontloadsR=R>(RAt
quorum_statusR+((s?/usr/lib/python2.7/dist-packages/landscape/monitor/cephusage.pyRGŽs(t_get_quorum_command_outputRI(RRG((s?/usr/lib/python2.7/dist-packages/landscape/monitor/cephusage.pyR4‹s	
cCs
|jdƒS(NRP(RK(R((s?/usr/lib/python2.7/dist-packages/landscape/monitor/cephusage.pyRQscGsHd|jddg}|j|ƒtdd|ƒ}|jd„ƒ|S(s×
        Run the ceph command with the specified options using landscape ceph
        key.  The keyring is expected to contain a configuration stanza with a
        key for the "client.landscape-client" id.
        s--confs--idslandscape-clienttcephtargscSs#|\}}}|dkr|SdS(Ni(R(t.0toutterrtcode((s?/usr/lib/python2.7/dist-packages/landscape/monitor/cephusage.pyt<lambda>¬s(RtextendRRI(RRStparamstdeferred((s?/usr/lib/python2.7/dist-packages/landscape/monitor/cephusage.pyRK s

Ni(t__name__t
__module__t__doc__tpersist_nameRtrun_intervaltretcompiletSR;ttimeRRR,tFalseR'R1RR#R6RHR4RQRK(((s?/usr/lib/python2.7/dist-packages/landscape/monitor/cephusage.pyRs$						(RdRRNR=Rattwisted.internet.deferRRtlandscape.accumulateRtlandscape.lib.monitorRtlandscape.lib.twisted_utilRtlandscape.monitor.pluginRR(((s?/usr/lib/python2.7/dist-packages/landscape/monitor/cephusage.pyt<module>s

Youez - 2016 - github.com/yon3zu
LinuXploit