你好:
在eagle的/lib/scripts/hadoop_jmx_collector目录下执行python system_metric_collector.py
1:config.json内容如下
{
  "env": {
    "site": "sandbox",
    "cpu_stat_file": "/tmp/eagle_cpu_usage_state"
  },
  "filter": {
    "bean_group_filter": ["hadoop","java.lang","java.nio"],
    "metric_name_filter": [
      "system.*"
    ]
  },
  "output": {
    "kafka": {
      "debug": true,
      "default_topic": "system_metric_sandbox",
      "broker_list": [
        "master:6667"
      ]
    }
  }
}
2:报错内容如下:
08-24 14:59 root Thread-1 INFO Executing: collect_smartdisk_metric
08-24 14:59 root Thread-1 WARNING Failed to execute: collect_smartdisk_metric
08-24 14:59 root Thread-1 ERROR global name 'DATA_TYPE' is not defined
Traceback (most recent call last):
  File "system_metric_collector.py", line 52, in try_exec_func
    func()
  File "system_metric_collector.py", line 275, in collect_smartdisk_metric
    kafka_dict['metric'] = DATA_TYPE + "." + metric.lower()
NameError: global name 'DATA_TYPE' is not defined
08-24 14:59 root Thread-1 INFO Executing: collect_diskstat_metric
08-24 14:59 root Thread-1 INFO 1
08-24 14:59 root Thread-1 WARNING Failed to execute: collect_diskstat_metric
08-24 14:59 root Thread-1 ERROR list index out of range
Traceback (most recent call last):
  File "system_metric_collector.py", line 52, in try_exec_func
    func()
  File "system_metric_collector.py", line 304, in collect_diskstat_metric
    disk = disks[1]
IndexError: list index out of range
08-24 14:59 root Thread-1 INFO Execution result (total: 7, succeed: 5, failed: 2):
collect_uptime_metric         : success                      
collect_memory_metric         : success                      
collect_diskstat_metric       : error: <type 'exceptions.IndexError'>: list index out of range
collect_nic_metric            : success                      
collect_cpu_metric            : success                      
collect_loadavg_metric        : success                      
collect_smartdisk_metric      : error: <type 'exceptions.NameError'>: global name 'DATA_TYPE' is not defined
08-24 14:59 root MainThread INFO Closing kafka connection and producer
08-24 14:59 root MainThread INFO Totally sent 138 metric events in 2.31872415543 sec
08-24 14:59 root MainThread INFO MainProcess (PID: 18033) exit
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB