move parsing of nagios state into separate function