是否需要在 Camel 上进行任何预设置才能为 Camel 路由公开 MBean 以进行监控?

does any pre setup need to be done on Camel to expose MBeans for Camel Routes for Monitoring purposes?

我正在使用 Nagios Core 4.3.2 为我的 JBoss Fuse Karaf OSGI 容器建立警报通知监控。 Jboss Fuse 是 6.3 版本,捆绑了 camel 2.17。

我需要报告骆驼路线的计数。除了骆驼路线之外,我已经能够在 JBoss 监控的 Fuse 容器上获得很多信息。 ???

好像不知道骆驼路线的MBean?

我是否需要做任何特别的事情来在 JMX 下的 Jboss Fuse 容器中公开骆驼路线?

我已经能够在 Nagios 下对容器进行大量监控。列表如下。现在我只关心让服务正常工作。后来我想迁移到使用配置文件。谢谢!现在所有这些工作!我似乎无法到达骆驼路线 mbeans???只是想表明它不是nagios设置等...

define command{
        command_name    check_local_container_heap_memory_usage
        command_line    $USER1$/check_jmx4perl --user $ARG1$ --password $ARG2$ --url $ARG3$ --mbean $ARG4$ --attribute $ARG5$ --path $ARG6$ --base $ARG7$ $ARG8$
        }

define command{
        command_name    check_remote_container_heap_available
        command_line    $USER1$/check_jmx4perl $ARG1$
        }

define command{
        command_name    check_local_container_broker_health
        command_line    $USER1$/check_jmx4perl --user $ARG1$ --password $ARG2$ --url $ARG3$ --mbean $ARG4$ --attribute $ARG5$ $ARG6$ $ARG7$
        }

define command{
        command_name    check_remote_container_broker_health
        command_line    $USER1$/check_jmx4perl $ARG1$ $ARG2$
        }
define command{
        command_name    check_local_container_thread_count
        command_line    $USER1$/check_jmx4perl --user $ARG1$ --password $ARG2$ --url $ARG3$ --mbean $ARG4$ --attribute $ARG5$ $ARG6
        }

define command{
        command_name    check_remote_container_thread_count
        command_line    $USER1$/check_jmx4perl $ARG1$ $ARG2$ $ARG3$
        }

define command{
        command_name    check_local_container_peak_thread_count
        command_line    $USER1$/check_jmx4perl --user $ARG1$ --password $ARG2$ --url $ARG3$ --mbean $ARG4$ --attribute $ARG5$ $ARG6
        }

define command{
        command_name    check_remote_container_peak_thread_count
        command_line    $USER1$/check_jmx4perl $ARG1$ $ARG2$ $ARG3$
        }

define command{
        command_name    check_local_container_non_heap_used
        command_line    $USER1$/check_jmx4perl --user $ARG1$ --password $ARG2$ --url $ARG3$ --mbean $ARG4$ --attribute $ARG5$ --path $ARG6$ --base $ARG7$ $ARG8$ $ARG9$
        }

define command{
        command_name    check_remote_container_non_heap_used
        command_line    $USER1$/check_jmx4perl $ARG1$ $ARG2$ $ARG3$
        }

#container uptime
define command{
        command_name    check_remote_container_uptime
        command_line    $USER1$/check_jmx4perl $ARG1$ $ARG2$ $ARG3$
        }

define command{
        command_name    check_local_container_uptime
        command_line    $USER1$/check_jmx4perl --user $ARG1$ --password $ARG2$ --url $ARG3$ --mbean $ARG4$ --attribute $ARG5$ $ARG6
        }
#Open File Descriptors
define command{
        command_name    check_remote_container_open_file_descriptors
        command_line    $USER1$/check_jmx4perl $ARG1$ $ARG2$ $ARG3$
        }

define command{
        command_name    check_local_container_open_file_descriptors
        command_line    $USER1$/check_jmx4perl --user $ARG1$ --password $ARG2$ --url $ARG3$ --mbean $ARG4$ --attribute $ARG5$ $ARG6
        }

define command{
        command_name    check_remote_container_context_state
        command_line    $USER1$/check_jmx4perl $ARG1$ $ARG2$ $ARG3$
        }

