# zabbix midware v1.0 (Zabbix to AIOPs)
###### tags: `By_Ivan`
This document explain how do the midware transport data from Zabbix to AIOPs, and how to reassemble the json messages to csv lines under the configs' structure.
## workflow

Psuedocode:
```=
while True:
list_of_configs = listdir("config.dir/")
for file in list_of_configs:
config = JSON.load(file)
messages = [json_query(items) for items in config["item_list"]]
write_csv(messages)
now = time.now()
sleep_time = 1 minute - now.m - now.s - now.ms
sleep(sleep_time)
```
## config structure
Each config json file corresponds to a line in the output csv file.
The config determines witch zabbix server to query from, and the information required by Osprey.
```json!
{
"zabbix":{
"host":{$IP:PORT},
"user":{$USER},
"password":{$PASSWORD}
},
"probe":{
"name":{$probe_type},
"target_host":{$probe_server},
"_discription":"This entry is used to provide information to Opsrey"
},
"item_list":[
{
"id":{$id_int},
"dtype":{$dtype_int[0-4]},
"col":[{$list_of_colname|empty}]
},
{
"id":{$id_int},
"dtype":{$dtype_int[0-4]},
"col":[{$list_of_colname|empty}]
}
]
}
```
## Future works
1. threading
2. config structure refine
3. daemonlize