]> arthur.barton.de Git - netdata.git/commitdiff
Merge branch 'objects'
authorpaulfantom <paulfantom@gmail.com>
Sat, 18 Jun 2016 18:01:46 +0000 (20:01 +0200)
committerpaulfantom <paulfantom@gmail.com>
Sat, 18 Jun 2016 18:01:46 +0000 (20:01 +0200)
1  2 
python.d/mysql.chart.py

index 2562cbf4ba158d27d18d237b7e08d43ec198b9ab,01216c83b534098db2d9cd89ca4258ec45e3ca0f..04ccd4c4637be4b0f530d46d78e3d995fad43488
@@@ -8,24 -13,35 +13,35 @@@ except ImportError
      try:
          import pymysql as MySQLdb
          # https://github.com/PyMySQL/PyMySQL
-         stderr.write(NAME + ": using pymysql")
+         sys.stderr.write(NAME + ": using pymysql\n")
      except ImportError:
-         stderr.write(NAME + ": You need to install PyMySQL module to use mysql.chart.py plugin\n")
+         sys.stderr.write(NAME + ": You need to install MySQLdb or PyMySQL module to use mysql.chart.py plugin\n")
+         raise ImportError
+ from base import BaseService
  
- config = [
-     {
-         'name'     : 'local',
+ # default configuration (overriden by python.d.plugin)
+ # FIXME change password
+ config = {
+     'local': {
          'user'     : 'root',
 -        'password' : 'a',
 +        'password' : '',
-         'socket'   : '/var/run/mysqld/mysqld.sock'
+         'socket'   : '/var/run/mysqld/mysqld.sock',
+         'update_every' : 3,
+         'retries'  : 4,
+         'priority' : 100
      }
- ]
+ }
  
+ # default module values (can be overridden per job in `config`)
  update_every = 3
  priority = 90000
+ retries = 7
  
- #query = "SHOW GLOBAL STATUS WHERE value REGEX '^[0-9]'"
+ # query executed on MySQL server
  QUERY = "SHOW GLOBAL STATUS"
+ # charts order (can be overriden if you want less charts, or different order)
  ORDER = ['net', 
           'queries', 
           'handlers', 
@@@ -440,7 -449,12 +449,5 @@@ class Service(BaseService)
                      pass
              if len(lines) > 0:
                  print(header + lines + "END")
-             
-     if len(config) == 0:
-         return False 
-     return True
+         
+         return True
 -
 -#FIXME debug only:
 -if __name__ == "__main__":
 -    my = Service(config['local'],'loc')
 -    my.check()
 -    my.create()
 -    my.update(1)