define command{
        command_name    check_local_container_context_state
        command_line    $USER1$/check_jmx4perl --user $ARG1$ --password $ARG2$ --url $ARG3$ --mbean $ARG4$ --attribute $ARG5$ --path $ARG6$ $ARG7$ $ARG8$
        }




define service{
       use                             generic-service
       host_name                       alphprdfuse1i
       service_description             Container PassThru Heap
       check_command                   check_nrpe!check_passthru_container_heap
       }
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container IPRCMT1 Heap
        check_command                   check_nrpe!check_iprcmt1_container_heap
        }

define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container Delta MRO Heap
        check_command                   check_nrpe!check_deltamro_container_heap
        }

define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container Delta FADEC Heap
        check_command                   check_nrpe!check_deltafadec_container_heap
        }

define service{
       use                              generic-service
       host_name                        alphprdfuse1i
       service_description              Container PassThru Heap Available
       check_command                    check_nrpe!check_remote_container_heap_avail!-a '--user passthru --password B@dC0mpany --url http://localhost:9090/jolokia --mbean java.lang:type=Memory --attribute HeapMemoryUsage --path used --base java.lang:type=Memory/HeapMemoryUsage/max --critical :95'
       }

define service{
       use                              generic-service
       host_name                        alphprdfuse1i
       service_description              Container IPRCMT1 Heap Available
       check_command                    check_nrpe!check_remote_container_heap_avail!-a '--user iprcmtx --password G00gl3M3 --url http://localhost:9091/jolokia --mbean java.lang:type=Memory --attribute HeapMemoryUsage --path used --base java.lang:type=Memory/HeapMemoryUsage/max --critical :95'
       }

define service{
       use                              generic-service
       host_name                        alphprdfuse1i
       service_description              Container Delta MRO Heap Available
       check_command                    check_nrpe!check_remote_container_heap_avail!-a '--user deltamro --password F@c3B00k --url http://localhost:9092/jolokia --mbean java.lang:type=Memory --attribute HeapMemoryUsage --path used --base java.lang:type=Memory/HeapMemoryUsage/max --critical :95'
       }

define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container Delta FADEC Heap Available
        check_command                   check_nrpe!check_deltafadec_container_heap!-a '--user deltafadec --password B@dM0nk3y --url http://localhost:9093/jolokia --mbean java.lang:type=Memory --attribute HeapMemoryUsage --path used --base java.lang:type=Memory/HeapMemoryUsage/max --critical :95'
        }

define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container Delta FADEC Broker Health
        check_command                   check_nrpe!check_remote_container_broker_health!-a "--user deltafadec --password B@dM0nk3y --url http://localhost:9093/jolokia --mbean org.apache.activemq:type=Broker,brokerName=amq,service=Health --attribute CurrentStatus --string --critical" "Good"
        }

define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container Delta MRO Broker Health
        check_command                   check_nrpe!check_remote_container_broker_health!-a "--user deltamro --password F@c3B00k --url http://localhost:9092/jolokia --mbean org.apache.activemq:type=Broker,brokerName=amq,service=Health --attribute CurrentStatus --string --critical" "Good"
        }
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container IPRCMT1 Broker Health
        check_command                   check_nrpe!check_remote_container_broker_health!-a "--user iprcmtx --password G00gl3M3 --url http://localhost:9091/jolokia --mbean org.apache.activemq:type=Broker,brokerName=amq,service=Health --attribute CurrentStatus --string --critical" "Good"
        }
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container PassThru Broker Health
        check_command                   check_nrpe!check_remote_container_broker_health!-a "--user passthru --password B@dC0mpany --url http://localhost:9090/jolokia --mbean org.apache.activemq:type=Broker,brokerName=amq,service=Health --attribute CurrentStatus --string --critical" "Good"
        }

