Mercurial > code > home > repos > victoriametrics
comparison migration/tasks.py @ 63:84a4c4cca4a5
separate the migration tasks
author | drewp@bigasterisk.com |
---|---|
date | Thu, 02 May 2024 23:05:14 -0700 |
parents | tasks.py@8134cd480817 |
children | c5e98d891638 |
comparison
equal
deleted
inserted
replaced
62:8134cd480817 | 63:84a4c4cca4a5 |
---|---|
1 from pathlib import Path | |
2 | |
3 from invoke import task | |
4 | |
5 | |
6 metricsToMigrate = [ | |
7 'currently_on_wifi', | |
8 'connected', | |
9 'house_power_kwh', | |
10 'house_power_price', | |
11 'house_power_w', | |
12 'lan_bytes_sent_from_created', | |
13 'lan_bytes_sent_from_total', | |
14 'lan_last_seen_time', | |
15 'maildir_count', | |
16 'mongodb_mongod_db_coll_avgobjsize', | |
17 'mongodb_mongod_db_coll_count', | |
18 'mongodb_mongod_db_coll_index_size', | |
19 'mongodb_mongod_db_coll_indexes', | |
20 'mongodb_mongod_db_coll_indexes_size', | |
21 'mongodb_mongod_db_coll_size', | |
22 'mongodb_mongod_db_coll_storage_size', | |
23 'mongodb_mongod_db_collections_total', | |
24 'mongodb_mongod_db_data_size_bytes', | |
25 'mongodb_mongod_db_index_size_bytes', | |
26 'mongodb_mongod_db_indexes_total', | |
27 'mongodb_mongod_db_objects_total', | |
28 'probe_duration_seconds', | |
29 'smartctl_device', | |
30 'smartctl_device_attribute', | |
31 'smartctl_device_available_spare', | |
32 'smartctl_device_available_spare_threshold', | |
33 'smartctl_device_block_size', | |
34 'smartctl_device_bytes_read', | |
35 'smartctl_device_bytes_written', | |
36 'smartctl_device_capacity_blocks', | |
37 'smartctl_device_capacity_bytes', | |
38 'smartctl_device_critical_warning', | |
39 'smartctl_device_interface_speed', | |
40 'smartctl_device_media_errors', | |
41 'smartctl_device_num_err_log_entries', | |
42 'smartctl_device_percentage_used', | |
43 'smartctl_device_power_cycle_count', | |
44 'smartctl_device_power_on_seconds', | |
45 'smartctl_device_smart_status', | |
46 'smartctl_device_smartctl_exit_status', | |
47 'smartctl_device_status', | |
48 'smartctl_device_temperature', | |
49 'zfs_dataset_logical_used_bytes', | |
50 'zfs_dataset_referenced_bytes', | |
51 'zfs_dataset_used_by_dataset_bytes', | |
52 'zfs_dataset_used_bytes', | |
53 'zfs_dataset_written_bytes', | |
54 'zfs_exporter_build_info', | |
55 'zfs_pool_allocated_bytes', | |
56 'zfs_pool_deduplication_ratio', | |
57 'zfs_pool_fragmentation_ratio', | |
58 'zfs_pool_free_bytes', | |
59 'zfs_pool_freeing_bytes', | |
60 'zfs_pool_health', | |
61 'zfs_pool_leaked_bytes', | |
62 'zfs_pool_readonly', | |
63 'zfs_pool_size_bytes', | |
64 'zfs_scrape_collector_duration_seconds', | |
65 'zfs_scrape_collector_success', | |
66 'zigbee_availability', | |
67 'zigbee_battery', | |
68 'zigbee_brightness', | |
69 'zigbee_contact', | |
70 'zigbee_link_quality', | |
71 'zigbee_occupancy', | |
72 'zpool_device_error_count', | |
73 'zpool_device_state', | |
74 'zpool_error_count', | |
75 'zpool_state', | |
76 ] | |
77 | |
78 | |
79 @task | |
80 def exportForeverMetrics(ctx): | |
81 svc = ctx.run('khost victoriametrics').stdout | |
82 for m in metricsToMigrate: | |
83 ctx.run(f'curl http://{svc}/m/api/v1/export/native?match={m} | gzip -c > export/{m}.native.gz') | |
84 | |
85 | |
86 @task | |
87 def ingestForeverMetrics(ctx): | |
88 svc = ctx.run('khost next-victoriametrics-forever-vminsert').stdout | |
89 for p in Path('export').glob('*.native.gz'): | |
90 print(f'importing {p}') | |
91 ctx.run(f'zcat {p} | curl -s http://{svc}/m/next/forever/vminsert/insert/0/prometheus/api/v1/import/native --data-binary @-') |