Nagios plugins can certainly be coded to report multiple metrics. Doing so can improve the overall efficiency of your monitoring solution by reducing the per-metric overhead associated with launching a new plugin.
There are several examples of such plugins in the GroundWork Monitor product. One example is:
/usr/local/groundwork/nagios/libexec/check_netapp.pl
The above plugin uses SNMP to poll a NetApp Filer and collect the following metrics:
- temperature
- fan failures
- PSU failures
- NFS operations
- global status
If you look at the code you'll see it goes through each metric and then appends the values to $status_string and also determines the overall exit code / state for the plugin based on the worst severity issue. That general approach works well. The plugin does not show you how to build up the performance data output for a plugin. You can see that in:
/usr/local/groundwork/nagios/libexec/check_nmon_totals.pl
where $perfstring is appended to in a loop. You can loop through the metrics you are monitoring and build up both the status text and performance data quite easily. When it comes to passing thresholds to the plugin for multiple metrics you will need to decide whether you do that with just a couple of arguments which themselves are a set of thresholds, or you define lots of arguments - sets of two (warning and critical) for each metric being monitored.