-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-data-collector.sh
More file actions
executable file
·45 lines (36 loc) · 1.52 KB
/
docker-data-collector.sh
File metadata and controls
executable file
·45 lines (36 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
# This script is designed to be run on the OpenStack server to collect data
# and transfer it to the Docker container
# Source OpenStack credentials
source ~/admin-openrc
# Set the Docker container's data directory
CONTAINER_DATA_DIR="/app/data"
CONTAINER_NAME="openstack-resource"
# Check if the container is running
if ! docker ps | grep -q "$CONTAINER_NAME"; then
echo "Error: Container $CONTAINER_NAME is not running"
exit 1
fi
# Run the original data collection script
echo "Collecting OpenStack resource data..."
./get-data-aio.sh
# Copy the data files to the Docker container
echo "Copying data files to Docker container..."
docker cp data/aio.csv $CONTAINER_NAME:$CONTAINER_DATA_DIR/
docker cp data/allocation.txt $CONTAINER_NAME:$CONTAINER_DATA_DIR/
docker cp data/flavors.csv $CONTAINER_NAME:$CONTAINER_DATA_DIR/
docker cp data/ratio.txt $CONTAINER_NAME:$CONTAINER_DATA_DIR/
docker cp data/cephdf.txt $CONTAINER_NAME:$CONTAINER_DATA_DIR/
docker cp data/volumes.json $CONTAINER_NAME:$CONTAINER_DATA_DIR/
# Run placement check if needed
if [ -f "check-placement.sh" ]; then
echo "Running placement check..."
./check-placement.sh
# Copy placement check results to container
docker cp data/placement_diff.json $CONTAINER_NAME:$CONTAINER_DATA_DIR/
# Copy instance ID check results if they exist
if [ -f "data/instance_ids_check.json" ]; then
docker cp data/instance_ids_check.json $CONTAINER_NAME:$CONTAINER_DATA_DIR/
fi
fi
echo "Data collection and transfer completed successfully"