The inner vars is not needed here, the final key would be procs_command in each iteration. Still, if you just want to use a list of procs to monitor, I would simplify the apply for loop to use an array instead of a nested dictionary.
apply Service "procs-" for (proc_name in host.vars.monitored_processes) {
check_command = "procs"
command_endpoint = host.vars.client_endpoint
assign where host.vars.client_endpoint
}
Service Thresholds from the Host
If you want to specify certain thresholds for each process, change that logic into a nested dictionary like so
// use the "procs-" prefix for generated object names, to make them unique. The display_name is used by Icinga Web to show the short one.
apply Service "procs-" for (procs => config in host.vars.local_procs) {
display_name = procs
check_command = "procs"
vars += config //copy over the defined thresholds
command_endpoint = host.vars.client_endpoint
assign where host.vars.client_endpoint
}
Ensure to keep the name like procs_warning on the host exactly the same as stated in the docs for procs.