Hi folks,
I'm trying to create template to monitor some metrics of docker swarm services/tasks.
I've created a python script and LLD template. The script runs on docker swarm node and generates next json structure
I've managed to extract service name as user macros and based on it to extract required replicas count (repl_req), replicas current number (repl_cnt) and required docker image tag (image_tag_req) as a service bound metrics.
I also need somehow to monitor is service's tasks are running with required image tag. So I need to extract all task ids per service somehow and check it against each service required image tag metric.
I can't understand how to create item which will identify service it's task and task image tag.
My current template
zbx_export_templates-2.xml
I'm trying to create template to monitor some metrics of docker swarm services/tasks.
I've created a python script and LLD template. The script runs on docker swarm node and generates next json structure
Code:
{
"service_name": "portainer_agent",
"tasks": [
{
"task_id": "cje2yvfy6hmvxm41dduwzclcm",
"image_tag": "latest"
},
{
"task_id": "l7nzsod5k9goullaetlquppm9",
"image_tag": "latest"
},
{
"task_id": "to6udk3hjf7061ohfmeebuxww",
"image_tag": "latest"
}
],
"repl_cnt": 3,
"repl_req": 3,
"image_tag_req": "latest"
},
{
"service_name": "squirrel-stable_readonly",
"tasks": [
{
"task_id": "7zwg1q89zlvvmozphe500xbk9",
"image_tag": "infra-1108-08"
},
{
"task_id": "cqkj25q600cqebg0qfz4ctjug",
"image_tag": "infra-1108-08"
},
{
"task_id": "ohc9acmzr7ylmknxkzczgsaf0",
"image_tag": "infra-1108-08"
}
],
"repl_cnt": 3,
"repl_req": 3,
"image_tag_req": "infra-1108-08"
},
I also need somehow to monitor is service's tasks are running with required image tag. So I need to extract all task ids per service somehow and check it against each service required image tag metric.
I can't understand how to create item which will identify service it's task and task image tag.
My current template
zbx_export_templates-2.xml
Comment