define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container PassThru Non-Heap-Memory
        check_command                   check_nrpe!check_remote_container_non_heap_used!-a '--user passthru --password B@dC0mpany --url http://localhost:9090/jolokia --mbean java.lang:type=Memory --attribute NonHeapMemoryUsage --path used --base java.lang:type=Memory/NonHeapMemoryUsage/committed --critical :95'
        }
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container IPRCMT1 Non-Heap-Memory
        check_command                   check_nrpe!check_remote_container_non_heap_used!-a '--user iprcmtx --password G00gl3M3 --url http://localhost:9091/jolokia --mbean java.lang:type=Memory --attribute NonHeapMemoryUsage --path used --base java.lang:type=Memory/NonHeapMemoryUsage/committed --critical :95'
        }
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container Delta MRO Non-Heap-Memory
        check_command                   check_nrpe!check_remote_container_non_heap_used!-a '--user deltamro --password F@c3B00k --url http://localhost:9091/jolokia --mbean java.lang:type=Memory --attribute NonHeapMemoryUsage --path used --base java.lang:type=Memory/NonHeapMemoryUsage/committed --critical :95'
        }
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container Delta FADEC Non-Heap-Memory
        check_command                   check_nrpe!check_remote_container_non_heap_used!-a '--user deltafadec --password B@dM0nk3y --url http://localhost:9091/jolokia --mbean java.lang:type=Memory --attribute NonHeapMemoryUsage --path used --base java.lang:type=Memory/NonHeapMemoryUsage/committed --critical :95'
}

# Thread Count
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container PassThru Thread Count
        check_command                   check_nrpe!check_remote_container_thread_count!-a '--user passthru --password B@dC0mpany --url http://localhost:9090/jolokia --mbean java.lang:type=Threading --attribute ThreadCount --critical 90:200'
        }
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container IPRCMT1 Thread Count
        check_command                   check_nrpe!check_remote_container_thread_count!-a '--user iprcmtx --password G00gl3M3 --url http://localhost:9091/jolokia --mbean java.lang:type=Threading --attribute ThreadCount --critical 90:200'
        }
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container Delta MRO Thread Count
        check_command                   check_nrpe!check_remote_container_thread_count!-a '--user deltamro --password F@c3B00k --url http://localhost:9091/jolokia --mbean java.lang:type=Threading --attribute ThreadCount --critical 90:200'
        }
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container Delta FADEC Thread Count
        check_command                   check_nrpe!check_remote_container_thread_count!-a '--user deltafadec --password B@dM0nk3y --url http://localhost:9091/jolokia --mbean java.lang:type=Threading --attribute ThreadCount  --critical 90:200'
}
#Peak Thread Count
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container PassThru Peak Thread Count
        check_command                   check_nrpe!check_remote_container_peak_thread_count!-a '--user passthru --password B@dC0mpany --url http://localhost:9090/jolokia --mbean java.lang:type=Threading --attribute PeakThreadCount --critical :250'
        }
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container IPRCMT1 Peak Thread Count
        check_command                   check_nrpe!check_remote_container_peak_thread_count!-a '--user iprcmtx --password G00gl3M3 --url http://localhost:9091/jolokia --mbean java.lang:type=Threading --attribute PeakThreadCount --critical :250'
        }
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container Delta MRO Peak Thread Count
        check_command                   check_nrpe!check_remote_container_peak_thread_count!-a '--user deltamro --password F@c3B00k --url http://localhost:9092/jolokia --mbean java.lang:type=Threading --attribute PeakThreadCount --critical :250'
        }
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container Delta FADEC Peak Thread Count
        check_command                   check_nrpe!check_remote_container_peak_thread_count!-a '--user deltafadec --password B@dM0nk3y --url http://localhost:9093/jolokia --mbean java.lang:type=Threading --attribute PeakThreadCount --critical :250'
        }
#Container Uptime
#./check_jmx4perl --user passthru --password B@dC0mpany --url http://localhost:9090/jolokia --mbean java.lang:type=Runtime --attribute Uptime
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container PassThru Uptime
        check_command                   check_nrpe!check_remote_container_uptime!-a '--user passthru --password B@dC0mpany --url http://localhost:9090/jolokia --mbean java.lang:type=Runtime --attribute Uptime'
        }
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container IPRCMT1 Uptime
        check_command                   check_nrpe!check_remote_container_uptime!-a '--user iprcmtx --password G00gl3M3 --url http://localhost:9091/jolokia --mbean java.lang:type=Runtime --attribute Uptime'
        }
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container Delta MRO Uptime
        check_command                   check_nrpe!check_remote_container_uptime!-a '--user deltamro --password F@c3B00k --url http://localhost:9092/jolokia --mbean java.lang:type=Runtime --attribute Uptime'
        }
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container Delta FADEC Uptime
        check_command                   check_nrpe!check_remote_container_uptime!-a '--user deltafadec --password B@dM0nk3y --url http://localhost:9093/jolokia --mbean java.lang:type=Runtime --attribute Uptime'
        }

