|
| 1 | +=================== |
| 2 | +sqlalchemy-collectd |
| 3 | +=================== |
| 4 | + |
| 5 | +Send statistics on SQLAlchemy connection and transaction use (and maybe other |
| 6 | +things in the future) to the `collectd <https://collectd.org/>`_ service. collectd is a widely |
| 7 | +used system statistics collection tool which is supported by virtually all |
| 8 | +graphing and monitoring tools. |
| 9 | + |
| 10 | + |
| 11 | +hostname/pid-12345/checkouts |
| 12 | + |
| 13 | +host / plugin / plugininstance type / typeinstance |
| 14 | + |
| 15 | +hostname/sqlalchemy-nova/checkouts-12345 derive value=value |
| 16 | +hostname/sqlalchemy-nova/transactions-12345 derive value=value |
| 17 | +hostname/sqlalchemy-nova/checkedout-12345 gauge |
| 18 | +hostname/sqlalchemy-nova/pooled-12345 gauge |
| 19 | +hostname/sqlalchemy-nova/connected-12345 gauge |
| 20 | + |
| 21 | + |
| 22 | +<Plugin "aggregation"> |
| 23 | + <Aggregation> |
| 24 | + # translate from: |
| 25 | + # |
| 26 | + # <host>/<plugin>-<program-name>/<type>-<process pid> |
| 27 | + # |
| 28 | + # hostname/sqlalchemy-nova/checkouts-12345 |
| 29 | + # hostname/sqlalchemy-nova/checkouts-5839 |
| 30 | + # hostname/sqlalchemy-nova/checkouts-9905 |
| 31 | + # hostname/sqlalchemy-neutron/checkouts-19385 |
| 32 | + # hostname/sqlalchemy-neutron/checkouts-6991 |
| 33 | + # |
| 34 | + # to: |
| 35 | + # |
| 36 | + # <host>/<plugin>-<program-name>/<type> |
| 37 | + # |
| 38 | + # hostname/sqlalchemy-nova/checkouts |
| 39 | + # hostname/sqlalchemy-neutron/checkouts |
| 40 | + |
| 41 | + Plugin "sqlalchemy" |
| 42 | + |
| 43 | + GroupBy "Host" |
| 44 | + GroupBy "PluginInstance" |
| 45 | + |
| 46 | + CalculateNum true |
| 47 | + CalculateSum true |
| 48 | + CalculateAverage true |
| 49 | + </Aggregation> |
| 50 | + |
| 51 | + <Aggregation> |
| 52 | + # translate from: |
| 53 | + # |
| 54 | + # <host>/<plugin>-<program-name>/<type>-<process pid> |
| 55 | + # |
| 56 | + # hostname/sqlalchemy-nova/checkouts-12345 |
| 57 | + # hostname/sqlalchemy-nova/checkouts-5839 |
| 58 | + # hostname/sqlalchemy-nova/checkouts-9905 |
| 59 | + # hostname/sqlalchemy-neutron/checkouts-19385 |
| 60 | + # hostname/sqlalchemy-neutron/checkouts-6991 |
| 61 | + # |
| 62 | + # to: |
| 63 | + # |
| 64 | + # <host>/<plugin>-all/<type> |
| 65 | + # |
| 66 | + # hostname/sqlalchemy-all/checkouts |
| 67 | + |
| 68 | + Plugin "sqlalchemy" |
| 69 | + |
| 70 | + GroupBy "Host" |
| 71 | + SetPluginInstance "all" |
| 72 | + |
| 73 | + CalculateSum true |
| 74 | + CalculateAverage true |
| 75 | + </Aggregation> |
| 76 | + |
| 77 | + |
| 78 | +</Plugin> |
| 79 | + |
| 80 | +# send all SQLAlchemy messages to the aggregation plugin, |
| 81 | +# and don't send them anywhere else, thereby filtering out the |
| 82 | +# per-PID messages. |
| 83 | +LoadPlugin "match_regex" |
| 84 | +<Chain "PostCache"> |
| 85 | + <Rule> |
| 86 | + <Match regex> |
| 87 | + Plugin "^sqlalchemy$" |
| 88 | + </Match> |
| 89 | + <Target write> |
| 90 | + Plugin "aggregation" |
| 91 | + </Target> |
| 92 | + Target stop |
| 93 | + </Rule> |
| 94 | +</Chain> |
| 95 | + |
| 96 | + |
| 97 | +[{"values":[1069067],"dstypes":["derive"],"dsnames":["value"],"time":1517512597.320,"interval":10.000,"host":"photon2","plugin":"cpu","plugin_instance":"2","type":"cpu","type_instance":"idle"}] |
| 98 | + |
| 99 | + |
| 100 | +[{"values":[0.31,0.34,0.28],"dstypes":["gauge","gauge","gauge"],"dsnames":["shortterm","midterm","longterm"],"time":1517512718.495,"interval":10.000,"host":"photon2","plugin":"load","plugin_instance":"","type":"load","type_instance":""}] |
| 101 | + |
| 102 | + |
| 103 | +hostname/pid-12345/checkins |
| 104 | +hostname/pid-12345/checkouts |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | +{ |
| 109 | + "host": "foobar.host", |
| 110 | + "plugin": "sqlalchemy", |
| 111 | + "plugin_instance": "<pid>", |
| 112 | + "type": "progname", |
| 113 | + "type_instance": "nova", |
| 114 | + "current_connections": 108, (gauge) |
| 115 | + "current_checkouts": 25, (gauge) |
| 116 | + "checkouts": 38975, (counter) |
| 117 | + "checkins": 38972, (counter) |
| 118 | + "transactions": 38932 (counter) |
| 119 | +} |
| 120 | + |
| 121 | + |
| 122 | + |
| 123 | + [{"values":[0,0],"dstypes":["derive","derive"],"dsnames":["rx","tx"],"time":1517372403.790,"interval":10.000,"host":"photon2","plugin":"interface","plugin_instance":"virbr2","type":"if_errors","type_instance":""}] |
| 124 | +Jan 30 23:20:03 photon2 collectd[26416]: write_log values: |
| 125 | + [{"values":[0,0],"dstypes":["derive","derive"],"dsnames":["rx","tx"],"time":1517372403.790,"interval":10.000,"host":"photon2","plugin":"interface","plugin_instance":"virbr3-nic","type":"if_packets","type_instance":""}] |
| 126 | +Jan 30 23:20:03 photon2 collectd[26416]: write_log values: |
| 127 | + [{"values":[0,0],"dstypes":["derive","derive"],"dsnames":["rx","tx"],"time":1517372403.790,"interval":10.000,"host":"photon2","plugin":"interface","plugin_instance":"virbr2","type":"if_dropped","type_instance":""}] |
| 128 | +Jan 30 23:20:03 photon2 collectd[26416]: write_log values: |
| 129 | + [{"values":[0,0],"dstypes":["derive","derive"],"dsnames":["rx","tx"],"time":1517372403.790,"interval":10.000,"host":"photon2","plugin":"interface","plugin_instance":"virbr3-nic","type":"if_octets","type_instance":""}] |
| 130 | + |
| 131 | + |
| 132 | + |
0 commit comments