|
| 1 | +==================== |
| 2 | +Hello World Example |
| 3 | +==================== |
| 4 | + |
| 5 | +A minimal example to see sqlalchemy-collectd do something. |
| 6 | + |
| 7 | + |
| 8 | +Step One - Run collectd as a console app |
| 9 | +======================================== |
| 10 | + |
| 11 | +In one terminal window, run collectd as an interactive application with |
| 12 | +the -f flag:: |
| 13 | + |
| 14 | + # cd examples/helloworld |
| 15 | + # collectd -f -C collectdconsole.conf |
| 16 | + |
| 17 | +The ``collectdconsole.conf`` includes a relative path to the |
| 18 | +sqlalchemy-collectd checkout as the module path. |
| 19 | + |
| 20 | +Step Two - Run the demo program |
| 21 | +================================ |
| 22 | + |
| 23 | +This program uses a SQLite database for starters. It spins up |
| 24 | +five processes with 20 threads each:: |
| 25 | + |
| 26 | + # python run_queries.py |
| 27 | + |
| 28 | +Step Three - watch collectd console |
| 29 | +=================================== |
| 30 | + |
| 31 | +Output looks something like:: |
| 32 | + |
| 33 | + $ collectd -f -C collectdconsole.conf |
| 34 | + [2018-02-11 18:29:35] plugin_load: plugin "logfile" successfully loaded. |
| 35 | + [2018-02-11 18:29:35] [info] plugin_load: plugin "write_log" successfully loaded. |
| 36 | + [2018-02-11 18:29:35] [info] plugin_load: plugin "python" successfully loaded. |
| 37 | + [2018-02-11 18:29:35] [info] sqlalchemy_collectd plugin version 0.0.1 |
| 38 | + [2018-02-11 18:29:35] [info] Python version: 3.6.4 (default, Jan 23 2018, 22:28:37) |
| 39 | + [GCC 7.2.1 20170915 (Red Hat 7.2.1-2)] |
| 40 | + [2018-02-11 18:29:35] [info] Initialization complete, entering read-loop. |
| 41 | + [2018-02-11 18:29:45] [info] write_log values: |
| 42 | + [{"values":[0],"dstypes":["gauge"],"dsnames":["value"],"time":1518391784.793,"interval":10.000,"host":"photon2","plugin":"sqlalchemy","plugin_instance":"run_queries.py","type":"count","type_instance":"checkedin"}] |
| 43 | + [2018-02-11 18:29:45] [info] write_log values: |
| 44 | + [{"values":[0],"dstypes":["gauge"],"dsnames":["value"],"time":1518391784.793,"interval":10.000,"host":"photon2","plugin":"sqlalchemy","plugin_instance":"run_queries.py","type":"count","type_instance":"detached"}] |
| 45 | + [2018-02-11 18:29:45] [info] write_log values: |
| 46 | + [{"values":[6],"dstypes":["gauge"],"dsnames":["value"],"time":1518391784.793,"interval":10.000,"host":"photon2","plugin":"sqlalchemy","plugin_instance":"run_queries.py","type":"count","type_instance":"numprocs"}] |
| 47 | + [2018-02-11 18:29:45] [info] write_log values: |
| 48 | + [{"values":[6],"dstypes":["gauge"],"dsnames":["value"],"time":1518391784.793,"interval":10.000,"host":"photon2","plugin":"sqlalchemy","plugin_instance":"run_queries.py","type":"count","type_instance":"numpools"}] |
| 49 | + [2018-02-11 18:29:45] [info] write_log values: |
| 50 | + [{"values":[28],"dstypes":["gauge"],"dsnames":["value"],"time":1518391784.793,"interval":10.000,"host":"photon2","plugin":"sqlalchemy","plugin_instance":"host","type":"count","type_instance":"checkedout"}] |
0 commit comments