PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` 3 peJ?@sHddlZddlZddlZddlmZmZejeZGdddejZ dS)N)javajavaxc'@seZdZdZdZdZdHdIdJdKdLdMdNdOdPdQdRdSdTdUdVdWdXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhd=!Zed>d?Ze d@dAZ e dBdCZ e dDdEZ e dFdGZ dS)iTomcatJMXPluginzCTomcat Plugin for the FortiMonitor Agent using JMX to collect data.Z tomcat_jmxz Tomcat (JMX)Heap Memory Usage Used java.langMemoryNHeapMemoryUsageusedbytesHeap Memory Usage Committed committedHeap Memory Usage InitinitHeap Memory Usage MaxmaxNon-Heap Memory Usage UsedNonHeapMemoryUsageNon-Heap Memory Usage CommittedNon-Heap Memory Usage InitNon-Heap Memory Usage Max Thread Count Threading ThreadCountcountOS Process CPU LoadOperatingSystemProcessCpuLoadpercentOS System CPU Load SystemCpuLoadOS Open File Descriptor CountOpenFileDescriptorCountLoaded Class Count ClassLoadingLoadedClassCount Eden Space MemoryPoolUsage PS Eden SpacePar Eden Space G1 Eden SpaceSurvivor SpacePS Survivor SpacePar Survivor SpaceG1 Survivor Space PS Old Gen CMS Old Gen G1 Old GenCopyGarbageCollectorCollectionCount PS ScavengeParNewG1 Young GenerationG1 Mixed GenerationMarkSweepCompact PS MarkSweepConcurrentMarkSweepG1 Old Generation)!z memory.heapzmemory.heap.committedzmemory.heap.initzmemory.heap.maxzmemory.non_heapzmemory.non_heap.committedzmemory.non_heap.initzmemory.non_heap.maxzthreading.countzos.cpu_load.processzos.cpu_load.systemzos.open_file_descriptorszclass_loading.loaded_classeszmemory_pool.edenzmemory_pool.eden.pszmemory_pool.eden.parzmemory_pool.eden.g1zmemory_pool.survivorzmemory_pool.survivor.pszmemory_pool.survivor.parzmemory_pool.survivor.g1zmemory_pool.old.pszmemory_pool.old.cmszmemory_pool.old.g1z gc.young.copyzgc.young.ps_scavengezgc.young.par_newzgc.young.g1_generationzgc.mixed.g1_generationzgc.old.mark_sweep_compactzgc.old.ps_mark_sweepzgc.old.concurrent_mark_sweepzgc.old.g1_generationcCsP|d|d|d}}}d|}|r4|d|7}|rD|d|7}tjj|S)areturns a constructed ObjectName. :type tuple_: tuple (label, domain, type, bean_name, attribute_name, composite_data_key, unit) :param tuple_: A tuple with all the information for an ObjectName. A string that represents the label, a string that represents the domain, and so on and so forth. :rtype: javax.management.ObjectName :return: An ObjectName object that can be used to lookup a MBean. z%s:zname=%s,ztype=%s)r management ObjectName)tuple_domaintype_Z bean_nameZcanonical_namerE'/usr/lib/fm-agent/plugins/tomcat_jmx.pyZ__get_object_name_from_tupleCs   z,TomcatJMXPlugin.__get_object_name_from_tuplec Csdddddg}i}x`|D]X}|j|}| rB|d krBtd|q| rT|d krTqqdd|jd D}|||<qWi}|d}xt|D]\} } d| i|| <xtdD]l}t|j|gd kr||| } n:t|j|gd kr||d } n|dkrtd|nq| || |<qWqW|S)a Parse the config object to build a structure of connections parameters based on the number of entries that are in each key. The main parameter we base on to split off is host. :type config: dict (host, port, username, password, jvm_path) :param config: Dictionary with the information stored in the config file. :rtype: Dict :return: Dictionary with connection information split up in multiple if needed. hostportusernamepasswordjvm_pathz"Missing %s information from configcSsg|]}|jdqS) )strip).0valuerErErF rsz?TomcatJMXPlugin.get_connections_from_config..,r=r)rIrJ)rIrJ)rHrIrJrK)rIrJ)get ValueErrorsplit enumeratelen) clsconfigkeysdatakey key_valuevalues connectionshostsindexrGrOrErErFget_connections_from_config[s0      z+TomcatJMXPlugin.get_connections_from_configc Cstj}d}|s$d}|jj|tj}d|ks4d|krPd|j}|jj|tj}|jd}|sy,tj}|stj}d|j}|jj|Wn(tj}d|j}|jj|YnXy"|tjkrtj rtj |Wn"tj}d}|jj|YnX|tjkrytj stj |t j j }|jd rt|jd rttjt jj|jd |jd g}|jtjjjj|d |jdt|jdf}tjjj|}tjjjj||} | j} || dfStk rd }|jj|YnX|d|fS) a returns a list of connections from the jpype library - a python interface to the Java Native Interface. Wheter there are 1 or many connections depends on the number of entries in the host, port and optionally username/password/jvm entries. :type config: dict :param config: Mapping of information under the application block for this plugin. :rtype: tuple (status, connection, error_message) :return: A tuple containing a numeric value corresponding to the agent_util status'. A MBeanServerConnection object. And, a string with an error message if any. NzNo JMX configuration foundrGrHzJMissing value in the [%s] block of the agent config file (e.g host, port).rKzYUnable to find JVM, please specify 'jvm_path' in the [%s] block of the agent config file.z;Unable to access JMX metrics because JVM cannot be started.rIrJz*service:jmx:rmi:///jndi/rmi://%s:%s/jmxrmizBUnable to access JMX metrics, JMX is not running or not installed.) agent_util SUPPORTEDloginfo MISCONFIGUREDtextkeyrRjpypegetDefaultJVMPath isJVMStartedstartJVMrutilHashMapJArraylangStringputrr@remote JMXConnector CREDENTIALSint JMXServiceURLJMXConnectorFactoryconnectgetMBeanServerConnection Exception exception) rWrXstatusmsgrKZj_hashZj_arrayurlZjmx_urlZjmx_soc connectionrErErFZ__get_connectionsl           z TomcatJMXPlugin.__get_connectionc Csi}|j|}i}g}xT|jD]H}|j|\}}} d|d|df} | r`|jd| | fq ||| <q W|js|jjdx|D]} |jj| qW|Stj }d} x|D]} |jj | qWx|j j D]\} } |j | }g}xZ|j D]N\} }y|j||j| Wqtk r:|jjd|| fwYqXqWt|jdkrn| rnd }tj}d | } n d} tj }| d | d }}|||| |d || <qW|S)areturns a json object who's textkeys correspond to a given metric available on the JVM. :type config: dict :param config: Mapping of information under the application block for this plugin. :return: JSON Object for all metrics z%s:%srGrHz%s %sz#Unable to connect to any connectionz.Tomcat (JMX) plugin - %s bean not found at %s.r=Nz Unreachable %s at any connectionr)labeloptionsr| error_messageunit)rar] _TomcatJMXPlugin__get_connectionappendrYrdreerrorrbrcwarning JMX_MAPPINGitems,_TomcatJMXPlugin__get_object_name_from_tuplegetObjectInstancerzr{rV UNSUPPORTED)rWrXresultconfigsr^errorsentryr|rr}Zconnection_keyrr[rB object_namerrrrErErF get_metadatasT          zTomcatJMXPlugin.get_metadatac Cs |j|}|rBx:|jD]$}d|d|df}||kr|}qWn|d}|j|\}}} | rr|jjd| dS|jj|} | d| d} } |j| } yR|j| }|j |j | }|j j }d |kr|j S|j| sdS|j| }|j S|jjd | dSdS) areturns a value for the metric. :type textkey: string :param textkey: Canonical name for a metric. :type data: string :param data: Specific option to check for. :type config: dict :param config: Mapping of information under the application block for this plugin. :rtype: double :return: Value for a specific metric z%s:%srGrHrzFailed to get a connection: %sNZCompositeDataSupportz(Tomcat (JMX) plugin - %s bean not found.)rar]rrdrerrRrr getAttributeZ getObjectName __class____name__ floatValueZ containsKey)rWrgrZrXentriesrZpossible_matchr|rr}rBZattribute_nameZcomposite_data_keyrZobject_instanceZattribute_valueZattribute_class_nameZ check_resultrErErFcheck.s<        zTomcatJMXPlugin.check)rrrNrr r )r rrNrr r )r rrNrrr )rrrNrrr )rrrNrr r )rrrNrr r )rrrNrrr )rrrNrrr )rrrNrNr)rrrNrNr)rrrNrNr)r rrNr!Nr)r"rr#Nr$Nr)r%rr&r%r'r r )r(rr&r(r'r r )r)rr&r)r'r r )r*rr&r*r'r r )r+rr&r+r'r r )r,rr&r,r'r r )r-rr&r-r'r r )r.rr&r.r'r r )r/rr&r/r'r r )r0rr&r0r'r r )r1rr&r1r'r r )r2rr3r2r4Nr)r5rr&r5r4Nr)r6rr3r6r4Nr)r7rr3r7r4Nr)r8rr3r8r4Nr)r9rr3r9r4Nr)r:rr3r:r4Nr)r;rr3r;r4Nr)r<rr3r<r4Nr)r __module__ __qualname____doc__rgrr staticmethodr classmethodrarrrrErErErFr sR  . ` Er) loggingrbrhrr getLoggerrloggerPluginrrErErErFs