#Open File Descriptors
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container PassThru File Descriptors
        check_command                   check_nrpe!check_remote_container_open_file_descriptors!-a '--user passthru --password B@dC0mpany --url http://localhost:9090/jolokia --mbean java.lang:type=OperatingSystem --attribute OpenFileDescriptorCount --warning 500 --critical 600'
        }
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container IPRCMT1 File Descriptors
        check_command                   check_nrpe!check_remote_container_open_file_descriptors!-a '--user iprcmtx --password G00gl3M3 --url http://localhost:9091/jolokia --mbean java.lang:type=OperatingSystem --attribute OpenFileDescriptorCount --warning 500 --critical 600'
        }
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container Delta MRO File Descriptors
        check_command                   check_nrpe!check_remote_container_open_file_descriptors!-a '--user deltamro --password F@c3B00k --url http://localhost:9092/jolokia --mbean java.lang:type=OperatingSystem --attribute OpenFileDescriptorCount --warning 500 --critical 600'
        }
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container Delta FADEC File Descriptors
        check_command                   check_nrpe!check_remote_container_open_file_descriptors!-a '--user deltafadec --password B@dM0nk3y --url http://localhost:9093/jolokia --mbean java.lang:type=OperatingSystem --attribute OpenFileDescriptorCount --warning 500 --critical 600'
        }

#Container Context State
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container PassThru Context State
        check_command                   check_nrpe!check_remote_container_context_state!-a '--user passthru --password B@dC0mpany --url http://localhost:9090/jolokia --mbean org.apache.karaf:type=admin,name="PassThru MultiTenant" --attribute Instances --path "PassThru MultiTenant"/State --critical' 'Started'
        }
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container IPRCMT1 Context State
        check_command                   check_nrpe!check_remote_container_context_state!-a '--user iprcmtx --password G00gl3M3 --url http://localhost:9091/jolokia --mbean org.apache.karaf:type=admin,name="Multi-Tenant I MEP Service" --attribute Instances --path "Multi-Tenant I MEP Service"/State --critical' 'Started'
        }
#/check_jmx4perl --user passthru --password B@dC0mpany --url http://localhost:9092/jolokia --mbean org.apache.karaf:type=admin,name="Delta Maintenance Repair and Overhaul - MRO MEP" --attribute Instances --path 'Delta Maintenance Repair and Overhaul - MRO MEP'/State --critical '!Started'

define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container Delta MRO Context State
        check_command                   check_nrpe!check_remote_container_context_state!-a '--user deltamro --password F@c3B00k --url http://localhost:9092/jolokia --mbean org.apache.karaf:type=admin,name="Delta Maintenance Repair and Overhaul - MRO MEP" --attribute Instances --path "Delta Maintenance Repair and Overhaul - MRO MEP"/State --critical' 'Started'
        }
