 
 (defn regions-by-tables
   "Generates output for /table_regions.json. Regions grouped by their tables."
-  [regions metric sort]
+  [regions metric sort {:keys [with-meta?] :or {with-meta? false}}]
   (let [;; Exclude hbase:meta table
-        all-regions (filter (complement :meta?) regions)
+        all-regions (if with-meta? regions (remove :meta? regions))
         ;; Sort the regions
         sorted-regions (if (= sort :metric)
                          (reverse (sort-by metric all-regions))


(defn exit [message]
  (println message)
  (println "usage: hbase-region-inspector [--read-only] QUORUM[/ZKPORT] PORT")
  (System/exit 1))

(defn -main [& args]
  (let [[opts args] ((juxt filter remove) #(.startsWith % "-") args)
        opts (set (map #(keyword (str/replace % #"^-*" "")) opts))]
    (reset! read-only? (contains? opts :read-only))
    (when (not= 2 (count args)) (exit "invalid number of arguments"))
    (try
      (let [[zk port] args


(defn regions-by-servers
  "Generates output for /server_regions.json. Regions grouped by their servers."
  [regions servers metric sort tables {:keys [with-meta?] :or {with-meta? false}}]
  (let [;; Exclude meta regions
        all-regions (if with-meta? regions (remove :meta? regions))

        ;; Sort the tables in descending order by the sum of the given metric
        all-tables (keys (sort-by
