HEX
Server: LiteSpeed
System: Linux ws4.angoweb.net 5.14.0-611.13.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 11 04:57:59 EST 2025 x86_64
User: tswangoe (2287)
PHP: 8.1.33
Disabled: show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open
Upload Files
File: //usr/local/lib/python3.9/site-packages/agent360/plugins/__pycache__/mongodb.cpython-39.pyc
a

q�dg��@sDddlZddlZddlmZGdd�dej�Zedkr@e���dS)�N)�MongoClientc@seZdZdZdd�ZdS)�Plugin�mongodbc
Cs�t|�dd��}|j}|�d�}|��}i}i}z4|dddurFdnd|d	<t|dd
�|d<WnYn0z�|dd
|d<|dd|d<|dd|d<|dd|d<|dd|d<|dd|d<|dd|d<|dd|d<|dd|d<WnYn0|dd |d!<|dd"|d#<|dd$|d%<|d&d'|d(<|d&d)|d*<|d&d+|d,<|d&d-|d.<|d&d/|d0<|d&d1|d2<|d3d4d5|d6<|d3d4d7|d8<|d3d9d5|d:<|d3d9d7|d;<|d3d<d5|d=<|d3d<d7|d><|d?d@dA|dB<|d?d@dC|dD<|d?d@dE|dF<|d?dGdA|dH<|d?dGdC|dI<|d?dGdE|dJ<|dKdL|dM<|dKdN|dO<|dKdP|dQ<|dKdR|dS<|dKdT|dU<zZ|dV��D]H\}}	|	��D]4\}
}|��D] \}}
|
|dW�|��|
|�<�q�q�q�WnYn0zd|dXd'|dY<|dXd)|dZ<|dXd+|d[<|dXd-|d\<|dXd/|d]<|dXd1|d^<Wnt	�y�Yn0|��D]\}}	|�
||	|�||<�q�z@|d6|d8|d_<|d=|d>|d`<|d:|d;|da<WnYn0|}t��|db<|�|�|dcdd|de<|dcdf|dg<|dcdh|di<|dcdjdu�r�dnd|dk<|S)lz$
        Mongodb monitoring
        rZconnection_stringZserverStatus�replZismasterFr�Z	isprimary�hosts�membersZtransactionsZretriedCommandsCountz!transactions-retriedCommandsCountZretriedStatementsCountz#transactions-retriedStatementsCountZ transactionsCollectionWriteCountz-transactions-transactionsCollectionWriteCountZtotalAbortedztransactions-totalAbortedZtotalCommittedztransactions-totalCommittedZtotalStartedztransactions-totalStartedZ
currentActiveztransactions-currentActiveZcurrentInactiveztransactions-currentInactiveZcurrentOpenztransactions-currentOpen�connectionsZtotalCreatedzconnections.totalCreated�	availablezconnections.available�currentzconnections.currentZ
opcounters�commandzopcounters.command�deletezopcounters.deleteZgetmorezopcounters.getmore�insertzopcounters.insert�queryzopcounters.query�updatezopcounters.updateZopLatencies�commandsZlatencyzopLatencies.commands.latency�opszopLatencies.commands.opsZreadszopLatencies.reads.latencyzopLatencies.reads.opsZwriteszopLatencies.writes.latencyzopLatencies.writes.opsZ
globalLockZcurrentQueue�totalzglobalLock.currentQueue.totalZreaderszglobalLock.currentQueue.readersZwriterszglobalLock.currentQueue.writersZ
activeClientszglobalLock.activeClients.totalz globalLock.activeClients.readersz globalLock.activeClients.writersZasserts�msgzasserts.msgZregularzasserts.regularZ	rolloverszasserts.rollovers�userzasserts.user�warningzasserts.warning�lockszlocks-{}-{}-{}ZopcountersReplzopcountersRepl.commandzopcountersRepl.deletezopcountersRepl.getmorezopcountersRepl.insertzopcountersRepl.queryzopcountersRepl.updatezopLatencies.commandszopLatencies.writeszopLatencies.reads�tsZmemZresidentzmem.resident�bitszmem.bitsZvirtualzmem.virtual�	supportedz
mem.supported)
r�getZadminrZget_agent_cache�len�items�format�lower�KeyErrorZabsolute_to_per_second�timeZset_agent_cache)�self�config�client�db�
statisticsZ
prev_cache�data�results�key�val�key2Zval2Zkey3Zval3Z
next_cache�r,�B/usr/local/lib/python3.9/site-packages/agent360/plugins/mongodb.py�run
s�
&
z
Plugin.runN)�__name__�
__module__�__qualname__r.r,r,r,r-rsr�__main__)r!ZpluginsZpymongorZ
BasePluginrr/�executer,r,r,r-�<module>s
k