define service{
        use                             generic-service
        host_name                       alphprdfuse1i
        service_description             Container Delta FADEC Context State
        check_command                   check_nrpe!check_remote_container_context_state!-a '--user deltafadec --password B@dM0nk3y --url http://localhost:9093/jolokia --mbean org.apache.karaf:type=admin,name="GE-IP Delta FADEC PROD ENV" --attribute Instances --path "GE-IP Delta FADEC PROD ENV"/State --critical' 'Started'



examples showing how it works and doesn't with the mbeans using jmx4perl for testing.

./jmx4perl http://localhost:9090/jolokia read java.lang:type=Runtime StartTime
1563297082466

./jmx4perl http://localhost:9090/jolokia read java.nio:name=direct,type=BufferPool Count
19

NOW attempting a camel route
./jmx4perl http://localhost:9090/jolokia read org.apache.camel:context=passthrumt1.core-com.ge.digital.passthru.coreCamelContext,type=context,name="com.ge.digital.passthru.coreCamelContext" ExchangesTotal
ERROR: javax.management.InstanceNotFoundException : org.apache.camel:context=passthrumt1.core-com.ge.digital.passthru.coreCamelContext,type=context,name=com.ge.digital.passthru.coreCamelContext

jmx 好像没有暴露骆驼路线?上面的例子应该 return 计数。

我只是偶然发现了一些东西,比任何东西都更相关的语法。看不懂,但是,这是一个突破,可以从中构建。在 MBean 周围放置单引号 ' 似乎可行。

./jmx4perl http://localhost:9090/jolokia read 'org.apache.camel:context=passthrumt1.core-com.ge.digital.passthru.coreCamelContext,type=context,name="com.ge.digital.passthru.coreCamelContext"'
    {
      AllowUseOriginalMessage => '[false]',
      ApplicationContextClassName => 'BundleDelegatingClassLoader(passthrumt1.core [309])',
      CamelId => 'com.ge.digital.passthru.coreCamelContext',
      CamelVersion => '2.17.0.redhat-630310',
      ClassResolver => 'org.apache.camel.core.osgi.OsgiClassResolver',
      DeltaProcessingTime => 0,
      ExchangesCompleted => 5836,
      ExchangesFailed => 0,
      ExchangesInflight => 0,
      ExchangesTotal => 5836,
      ExternalRedeliveries => 0,
      FailuresHandled => 0,
      FirstExchangeCompletedExchangeId => 'ID-alphprdfuse2i-45162-1563297115702-3-3',
      FirstExchangeCompletedTimestamp => '2019-07-16T13:12:00-04:00',
      FirstExchangeFailureExchangeId => undef,
      FirstExchangeFailureTimestamp => undef,
      InflightExchanges => 0,
      LastExchangeCompletedExchangeId => 'ID-alphprdfuse2i-45162-1563297115702-3-11672',
      LastExchangeCompletedTimestamp => '2019-07-17T13:30:30-04:00',
      LastExchangeFailureExchangeId => undef,
      LastExchangeFailureTimestamp => undef,
      LastProcessingTime => 0,
      Load01 => '',
      Load05 => '',
      Load15 => '',
      ManagementName => 'passthrumt1.core-com.ge.digital.passthru.coreCamelContext',
      ManagementStatisticsLevel => 'Default',
      MaxProcessingTime => 271,
      MeanProcessingTime => 0,
      MessageHistory => '[true]',
      MinProcessingTime => 0,
      PackageScanClassResolver => 'org.apache.camel.core.osgi.OsgiPackageScanClassResolver',
      Properties => {
        'http.proxyHost' => 'PITC-Zscaler-Americas-Cincinnati3PR.proxy.corporate.gtm.ge.com',
        'http.proxyPort' => '80'
      },
      Redeliveries => 0,
      ResetTimestamp => '2019-07-16T13:11:58-04:00',
      ShutdownNowOnTimeout => '[true]',
      StartTimestamp => '2019-07-16T13:11:58-04:00',
      StartedRoutes => 6,
      State => 'Started',
      StatisticsEnabled => '[true]',
      TimeUnit => 'SECONDS',
      Timeout => 300,
      TotalProcessingTime => 3744,
      TotalRoutes => 8,
      Tracing => '[true]',
      Uptime => '1 day',
      UptimeMillis => 87522386,
      UseBreadcrumb => '[true]',
      UseMDCLogging => '[false]'
    }

./jmx4perl http://localhost:9090/jolokia read 'org.apache.camel:context=passthrumt1.core-com.ge.digital.passthru.coreCamelContext,type=context,name="com.ge.digital.passthru.coreCamelContext"' ExchangesCompleted
5844

./check_jmx4perl --user passthru --password B@dC0mpany --url http://localhost:9090/jolokia --mbean 'org.apache.camel:context=passthrumt1.core-com.ge.digital.passthru.coreCamelContext,type=context,name="com.ge.digital.passthru.coreCamelContext"' --attribute ExchangesCompleted
OK - [org.apache.camel:context=passthrumt1.core-com.ge.digital.passthru.coreCamelContext,type=context,name="com.ge.digital.passthru.coreCamelContext",ExchangesCompleted] : Value 5852 in range | [org.apache.camel:context#passthrumt1.core-com.ge.digital.passthru.coreCamelContext,type#context,name#"com.ge.digital.passthru.coreCamelContext",ExchangesCompleted]=5852;;