code: public static void main(String[] args) throws Exception {
        String hostPort = "";
        if (args.length > 0) {
          hostPort = args[0];
        }
        JmxCollector jc = new JmxCollector(("{"
        + "`hostPort`: `" + hostPort + "`,"
        + "}").replace('`', '"'));
        for(MetricFamilySamples mfs : jc.collect()) {
          System.out.println(mfs);
        }
      }
docs: Convenience function to run standalone.