ganglia / gmond_python_modules

Repository of user-contributed Gmond Python DSO metric modules
http://sourceforge.net/apps/trac/ganglia/wiki/ganglia_gmond_python_modules
389 stars 354 forks source link

Mysqld module errors #163

Open cyberflow opened 10 years ago

cyberflow commented 10 years ago

If i try add module to ganglia i get error in logs:

/usr/sbin/gmond[3861]: [PYTHON] Can't call the metric_init function in the python module [mysql].#012

if i try run module form console:

# python /usr/lib/ganglia/python_modules/mysql.py -u root -p password --no-master --no-slave
Traceback (most recent call last):
  File "/usr/lib/ganglia/python_modules/mysql.py", line 1160, in <module>
    'unix_socket': options.unix_socket,
  File "/usr/lib/ganglia/python_modules/mysql.py", line 1095, in metric_init
    update_stats(REPORT_INNODB, REPORT_MASTER, REPORT_SLAVE)
  File "/usr/lib/ganglia/python_modules/mysql.py", line 266, in update_stats
    mysql_stats[key] = int(global_status[key]) - int(mysql_stats_last[key])
ValueError: invalid literal for int() with base 10: ''
chuckpu commented 10 years ago

I got this error too. Did U solved it

alpha01 commented 10 years ago

Have you guys tried renaming the module to ensure it's not conflicting with Python's own mysql module?

chuckpu commented 10 years ago

I have tried to rename it to mysql_test but got the error either [root@localhost python_modules]# /usr/local/ganglia/sbin/gmond -d10 loaded module: core_metrics loaded module: cpu_module loaded module: disk_module loaded module: load_module loaded module: mem_module loaded module: net_module loaded module: proc_module loaded module: sys_module loaded module: python_module [PYTHON] Can't call the metric_init function in the python module [mysql_test].

Traceback (most recent call last): File "/usr/local/lib64/ganglia/python_modules/mysql_test.py", line 1095, in metric_init update_stats(REPORT_INNODB, REPORT_MASTER, REPORT_SLAVE) File "/usr/local/lib64/ganglia/python_modules/mysql_test.py", line 264, in update_stats mysql_stats[key] = (int(global_status[key]) - int(mysql_stats_last[key])) / time_delta ValueError: invalid literal for int() with base 10: '' udp_recv_channel mcast_join=NULL mcast_if=NULL port=8649 bind=NULL buffer=0 socket created, SO_RCVBUF = 124928

tcp_accept_channel bind=NULL port=8649 gzip_output=0 Unable to create tcp_accept_channel. Exiting.

chuckpu commented 10 years ago
if global_status[key]=='':
   a = '0'
else:
   a = global_status[key]
if mysql_stats_last[key] == '':
   b = '0'
else:
  b = mysql_stats_last[key]
  mysql_stats[key] = (int(a) - int(b)) / time_delta

I changed mysql.py to this , it works well

vvuksan commented 9 years ago

@chuckpu can you submit a pull request ?

Thanks