monitor: cleanup parsing of cmd name and cmd arguments