i have 3 lists:
servers = ['DC1','DC2','DC3']
main_process = ['1.exe','2.exe','3.exe']
sub_process = ['s1','s2','s3']
and i have an api request in json that i need to print to a file as many time as the number of elements in the lists - in this case 3 - but with the the element from each list in the same location.
for example:
POST api/alerting/rule
{
"params":{
"aggType":"avg",
"termSize":6,
"thresholdComparator":">",
"timeWindowSize":5,
"timeWindowUnit":"m",
"groupBy":"top",
"threshold":[
1000
],
"index":[
".test-index"
],
"timeField":"@timestamp",
"aggField":"sheet.version",
"SERVER":"DC1" # <--------- This Parameter
"MAIN_PROCESS":"1.exe" # <--------- This Parameter
"SUB_PROCESS":"s1" # <--------- This Parameter
},
"consumer":"alerts",
"rule_type_id":".index-threshold",
"schedule":{
"interval":"1m" }
"notify_when":"onActionGroupChange",
"name":"my alert"
}
POST api/alerting/rule
{
"params":{
"aggType":"avg",
"termSize":6,
"thresholdComparator":">",
"timeWindowSize":5,
"timeWindowUnit":"m",
"groupBy":"top",
"threshold":[
1000
],
"index":[
".test-index"
],
"timeField":"@timestamp",
"aggField":"sheet.version",
"SERVER":"DC2" # <--------- This Parameter
"MAIN_PROCESS":"2.exe" # <--------- This Parameter
"SUB_PROCESS":"s2" # <--------- This Parameter
},
"consumer":"alerts",
"rule_type_id":".index-threshold",
"schedule":{
"interval":"1m" }
"notify_when":"onActionGroupChange",
"name":"my alert"
}
POST api/alerting/rule
{
"params":{
"aggType":"avg",
"termSize":6,
"thresholdComparator":">",
"timeWindowSize":5,
"timeWindowUnit":"m",
"groupBy":"top",
"threshold":[
1000
],
"index":[
".test-index"
],
"timeField":"@timestamp",
"aggField":"sheet.version",
"SERVER":"DC3" # <--------- This Parameter
"MAIN_PROCESS":"3.exe" # <--------- This Parameter
"SUB_PROCESS":"s3" # <--------- This Parameter
},
"consumer":"alerts",
"rule_type_id":".index-threshold",
"schedule":{
"interval":"1m" }
"notify_when":"onActionGroupChange",
"name":"my alert"
}
i know that i need some loops for that but i can't figure this out yet. i would prefer to do that in bash because the environment i'm working here but python would be a great solution as well.
thanks.