Helper tools

Helper Tools

GMT comes with many small stand-alone scripts that can help when a measurement shall be aborted, some data shall be regenerated etc.

This page provides an overview:

1. Abort a measurement

If you want to abort a measurement but did start GMT as a disowned process or in cron mode, then you can use the tools/kill_gmt.sh script.

It will effectively kill all know processes of GMT that are active when a measurement is executed like:

  • Metric Providers
  • stand-alone tools like tcpdump or tinyproxy
  • docker containers
  • Python interpreters
  • etc.

=> Please note that it might be needed to run the script two times in a row as processes might respawn.

2. Generate phase stats

Under tools/phase_stats.py the stats for a particular run can be generated by supplying the UUID.

This is useful if the phase stats creation was skipped in case of an error or configuration.

Please note that if phase data already exists it will create duplicate data! You need to clear it first.

=> Please note that you must clear the Redis cache in order to see the new data also in the dashboard and API. Otherwise you will be served cached content

3. Re-build phase stats

In case some update in your database happended or the GMT itself updated and demands a re-build of the phases stats due to some calculation method change you can use the tools/rebuild_phase_stats.py.

It will delete all known phase stats and completely rebuild them.

=> Please note that you must clear the Redis cache in order to see the new data also in the dashboard and API. Otherwise you will be served cached content

4. Clear Redis Cache

If you change data in the database or update the GMT it might be needed to clear the Redis cache.

There is no script for it as the flow is quite easy:

docker exec -it green-coding-redis-container redis-cli
# Then in the redis-cli type: 
FLUSHALL

5. Import data

When you have data from a backup or you want to import measurements or general data from a CSV file we have you covered.

Just use the:

  • tools/import_backup.sh - Clears database and imports SQL files from ./backup folder
  • tools/import_data.py - Imports arbitrary SQL data without clearing the database
  • tools/import_measurements.py - Imports a log file from a metrics provider as metric data