refactor to support both nagios-api and livestatus api