Hi all,
I am trying to build a basic monitoring for my Proxmox Host with Node-Red.
I am able to access the API from Proxmox and get a list of all available containers and their information...
These information will be returned as an Array (for each container) - and each Array does contain an Object with the different information related to the container.
[
{
"template":"",
"netin":513218353,
"maxmem":16000221184,
"maxswap":16000221184,
"disk":"2422423552",
"maxdisk":"12615557120",
"cpu":0.000143815233868653,
"uptime":152019,
"vmid":"103",
"status":"running",
"netout":405024201,
"type":"lxc",
"cpus":2,
"name":"ngnix-server",
"diskread":821694464,
"swap":0,
"pid":"3137",
"diskwrite":173953024,
"mem":51335168
},
{
"vmid":"100",
"status":"running",
"maxdisk":"8388009984",
"uptime":137495,
"cpu":0.0208788031474906,
"disk":"2650222592",
"maxswap":16000221184,
"maxmem":16000221184,
"template":"",
"netin":790458843,
"mem":187113472,
"pid":"950",
"swap":0,
"diskwrite":569401344,
"diskread":687075328,
"name":"samba-server",
"cpus":2,
"type":"lxc",
"netout":638719271
}
# and more...
]
Since the API would allow to create or delete containers on proxmox, I can't be sure how many machines will be returned back - so, I don't know, how long the array would be.
Since I want to forward the information to another client (homeAssistant), I need to create sensors for each entity that I want to monitor.
In my case, I need an "sensor" at least for each container included in the message.
Now, I can do this "manually":
With this method, I could simply collect the information and will have each device available as a Sensor in HomeAssistant.
But: Is there a way to create the sensors dynamically?
something like that?
in this case, the sensor would work as a template - which will be created for each container that is within the return message...