Increase control on data printed
Increase control on data printed

maas has some particular requirements regarding the output. This
commit attempts to address the following:

- Report an error if the script attempts to return more than 30 metrics.
While the agent does log this and does stop sending metrics the status
of the check remains available. This could cause issues if the metrics
aren't used with alarms

- Uncaught exceptions generate a status message.
Exceptions don't generate a status message unless one is explicitly
set. Sometimes an exception may only occur if run by the agent. Status
messages have a limit of 256 characters so the text is taken from the
tail of the traceback.

- Strip newlines from output
The agent treats each line separately. Multi-line output such as
exceptions needs to have newlines escaped so that it can be used in the
status message.

- Use the last status message
The agent uses the first status message it receives and logs any that
follow as duplicates. If an error happens after an okay status message
the message needs to be updated.

cloudnull/rpc-openstack,mattt416/rpc-openstack,andymcc/rpc-openstack,BjoernT/rpc-openstack,busterswt/rpc-openstack,briancurtin/rpc-maas,cfarquhar/rpc-maas,jpmontez/rpc-openstack,miguelgrinberg/rpc-openstack,git-harry/rpc-openstack,npawelek/rpc-maas,byronmccollum/rpc-openstack,byronmccollum/rpc-openstack,miguelgrinberg/rpc-openstack,darrenchan/rpc-openstack,nrb/rpc-openstack,mattt416/rpc-openstack,shannonmitchell/rpc-openstack,cloudnull/rpc-maas,npawelek/rpc-maas,mattt416/rpc-openstack,byronmccollum/rpc-openstack,darrenchan/rpc-openstack,git-harry/rpc-openstack,robb-romans/rpc-openstack,xeregin/rpc-openstack,xeregin/rpc-openstack,cfarquhar/rpc-openstack,claco/rpc-openstack,sigmavirus24/rpc-openstack,darrenchan/rpc-openstack,cfarquhar/rpc-openstack,andymcc/rpc-openstack,xeregin/rpc-openstack,nrb/rpc-openstack,miguelgrinberg/rpc-openstack,cloudnull/rpc-maas,major/rpc-openstack,andymcc/rpc-openstack,briancurtin/rpc-maas,jpmontez/rpc-openstack,sigmavirus24/rpc-openstack,cloudnull/rpc-maas,xeregin/rpc-openstack,jacobwagner/rpc-openstack,jacobwagner/rpc-openstack,claco/rpc-openstack,prometheanfire/rpc-openstack,npawelek/rpc-maas,stevelle/rpc-openstack,shannonmitchell/rpc-openstack,cfarquhar/rpc-maas,nrb/rpc-openstack,stevelle/rpc-openstack,briancurtin/rpc-maas,prometheanfire/rpc-openstack,galstrom21/rpc-openstack,cfarquhar/rpc-maas,rcbops/rpc-openstack,sigmavirus24/rpc-openstack,jpmontez/rpc-openstack,robb-romans/rpc-openstack,stevelle/rpc-openstack,hughsaunders/rpc-openstack,rcbops/rpc-openstack,cloudnull/rpc-openstack,galstrom21/rpc-openstack,BjoernT/rpc-openstack,hughsaunders/rpc-openstack,mancdaz/rpc-openstack,major/rpc-openstack,busterswt/rpc-openstack,claco/rpc-openstack,busterswt/rpc-openstack,mancdaz/rpc-openstack,sigmavirus24/rpc-openstack,darrenchan/rpc-openstack