hopefully finish implementation
This commit is contained in:
parent
bde5127560
commit
f68751df31
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
/target
|
||||
**/*.rs.bk
|
||||
.idea
|
170
Cargo.lock
generated
170
Cargo.lock
generated
@ -1,9 +1,9 @@
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.6.9"
|
||||
name = "ansi_term"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -53,6 +53,30 @@ name = "cfg-if"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "chrono"
|
||||
version = "0.4.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "2.32.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cloudabi"
|
||||
version = "0.0.3"
|
||||
@ -117,15 +141,11 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.6.0"
|
||||
name = "fern"
|
||||
version = "0.5.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -203,14 +223,6 @@ name = "httparse"
|
||||
version = "1.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "humantime"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hyper"
|
||||
version = "0.12.23"
|
||||
@ -297,15 +309,6 @@ dependencies = [
|
||||
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memoffset"
|
||||
version = "0.2.1"
|
||||
@ -365,6 +368,19 @@ name = "nodrop"
|
||||
version = "0.1.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "num-integer"
|
||||
version = "0.1.39"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "1.9.0"
|
||||
@ -415,13 +431,16 @@ dependencies = [
|
||||
name = "peshming"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fern 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hyper 0.12.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"oping 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"prometheus 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"tokio 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@ -582,26 +601,6 @@ dependencies = [
|
||||
"redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.2.3"
|
||||
@ -630,8 +629,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.85"
|
||||
version = "1.0.87"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
@ -671,6 +673,11 @@ name = "string"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "strsim"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "0.15.26"
|
||||
@ -681,14 +688,6 @@ dependencies = [
|
||||
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termcolor"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "termion"
|
||||
version = "1.5.1"
|
||||
@ -700,11 +699,11 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "0.3.6"
|
||||
name = "textwrap"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -890,7 +889,7 @@ name = "toml"
|
||||
version = "0.4.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -899,8 +898,8 @@ version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "ucd-util"
|
||||
version = "0.1.3"
|
||||
name = "unicode-width"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
@ -917,8 +916,8 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "utf8-ranges"
|
||||
version = "1.0.2"
|
||||
name = "vec_map"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
@ -960,28 +959,11 @@ name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-util"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "wincolor"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ws2_32-sys"
|
||||
version = "0.2.1"
|
||||
@ -992,7 +974,7 @@ dependencies = [
|
||||
]
|
||||
|
||||
[metadata]
|
||||
"checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e"
|
||||
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
||||
"checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71"
|
||||
"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
|
||||
"checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799"
|
||||
@ -1000,13 +982,15 @@ dependencies = [
|
||||
"checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb"
|
||||
"checksum bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "40ade3d27603c2cb345eb0912aec461a6dec7e06a4ae48589904e808335c7afa"
|
||||
"checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4"
|
||||
"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878"
|
||||
"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
|
||||
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
|
||||
"checksum crossbeam 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ad4c7ea749d9fb09e23c5cb17e3b70650860553a0e2744e38446b1803bf7db94"
|
||||
"checksum crossbeam-channel 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "0f0ed1a4de2235cabda8558ff5840bffb97fcb64c97827f354a451307df5f72b"
|
||||
"checksum crossbeam-deque 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "05e44b8cf3e1a625844d1750e1f7820da46044ff6d28f4d43e455ba3e5bb2c13"
|
||||
"checksum crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "04c9e3102cc2d69cd681412141b390abd55a362afc1540965dad0ad4d34280b4"
|
||||
"checksum crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f8306fcef4a7b563b76b7dd949ca48f52bc1141aa067d2ea09565f3e2652aa5c"
|
||||
"checksum env_logger 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "afb070faf94c85d17d50ca44f6ad076bce18ae92f0037d350947240a36e9d42e"
|
||||
"checksum fern 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b48af88aaf938b11baef948a5599e66e709cf92854aa2b87c71f1bcf20f80a01"
|
||||
"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"
|
||||
"checksum fuchsia-cprng 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "81f7f8eb465745ea9b02e2704612a9946a59fa40572086c6fd49d6ddcf30bf31"
|
||||
"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
|
||||
@ -1017,7 +1001,6 @@ dependencies = [
|
||||
"checksum h2 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "ddb2b25a33e231484694267af28fec74ac63b5ccf51ee2065a5e313b834d836e"
|
||||
"checksum http 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "1a10e5b573b9a0146545010f50772b9e8b1dd0a256564cc4307694c68832a2f5"
|
||||
"checksum httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e8734b0cfd3bc3e101ec59100e101c2eecd19282202e87808b3037b442777a83"
|
||||
"checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114"
|
||||
"checksum hyper 0.12.23 (registry+https://github.com/rust-lang/crates.io-index)" = "860faf61a9957c9cb0e23e69f1c8290e92f6eb660fcdd1f2d6777043a2ae1a46"
|
||||
"checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d"
|
||||
"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08"
|
||||
@ -1028,13 +1011,14 @@ dependencies = [
|
||||
"checksum libc 0.2.48 (registry+https://github.com/rust-lang/crates.io-index)" = "e962c7641008ac010fa60a7dfdc1712449f29c44ef2d4702394aea943ee75047"
|
||||
"checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c"
|
||||
"checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6"
|
||||
"checksum memchr 2.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e1dd4eaac298c32ce07eb6ed9242eda7d82955b9170b7d6db59b2e02cc63fcb8"
|
||||
"checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3"
|
||||
"checksum mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432"
|
||||
"checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125"
|
||||
"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
|
||||
"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88"
|
||||
"checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945"
|
||||
"checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea"
|
||||
"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1"
|
||||
"checksum num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5a69d464bdc213aaaff628444e99578ede64e9c854025aa43b9796530afa9238"
|
||||
"checksum oping 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c9800d51dab9ada09da41b9182e62df3bc86493a0386eb321b3d00eab568166f"
|
||||
"checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13"
|
||||
@ -1058,23 +1042,21 @@ dependencies = [
|
||||
"checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
|
||||
"checksum redox_syscall 0.1.51 (registry+https://github.com/rust-lang/crates.io-index)" = "423e376fffca3dfa06c9e9790a9ccd282fafb3cc6e6397d01dbf64f9bacc6b85"
|
||||
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
|
||||
"checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f"
|
||||
"checksum regex-syntax 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8c2f35eedad5295fdf00a63d7d4b238135723f92b434ec06774dad15c7ab0861"
|
||||
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
||||
"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27"
|
||||
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
||||
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||
"checksum serde 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)" = "534b8b91a95e0f71bca3ed5824752d558da048d4248c91af873b63bd60519752"
|
||||
"checksum serde 1.0.87 (registry+https://github.com/rust-lang/crates.io-index)" = "2e20fde37801e83c891a2dc4ebd3b81f0da4d1fb67a9e0a2a3b921e2536a58ee"
|
||||
"checksum serde_derive 1.0.85 (registry+https://github.com/rust-lang/crates.io-index)" = "a915306b0f1ac5607797697148c223bedeaa36bcc2e28a01441cd638cc6567b4"
|
||||
"checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8"
|
||||
"checksum smallvec 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "88aea073965ab29f6edb5493faf96ad662fb18aa9eeb186a3b7057951605ed15"
|
||||
"checksum spin 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ceac490aa12c567115b40b7b7fceca03a6c9d53d5defea066123debc83c5dc1f"
|
||||
"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
|
||||
"checksum string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b639411d0b9c738748b5397d5ceba08e648f4f1992231aa859af1a017f31f60b"
|
||||
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
|
||||
"checksum syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)" = "f92e629aa1d9c827b2bb8297046c1ccffc57c99b947a680d3ccff1f136a3bee9"
|
||||
"checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f"
|
||||
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
|
||||
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
|
||||
"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6"
|
||||
"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
|
||||
"checksum tokio 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "e0500b88064f08bebddd0c0bed39e19f5c567a5f30975bee52b0c0d3e2eeb38c"
|
||||
"checksum tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5c501eceaf96f0e1793cf26beb63da3d11c738c4a943fdf3746d81d64684c39f"
|
||||
@ -1091,17 +1073,15 @@ dependencies = [
|
||||
"checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445"
|
||||
"checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f"
|
||||
"checksum try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382"
|
||||
"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86"
|
||||
"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526"
|
||||
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||
"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
|
||||
"checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737"
|
||||
"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
|
||||
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
||||
"checksum want 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "797464475f30ddb8830cc529aaaae648d581f99e2036a928877dfde027ddf6b3"
|
||||
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
||||
"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0"
|
||||
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
|
||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9"
|
||||
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
"checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba"
|
||||
"checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e"
|
||||
|
@ -3,14 +3,18 @@ name = "peshming"
|
||||
version = "0.1.0"
|
||||
authors = ["Jan Christian Grünhage <jan.christian@gruenhage.xyz>"]
|
||||
edition = "2018"
|
||||
description = "Pings configured hosts in a configurable intervals and exposes metrics for prometheus."
|
||||
|
||||
[dependencies]
|
||||
prometheus = "0.5.0"
|
||||
oping = "0.3.3"
|
||||
toml = "0.4.10"
|
||||
serde_derive = "1.0.85"
|
||||
hyper = "0.12.23"
|
||||
lazy_static = "1.2.0"
|
||||
futures = "0.1.25"
|
||||
tokio = "0.1.15"
|
||||
env_logger = "0.6.0"
|
||||
clap = "2.32.0"
|
||||
fern = "0.5.7"
|
||||
log = "0.4.6"
|
||||
chrono = "0.4.6"
|
||||
serde = { version = "1.0.87", features = ["derive"] }
|
||||
|
6
config.toml.sample
Normal file
6
config.toml.sample
Normal file
@ -0,0 +1,6 @@
|
||||
listener = "[::]:9898"
|
||||
|
||||
[hosts]
|
||||
"1.1.1.1" = 5
|
||||
"1.0.0.1" = 5
|
||||
|
28
src/README.md
Normal file
28
src/README.md
Normal file
@ -0,0 +1,28 @@
|
||||
## peshming
|
||||
It's a prometheus exporter pinging hosts in the background.
|
||||
It's been inspired by [meshping](https://bitbucket.org/Svedrin/meshping),
|
||||
but instead of managing targets using a redis db this is using a simple config file.
|
||||
In addition, this tool allows to set a ping frequency per target.
|
||||
|
||||
The name peshming is intended as a placeholder until
|
||||
someone comes up with something better.
|
||||
|
||||
### Usage:
|
||||
```
|
||||
peshming 0.1.0
|
||||
Jan Christian Grünhage <jan.christian@gruenhage.xyz>
|
||||
Pings configured hosts in a configurable intervals and exposes metrics for prometheus.
|
||||
|
||||
USAGE:
|
||||
peshming [FLAGS] <config>
|
||||
|
||||
FLAGS:
|
||||
-h, --help Prints help information
|
||||
-v, --verbose Be verbose (you can add this up to 4 times for more logs)
|
||||
-V, --version Prints version information
|
||||
|
||||
ARGS:
|
||||
<config> Set config file
|
||||
|
||||
```
|
||||
For configuration options, see the included sample config file.
|
73
src/config.rs
Normal file
73
src/config.rs
Normal file
@ -0,0 +1,73 @@
|
||||
use std::collections::HashMap;
|
||||
use log::{error, warn, info, debug, trace};
|
||||
use serde::{Serialize, Deserialize};
|
||||
use clap::{clap_app, crate_name, crate_version, crate_description, crate_authors};
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub(crate) struct Config {
|
||||
pub(crate) listener: std::net::SocketAddr,
|
||||
pub(crate) hosts: HashMap<String, u64>,
|
||||
}
|
||||
|
||||
pub(crate) fn setup_clap() -> (clap::ArgMatches<'static>) {
|
||||
clap_app!(myapp =>
|
||||
(name: crate_name!())
|
||||
(version: crate_version!())
|
||||
(author: crate_authors!())
|
||||
(about: crate_description!())
|
||||
(@arg config: +required "Set config file")
|
||||
(@arg v: -v --verbose ... "Be verbose (you can add this up to 4 times for more logs)")
|
||||
).get_matches()
|
||||
}
|
||||
|
||||
pub(crate) fn setup_fern(level: u64) {
|
||||
let level = match level {
|
||||
0 => log::LevelFilter::Error,
|
||||
1 => log::LevelFilter::Warn,
|
||||
2 => log::LevelFilter::Info,
|
||||
3 => log::LevelFilter::Debug,
|
||||
_ => log::LevelFilter::Trace
|
||||
};
|
||||
match fern::Dispatch::new()
|
||||
.format(|out, message, record| {
|
||||
out.finish(format_args!(
|
||||
"[{}][{}] {}",
|
||||
chrono::Local::now().format("%Y-%m-%d %H:%M:%S"),
|
||||
record.level(),
|
||||
message
|
||||
))
|
||||
})
|
||||
.level(level)
|
||||
.chain(std::io::stdout())
|
||||
.apply() {
|
||||
Err(_) => {
|
||||
eprintln!("error setting up logging!");
|
||||
}
|
||||
_ => info!("logging set up properly"),
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn read_config(path: &str) -> Result<Config, Error> {
|
||||
let config_file_content = std::fs::read_to_string(path)?;
|
||||
Ok(toml::from_str(&config_file_content)?)
|
||||
}
|
||||
|
||||
pub(crate) struct Error {}
|
||||
|
||||
impl std::convert::From<std::io::Error> for Error {
|
||||
fn from(_: std::io::Error) -> Self {
|
||||
Error{}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::convert::From<toml::de::Error> for Error {
|
||||
fn from(_: toml::de::Error) -> Self {
|
||||
Error{}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::convert::From<oping::PingError> for Error {
|
||||
fn from(_: oping::PingError) -> Self {
|
||||
Error{}
|
||||
}
|
||||
}
|
98
src/main.rs
98
src/main.rs
@ -1,85 +1,27 @@
|
||||
extern crate serde_derive;
|
||||
extern crate toml;
|
||||
extern crate hyper;
|
||||
extern crate lazy_static;
|
||||
extern crate prometheus;
|
||||
extern crate futures;
|
||||
extern crate tokio;
|
||||
extern crate env_logger;
|
||||
|
||||
use hyper::header::CONTENT_TYPE;
|
||||
use hyper::{Body, Request, Response, Server};
|
||||
use hyper::rt::Future;
|
||||
use hyper::service::service_fn_ok;
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
use prometheus::{Counter, Encoder, Gauge, HistogramVec, TextEncoder};
|
||||
use prometheus::*;
|
||||
|
||||
use log::{error, warn, info, debug, trace};
|
||||
use futures::future::lazy;
|
||||
|
||||
//TODO: Replace with useful metrics, these are beyond useless
|
||||
lazy_static! {
|
||||
static ref HTTP_COUNTER: Counter = register_counter!(opts!(
|
||||
"example_http_requests_total",
|
||||
"Total number of HTTP requests made.",
|
||||
labels! {"handler" => "all",}
|
||||
))
|
||||
.unwrap();
|
||||
static ref HTTP_BODY_GAUGE: Gauge = register_gauge!(opts!(
|
||||
"example_http_response_size_bytes",
|
||||
"The HTTP response sizes in bytes.",
|
||||
labels! {"handler" => "all",}
|
||||
))
|
||||
.unwrap();
|
||||
static ref HTTP_REQ_HISTOGRAM: HistogramVec = register_histogram_vec!(
|
||||
"example_http_request_duration_seconds",
|
||||
"The HTTP request latencies in seconds.",
|
||||
&["handler"]
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
fn start_serving_metrics() {
|
||||
let serve_metrics = || {
|
||||
service_fn_ok(|_req| {
|
||||
HTTP_COUNTER.inc();
|
||||
let timer = HTTP_REQ_HISTOGRAM.with_label_values(&["all"]).start_timer();
|
||||
let metric_families = prometheus::gather();
|
||||
let mut buffer = vec![];
|
||||
let encoder = TextEncoder::new();
|
||||
encoder.encode(&metric_families, &mut buffer).unwrap();
|
||||
HTTP_BODY_GAUGE.set(buffer.len() as f64);
|
||||
let mut res = Response::new(Body::from(buffer));
|
||||
res.headers_mut().insert(CONTENT_TYPE, encoder.format_type().parse().unwrap());
|
||||
timer.observe_duration();
|
||||
res
|
||||
})
|
||||
};
|
||||
println!("listening addr 127.0.0.1:9898");
|
||||
let server = Server::bind(&([127, 0, 0, 1], 9898).into())
|
||||
.serve(serve_metrics)
|
||||
.map_err(|err| eprintln!("server error: {}", err));
|
||||
tokio::spawn(server);
|
||||
}
|
||||
|
||||
fn start_pinging_hosts() {
|
||||
tokio::spawn(lazy(|| {
|
||||
//TODO: Implement the pinging, based on oping and the example over at
|
||||
// https://tokio.rs/docs/futures/spawning/
|
||||
Ok(())
|
||||
}));
|
||||
}
|
||||
//TODO: Clean this shameful mess up!
|
||||
//TODO: Do config reading, cli args, logging etc
|
||||
|
||||
mod config;
|
||||
mod metrics;
|
||||
mod ping;
|
||||
use crate::config::{Config, read_config, setup_clap, setup_fern};
|
||||
use crate::metrics::start_serving_metrics;
|
||||
use crate::ping::start_pinging_hosts;
|
||||
|
||||
fn main() {
|
||||
env_logger::init();
|
||||
tokio::run(lazy(|| {
|
||||
start_serving_metrics();
|
||||
start_pinging_hosts();
|
||||
let clap = setup_clap();
|
||||
setup_fern(clap.occurrences_of("v"));
|
||||
let config = match read_config(clap.value_of("config").unwrap()) {
|
||||
Ok(config) => config,
|
||||
Err(_) => {
|
||||
error!("Couldn't read config file!");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
tokio::run(lazy(move || {
|
||||
start_serving_metrics(&config);
|
||||
start_pinging_hosts(&config);
|
||||
Ok(())
|
||||
}));
|
||||
}
|
||||
|
51
src/metrics.rs
Normal file
51
src/metrics.rs
Normal file
@ -0,0 +1,51 @@
|
||||
use crate::config::{Config};
|
||||
use lazy_static::lazy_static;
|
||||
use hyper::{Server, Response, Body, header::CONTENT_TYPE, service::service_fn_ok};
|
||||
use prometheus::{TextEncoder, Counter, Gauge, HistogramVec};
|
||||
use prometheus::*;
|
||||
|
||||
use futures::future::Future;
|
||||
|
||||
lazy_static! {
|
||||
static ref HTTP_COUNTER: Counter = register_counter!(opts!(
|
||||
"http_requests_total",
|
||||
"Total number of HTTP requests made.",
|
||||
labels! {"handler" => "all",}
|
||||
))
|
||||
.unwrap();
|
||||
static ref HTTP_BODY_GAUGE: Gauge = register_gauge!(opts!(
|
||||
"http_response_size_bytes",
|
||||
"The HTTP response sizes in bytes.",
|
||||
labels! {"handler" => "all",}
|
||||
))
|
||||
.unwrap();
|
||||
static ref HTTP_REQ_HISTOGRAM: HistogramVec = register_histogram_vec!(
|
||||
"http_request_duration_seconds",
|
||||
"The HTTP request latencies in seconds.",
|
||||
&["handler"]
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
pub(crate) fn start_serving_metrics(config: &Config) {
|
||||
let serve_metrics = || {
|
||||
service_fn_ok(|_req| {
|
||||
HTTP_COUNTER.inc();
|
||||
let timer = HTTP_REQ_HISTOGRAM.with_label_values(&["all"]).start_timer();
|
||||
let metric_families = prometheus::gather();
|
||||
let mut buffer = vec![];
|
||||
let encoder = TextEncoder::new();
|
||||
encoder.encode(&metric_families, &mut buffer).unwrap();
|
||||
HTTP_BODY_GAUGE.set(buffer.len() as f64);
|
||||
let mut res = Response::new(Body::from(buffer));
|
||||
res.headers_mut().insert(CONTENT_TYPE, encoder.format_type().parse().unwrap());
|
||||
timer.observe_duration();
|
||||
res
|
||||
})
|
||||
};
|
||||
println!("Listening on {}", &config.listener);
|
||||
let server = Server::bind(&config.listener)
|
||||
.serve(serve_metrics)
|
||||
.map_err(|err| eprintln!("server error: {}", err));
|
||||
tokio::spawn(server);
|
||||
}
|
55
src/ping.rs
Normal file
55
src/ping.rs
Normal file
@ -0,0 +1,55 @@
|
||||
use crate::config::{Config, Error};
|
||||
use std::time::{Duration, Instant};
|
||||
use tokio::timer::{Interval};
|
||||
use futures::{future::{lazy, Future}, stream::Stream};
|
||||
use oping::{Ping};
|
||||
use log::{trace, debug, info, warn, error};
|
||||
use prometheus::*;
|
||||
use lazy_static::lazy_static;
|
||||
|
||||
lazy_static! {
|
||||
static ref PING_HISTOGRAM : HistogramVec = register_histogram_vec!(
|
||||
"ping_rtt_milliseconds",
|
||||
"The ping round trip time in milliseconds",
|
||||
&["target"],
|
||||
vec![0.5, 1.0, 5.0, 10.0, 15.0, 20.0, 25.0, 50.0, 75.0, 100.0, 150.0, 200.0, 250.0,
|
||||
300.0, 350.0, 400.0, 450.0, 500.0, 550.0, 600.0, 650.0, 700.0, 750.0, 800.0, 900.0,
|
||||
1000.0, 1250.0, 1500.0, 1750.0, 2000.0]
|
||||
).unwrap();
|
||||
}
|
||||
|
||||
pub(crate) fn start_pinging_hosts(config: &Config) {
|
||||
for (host, interval) in config.hosts.clone() {
|
||||
info!("Spawn ping task for {}", host);
|
||||
tokio::spawn(
|
||||
Interval::new(Instant::now(), Duration::from_millis(interval))
|
||||
.for_each(move |_| {
|
||||
let mut ping = Ping::new();
|
||||
ping.set_timeout(2.5);
|
||||
ping.add_host(&host);
|
||||
for response in match ping.send() {
|
||||
Ok(iterator) => iterator,
|
||||
Err(e) => {
|
||||
error!("Something went wrong sending the ping: {:?}", e);
|
||||
return Ok(());
|
||||
}
|
||||
}{
|
||||
if response.dropped > 0 {
|
||||
debug!("No response from host: {}", response.hostname);
|
||||
PING_HISTOGRAM
|
||||
.with_label_values(&[&host])
|
||||
.observe(2500.0)
|
||||
} else {
|
||||
debug!("Response from host {} (address {}): latency {} ms",
|
||||
response.hostname, response.address, response.latency_ms);
|
||||
trace!(" all details: {:?}", response);
|
||||
PING_HISTOGRAM
|
||||
.with_label_values(&[&host])
|
||||
.observe(response.latency_ms);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}).map_err(|_| ())
|
||||
);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user