sysmon: Add option to specify lab environment for prod hosts metric.

This CL adds --collect-host-manifest option to sysmon, to replace
--collect-prod-hosts. The new option allows us to specify the lab
environment for the server database instance being targeted.

This CL interprets the new option identically to the old option,
allowing us to migrate users before we start making use of the extra
information.

BUG=None
TEST=unittest. But that don't test nothin'

Change-Id: I36671826fe705c39e40be50cb1c07fd2faced1d0
Reviewed-on: https://chromium-review.googlesource.com/904966
Commit-Ready: Prathmesh Prabhu <pprabhu@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
Reviewed-by: Prathmesh Prabhu <pprabhu@chromium.org>
diff --git a/scripts/sysmon/mainlib.py b/scripts/sysmon/mainlib.py
index de4e71a..f98318e 100644
--- a/scripts/sysmon/mainlib.py
+++ b/scripts/sysmon/mainlib.py
@@ -96,7 +96,14 @@
   parser.add_argument(
       '--collect-prod-hosts',
       action='store_true',
-      help='Enable collection of prod host metrics, like roles')
+      help='[DEPRECATED. Use --collect-host-manifest instead.] '
+           'Enable collection of prod host metrics, like roles')
+  parser.add_argument(
+      '--collect-host-manifest',
+      default=None,
+      choices=['prod', 'staging'],
+      help='Enable collection of server metrics (e.g. roles) for servers in '
+           'the given lab environment.')
   opts = parser.parse_args()
   opts.Freeze()
 
@@ -107,6 +114,9 @@
   interface.state.metric_name_prefix = (interface.state.metric_name_prefix
                                         + 'chromeos/sysmon/')
 
+  # Transitional, while we migrate users off of |collect_prod_hosts|
+  if opts.collect_host_manifest is not None:
+    opts.collect_prod_hosts = True
   collector = _MetricCollector(collect_prod_hosts=opts.collect_prod_hosts)
   loop.SleepLoop(callback=collector,
                  interval=opts.interval).loop_forever()