Skip to content
Snippets Groups Projects
Verified Commit bb0c5942 authored by Jan Kryštof's avatar Jan Kryštof
Browse files

including generated link to thanos - CPU usage

parent df0b8d20
No related branches found
No related tags found
1 merge request!10update - include link to thanos metrics
......@@ -27,6 +27,11 @@ MetaCentrum Security cleans up the resources
- [`./destroy_the_vm.sh`](./destroy_the_vm.sh)
#### Links and metrics
- absolute [CPU usage](https://thanos-query1.cloud.muni.cz/graph?g0.expr=libvirt_domain_info_cpu_time_seconds_total&g0.tab=1&g0.stacked=0&g0.range_input=1h&g0.max_source_resolution=0s&g0.deduplicate=1&g0.partial_response=0&g0.store_matches=%5B%5D) is calculated as `sum(increase(libvirt_domain_info_cpu_time_seconds_total ...))` per given time T.
- relative usage is then calculated as `libvirt_domain_info_cpu_time_seconds_total / T * 100`. To normalize it regarding the CPU cores, divide it by number of cores.
#### The provided automation requires following to be in place
| Script | Requires |
|--------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------|
......
......@@ -78,7 +78,8 @@ echo "* * name: $(echo "${project_json}" | jq -r '.name')"
echo "* volumes: $(echo "${server_json}" | jq -rc '.volumes_attached')"
hypervisor_hostname="$(echo "${server_json}" | jq -rc '."OS-EXT-SRV-ATTR:host"')"
echo "* hypervisor: ${hypervisor_hostname}"
echo "* libvirt-domain-name: $(echo "${server_json}" | jq -rc '."OS-EXT-SRV-ATTR:instance_name"')"
libvirt_domain_name=$(echo "${server_json}" | jq -rc '."OS-EXT-SRV-ATTR:instance_name"')
echo "* libvirt-domain-name: $libvirt_domain_name"
echo "* security-groups: $(echo "${server_json}" | jq -rc '.security_groups')"
security_group_names=$(echo "${server_json}" | jq -r '.security_groups[] | .name')
security_groups_json=$(openstack security group list --project ${project_id} -fjson)
......@@ -94,3 +95,9 @@ if ssh ${SSH_ARGS} "root@${hypervisor_hostname}" "uname -a" >/dev/null; then
else
echo "Libvirt domain block device list is not available."
fi
VM_CPU_USAGE_THANOS_URL='https://thanos-query1.cloud.muni.cz/graph?g0.expr=sum(increase(libvirt_domain_info_cpu_time_seconds_total%7Bhostname%3D%22__HYPERVISOR_NAME__%22%2C%20domain%3D%22__LIBVIRT_DOMAIN__%22%7D%5B360s%5D))&g0.tab=1&g0.stacked=0&g0.range_input=1h&g0.max_source_resolution=0s&g0.deduplicate=1&g0.partial_response=0&g0.store_matches=%5B%5D'
VM_CPU_USAGE_THANOS_URL=$(echo "$VM_CPU_USAGE_THANOS_URL" | sed s/__HYPERVISOR_NAME__/$hypervisor_hostname/)
VM_CPU_USAGE_THANOS_URL=$(echo "$VM_CPU_USAGE_THANOS_URL" | sed s/__LIBVIRT_DOMAIN__/$libvirt_domain_name/)
echo "* Link to Thanos metric - CPU usage: $VM_CPU_USAGE_THANOS_URL"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment