• zabbix监控模板编写


    tomcat和resin为例:   

    1.下载插件cmdline-jmxclient-0.10.3.jar

    2.tomcat 监控项目查看(即获取java各项参数名称)(3,4步骤是如果获取参数名称数值,以及对应zabbix的key值表达式)
    root@zabbix-0-2:~# java -jar cmdline-jmxclient-0.10.3.jar - localhost:12345|sort

    Catalina:class=org.apache.catalina.UserDatabase,name="UserDatabase",resourcetype=Global,type=Resource
    Catalina:context=/docs,host=localhost,name=StandardContextValve,type=Valve
    Catalina:context=/docs,host=localhost,type=Cache
    Catalina:context=/docs,host=localhost,type=Loader
    Catalina:context=/docs,host=localhost,type=Manager
    Catalina:context=/docs,host=localhost,type=NamingResources
    Catalina:context=/docs,host=localhost,type=WebappClassLoader
    Catalina:context=/examples,host=localhost,name=foo/bar/name2,resourcetype=Context,type=Environment
    Catalina:context=/examples,host=localhost,name=foo/name1,resourcetype=Context,type=Environment
    Catalina:context=/examples,host=localhost,name=foo/name4,resourcetype=Context,type=Environment
    Catalina:context=/examples,host=localhost,name=FormAuthenticator,type=Valve
    Catalina:context=/examples,host=localhost,name=minExemptions,resourcetype=Context,type=Environment
    Catalina:context=/examples,host=localhost,name=name3,resourcetype=Context,type=Environment
    Catalina:context=/examples,host=localhost,name=StandardContextValve,type=Valve
    Catalina:context=/examples,host=localhost,type=Cache
    Catalina:context=/examples,host=localhost,type=Loader
    Catalina:context=/examples,host=localhost,type=Manager
    Catalina:context=/examples,host=localhost,type=NamingResources
    Catalina:context=/examples,host=localhost,type=WebappClassLoader
    Catalina:context=/,host=localhost,name=StandardContextValve,type=Valve
    Catalina:context=/,host=localhost,type=Cache
    Catalina:context=/,host=localhost,type=Loader
    Catalina:context=/,host=localhost,type=Manager
    Catalina:context=/,host=localhost,type=NamingResources
    Catalina:context=/,host=localhost,type=WebappClassLoader
    Catalina:context=/host-manager,host=localhost,name=BasicAuthenticator,type=Valve
    Catalina:context=/host-manager,host=localhost,name=StandardContextValve,type=Valve
    Catalina:context=/host-manager,host=localhost,type=Cache
    Catalina:context=/host-manager,host=localhost,type=Loader
    Catalina:context=/host-manager,host=localhost,type=Manager
    Catalina:context=/host-manager,host=localhost,type=NamingResources
    Catalina:context=/host-manager,host=localhost,type=WebappClassLoader
    Catalina:context=/manager,host=localhost,name=BasicAuthenticator,type=Valve
    Catalina:context=/manager,host=localhost,name=StandardContextValve,type=Valve
    Catalina:context=/manager,host=localhost,type=Cache
    Catalina:context=/manager,host=localhost,type=Loader
    Catalina:context=/manager,host=localhost,type=Manager
    Catalina:context=/manager,host=localhost,type=NamingResources
    Catalina:context=/manager,host=localhost,type=WebappClassLoader
    Catalina:host=localhost,name=AccessLogValve,type=Valve
    Catalina:host=localhost,name=ErrorReportValve,type=Valve
    Catalina:host=localhost,name=StandardHostValve,type=Valve
    Catalina:host=localhost,type=Deployer
    Catalina:host=localhost,type=Host
    Catalina:J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=//localhost/
    Catalina:J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=//localhost/docs
    Catalina:J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=//localhost/examples
    Catalina:J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=//localhost/host-manager
    Catalina:J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=//localhost/manager
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/docs,j2eeType=Filter,name=TomcatWebSocket (JSR356) Filter
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/docs,j2eeType=Servlet,name=default
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/docs,j2eeType=Servlet,name=jsp
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/docs,name=jsp,type=JspMonitor
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Filter,name=CompressionFilter
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Filter,name=RequestDumper Filter
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Filter,name=SetCharacter Encoding
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Filter,name=Timingfilter
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Filter,name=TomcatWebSocket (JSR356) Filter
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Servlet,name=async0
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Servlet,name=async1
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Servlet,name=async2
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Servlet,name=async3
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Servlet,name=ChatServlet
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Servlet,name=CompressionFilterTestServlet
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Servlet,name=CookieExample
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Servlet,name=default
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Servlet,name=HelloWorldExample
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Servlet,name=jsp
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Servlet,name=RequestHeaderExample
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Servlet,name=RequestInfoExample
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Servlet,name=RequestParamExample
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Servlet,name=ServletToJsp
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Servlet,name=SessionExample
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Servlet,name=stock
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Servlet,name=wsChat
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Servlet,name=wsEchoMessage
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Servlet,name=wsEchoStream
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,j2eeType=Servlet,name=wsSnake
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/examples,name=jsp,type=JspMonitor
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/host-manager,j2eeType=Filter,name=CSRF
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/host-manager,j2eeType=Filter,name=SetCharacterEncoding
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/host-manager,j2eeType=Filter,name=TomcatWebSocket (JSR356) Filter
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/host-manager,j2eeType=Servlet,name=default
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/host-manager,j2eeType=Servlet,name=HostManager
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/host-manager,j2eeType=Servlet,name=HTMLHostManager
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/host-manager,j2eeType=Servlet,name=jsp
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/host-manager,name=jsp,type=JspMonitor
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/,j2eeType=Filter,name=TomcatWebSocket (JSR356) Filter
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/,j2eeType=Servlet,name=default
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/,j2eeType=Servlet,name=jsp
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/manager,j2eeType=Filter,name=CSRF
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/manager,j2eeType=Filter,name=SetCharacterEncoding
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/manager,j2eeType=Filter,name=TomcatWebSocket (JSR356) Filter
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/manager,j2eeType=Servlet,name=default
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/manager,j2eeType=Servlet,name=HTMLManager
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/manager,j2eeType=Servlet,name=JMXProxy
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/manager,j2eeType=Servlet,name=jsp
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/manager,j2eeType=Servlet,name=Manager
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/manager,j2eeType=Servlet,name=Status
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/manager,name=jsp,type=JspMonitor
    Catalina:J2EEApplication=none,J2EEServer=none,WebModule=//localhost/,name=jsp,type=JspMonitor
    Catalina:name="ajp-bio-8009",type=GlobalRequestProcessor
    Catalina:name="ajp-bio-8009",type=ThreadPool
    Catalina:name=common,type=ServerClassLoader
    Catalina:name="http-bio-8080",type=GlobalRequestProcessor
    Catalina:name="http-bio-8080",type=ThreadPool
    Catalina:name=StandardEngineValve,type=Valve
    Catalina:port=8009,type=Connector
    Catalina:port=8009,type=Mapper
    Catalina:port=8009,type=ProtocolHandler
    Catalina:port=8080,type=Connector
    Catalina:port=8080,type=Mapper
    Catalina:port=8080,type=ProtocolHandler
    Catalina:realmPath=/realm0/realm0,type=Realm
    Catalina:realmPath=/realm0,type=Realm
    Catalina:type=Engine
    Catalina:type=MBeanFactory
    Catalina:type=NamingResources
    Catalina:type=Server
    Catalina:type=Service
    Catalina:type=StringCache
    com.sun.management:type=HotSpotDiagnostic
    java.lang:name=CodeCacheManager,type=MemoryManager
    java.lang:name=CodeCache,type=MemoryPool
    java.lang:name=PSEden Space,type=MemoryPool
    java.lang:name=PSMarkSweep,type=GarbageCollector
    java.lang:name=PSOld Gen,type=MemoryPool
    java.lang:name=PSPerm Gen,type=MemoryPool
    java.lang:name=PSScavenge,type=GarbageCollector
    java.lang:name=PSSurvivor Space,type=MemoryPool
    java.lang:type=ClassLoading
    java.lang:type=Compilation
    java.lang:type=Memory
    java.lang:type=OperatingSystem
    java.lang:type=Runtime
    java.lang:type=Threading
    java.nio:name=direct,type=BufferPool
    java.nio:name=mapped,type=BufferPool
    java.util.logging:type=Logging
    JMImplementation:type=MBeanServerDelegate
    Users:database=UserDatabase,type=UserDatabase
    3.如何获取数据()
    root@zabbix-0-2:~# java -jar cmdline-jmxclient-0.10.3.jar - localhost:12345 java.lang:type=ClassLoading LoadedClassCount
    01/29/2015 13:52:29 -0500org.archive.jmx.Client LoadedClassCount: 2411
    4.对应zabbixkey的表达式
    jmx["java.lang:type=ClassLoading",LoadedClassCount]

    .resin jmx 开启方式      
    1.Resin 的resin.xml文件里面设置(( disable passwordchecking and SSL))
    < cluster id="">
    <server-default>
       <jvm-arg>-Xmx512m</jvm-arg>
       <jvm-arg>-Xss1m</jvm-arg>
       <jvm-arg>-Dcom.sun.management.jmxremote</jvm-arg>
       <jvm-arg>-Dcom.sun.management.jmxremote.port=12345</jvm-arg>
       <jvm-arg>-Dcom.sun.management.jmxremote.ssl=false</jvm-arg>   <jvm-arg>-Dcom.sun.management.jmxremote.authenticate=false</jvm-arg>
    </server-default>
    <server id="app-a" address="172.20.0.2"/>
    < /cluster>

    spacer.jpg (43 Bytes, 下载次数: 0)

    下载附件  保存到相册 

    2015-1-30 09:44 上传


    2.resin监控项目查看(3,4步骤是如果获取参数名称数值,以及对应zabbix的key值表达式)
    root@zabbix-0-2:~# java -jarcmdline-jmxclient-0.10.3.jar - localhost:12345|sort

    com.sun.management:type=HotSpotDiagnostic
    java.lang:name=CodeCacheManager,type=MemoryManager
    java.lang:name=Code Cache,type=MemoryPool
    java.lang:name=PS Eden Space,type=MemoryPool
    java.lang:name=PS MarkSweep,type=GarbageCollector
    java.lang:name=PS Old Gen,type=MemoryPool
    java.lang:name=PS Perm Gen,type=MemoryPool
    java.lang:name=PS Scavenge,type=GarbageCollector
    java.lang:name=PS Survivor Space,type=MemoryPool
    java.lang:type=ClassLoading
    java.lang:type=Compilation
    java.lang:type=Memory
    java.lang:type=OperatingSystem
    java.lang:type=Runtime
    java.lang:type=Threading
    java.nio:name=direct,type=BufferPool
    java.nio:name=mapped,type=BufferPool
    java.util.logging:type=Logging
    JMImplementation:type=MBeanServerDelegate
    resin:name=app-0,type=ClusterServer
    resin:name=app-a,type=ClusterServer
    resin:name=app,type=Cluster
    resin:name="classpath:/META-INF/caucho/app-default.xml",type=Config
    resin:name="file:/usr/local/resin/conf/cluster-default.xml",type=Config
    resin:name="file:/usr/local/resin/conf/health.xml",type=Config
    resin:name="file:/usr/local/resin/conf/resin.xml",type=Config
    resin:name=memcached,type=Cluster
    resin:name=proxycache,type=Cluster
    resin:name="resin:system|resin",type=Cache
    resin:name="",type=Cluster
    resin:name=web,type=Cluster
    resin:type=BamService
    resin:type=BlockManager
    resin:type=CacheStore
    resin:type=Environment
    resin:type=LocalRepository
    resin:type=Management
    resin:type=Memory
    resin:type=Resin
    resin:type=Server
    resin:type=ThreadPool
    resin:type=TransactionManager
    3.如何获取数据
    root@zabbix-0-2:~# java -jarcmdline-jmxclient-0.10.3.jar - localhost:12345 java.lang:type=ClassLoadingLoadedClassCount
    01/29/2015 13:44:00 -0500org.archive.jmx.Client LoadedClassCount: 3324
    4.对应zabbixkey的表达式
    jmx["java.lang:type=ClassLoading",LoadedClassCount]

  • 相关阅读:
    Ios插件开发
    React-Native学习指南
    APP测试基本流程
    iOS开发-由浅至深学习block
    你真的会用UITableView嘛
    iOS系统右滑返回全局控制方案
    优化UITableViewCell高度计算的那些事
    UITableViewCell高度自适应探索--AutoLayout结合Frame
    UITableView优化技巧
    页面间跳转的性能优化(一)
  • 原文地址:https://www.cnblogs.com/tangliyao/p/7383217.html
Copyright © 2020-2023  润新知