agent: move regexp compilation out of for loop for status and node name