-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #129 from lindig/1.33-lcm
CP-42182 Add CLI tool on xe and rrd-cli to enable saving of rrds to local host
- Loading branch information
Showing
3 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
(executable | ||
(name rrd_cli) | ||
(public_name rrd-cli) | ||
(package xapi-rrdd) | ||
(modules rrd_cli) | ||
(libraries | ||
cmdliner | ||
rpclib.cmdliner | ||
rpclib.markdown | ||
xapi-idl.rrd | ||
)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
(* Rrd CLI *) | ||
|
||
module Cmds = Rrd_interface.RPC_API (Cmdlinergen.Gen ()) | ||
|
||
let version_str description = | ||
let maj, min, mic = description.Idl.Interface.version in | ||
Printf.sprintf "%d.%d.%d" maj min mic | ||
|
||
let default_cmd = | ||
let doc = | ||
String.concat "" | ||
[ | ||
"A CLI for the Db monitoring API. This allows scripting of the Rrd \ | ||
daemon " | ||
; "for testing and debugging. This tool is not intended to be used as an " | ||
; "end user tool" | ||
] | ||
in | ||
( Cmdliner.Term.(ret (const (fun _ -> `Help (`Pager, None)) $ const ())) | ||
, Cmdliner.Term.info "rrd-cli" ~version:(version_str Cmds.description) ~doc ) | ||
|
||
let cli () = | ||
let rpc = Rrd_client.rpc in | ||
Cmdliner.Term.eval_choice default_cmd | ||
(List.map (fun t -> t rpc) (Cmds.implementation ())) | ||
|
||
let _ = cli () |