{"id":15788174,"url":"https://github.com/mevdschee/copy_influxdb_data","last_synced_at":"2025-03-31T18:23:39.290Z","repository":{"id":151764587,"uuid":"99225498","full_name":"mevdschee/copy_influxdb_data","owner":"mevdschee","description":"Bash script that will save an influxdb time range as a separate database","archived":false,"fork":false,"pushed_at":"2017-08-08T10:01:19.000Z","size":16,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-04T21:41:22.537Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mevdschee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-03T11:27:58.000Z","updated_at":"2022-09-01T19:16:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"a7f449c0-95f0-4961-9ab9-a232406ff459","html_url":"https://github.com/mevdschee/copy_influxdb_data","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mevdschee%2Fcopy_influxdb_data","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mevdschee%2Fcopy_influxdb_data/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mevdschee%2Fcopy_influxdb_data/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mevdschee%2Fcopy_influxdb_data/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mevdschee","download_url":"https://codeload.github.com/mevdschee/copy_influxdb_data/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246515841,"owners_count":20790125,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-04T21:41:17.820Z","updated_at":"2025-03-31T18:23:39.269Z","avatar_url":"https://github.com/mevdschee.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Copy InfluxDB data\n\nWhen an incident has happened, or a specific test has been run on an infrastructure and your system is monitored using Collectd/InfluxDB/Grafana, you may want to mark the time segment for further investigation (to avoid automatic removal due to retention rules). This script allows you to do this. \n\nIt creates a new database with an infinite rentention and copies in all metrics from a specific time range.\n\n    $ ./copy_influxdb_data.sh -h\n    Usage of ./copy_influxdb_data.sh:\n      --src-db 'database name'\n           Name of the database to copy, default: [first-db]\n      --src-rp 'rentention profile'\n           Rentention profile to copy, default: [first-rp]\n      --dst-db 'database name'\n           Database to copy into, default: [src-db][number]\n      --from 'relative time'\n           Relative time from when to copy, default: '-1h'\n      --until 'relative time until when to copy'\n           Relative time until when to copy, default: '0s'\n      --now 'current absolute time'\n           Execute as if it was run at this time, default: [now]\n      --influx 'arguments'\n           Arguments for the influx command line tool.\n           \nLet's say that you have a single database (named 'collectd') with a signle retention policy (named 'collectd') on an InfluxDB instance. If you started an interesting event 2 hours ago and finished just now and want to save that as \"test_run_1\" you do:\n\n    $ ./copy_influxdb_data.sh --dst-db test_run_1 --from -2h\n    \nIn Grafana you can now easily switch between the databases by changing the database of the (named) InfluxDB datasource.\n\n\t$ ./copy_influxdb_data.sh --dst-db test_run_1 --from -2h\n\tSource: collectd.collectd\n\tDestination: test_run_1.collectd\n\tFrom time: -2h\n\tUntil time: 0s\n\tProgress:\n\t  - contextswitch_value: 227 records\n\t  - cpu_value: 2728 records\n\t  - df_value: 5520 records\n\t  - disk_io_time: 221 records\n\t  - disk_read: 884 records\n\t  - disk_value: 148 records\n\t  - disk_weighted_io_time: 221 records\n\t  - disk_write: 884 records\n\t  - interface_rx: 908 records\n\t  - interface_tx: 908 records\n\t  - irq_value: 8393 records\n\t  - load_longterm: 227 records\n\t  - load_midterm: 227 records\n\t  - load_shortterm: 227 records\n\t  - memory_value: 1362 records\n\t  - mysql_value: 12461 records\n\t  - processes_value: 1621 records\n\t  - swap_value: 1130 records\n\t  - tcpconns_value: 2473 records\n\t  - uptime_value: 223 records\n\tDone!\n\nAs you see the copy has been succeeded.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmevdschee%2Fcopy_influxdb_data","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmevdschee%2Fcopy_influxdb_data","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmevdschee%2Fcopy_influxdb_data/lists"}