Hello Team,
Found a crate "sys-info" for pulling up sys health.
Used sysinfo and riemann_client to pull boottime of machine and send it as
an event to riemann.
Reimann Log on Console.
#riemann.codec.Event{:host "hydrogen", :service "boottime", :state "OK",
:description nil, :metric 5154.0, :tags nil, :time 1.512866612126E9, :ttl
nil}
#riemann.codec.Event{:host "hydrogen", :service "boottime", :state "OK",
:description nil, :metric 6410.0, :tags nil, :time 1.512867867424E9, :ttl
nil}
Code is shared on github (
https://github.com/rk-projects/rust-riemann_health )
@Sanchayan,
getting few errors in adding attributes programatically. Currently using
your compiled crate. Will check this out today.
Regards,
Raj Kiran Gade
On Sun, Dec 10, 2017 at 4:10 AM Sanchayan Maity <[email protected]>
wrote:
> On Saturday, December 9, 2017 at 7:50:05 PM UTC+5:30, Sanchayan Maity
> wrote:
> > Hi,
> >
> > There is a rust riemann client available
> > https://github.com/borntyping/rust-riemann_client
> >
> > This seems to not implement the attributes property of an event. See the
> proto description below for event
> >
> https://github.com/borntyping/rust-riemann_client/blob/master/src/proto/mod.proto
> > From what I understand, riemann server understands this proto
> implementation. You just can't send anything over gRPC.
> >
> > The idea I had in mind was to use this client and implement whatever is
> missing. Once the client is complete (it is already capable of sending
> events) we can use this as library crate for all monitoring agents we want
> to write. The monitoring agents will only collect information and this
> client library can be used to send event streams to Riemann.
> >
> > Raj and me were looking into this. I am not sure if my idea is correct.
> Others are welcome to look into this.
> >
> > Regards,
> > Sanchayan.
>
> Below is the git diff of my changes. I guess it works.
> diff --git a/src/main.rs b/src/main.rs
> index dbf3bef..c5d2ff1 100644
> --- a/src/main.rs
> +++ b/src/main.rs
> @@ -11,6 +11,8 @@ extern crate protobuf;
> extern crate riemann_client;
> extern crate rustc_serialize;
>
> +use riemann_client::proto::Attribute;
> +
> static USAGE: &'static str = "
> Usage: riemann_cli [-HP] send [options]
> riemann_cli [-HP] query <query>
> @@ -89,7 +91,16 @@ fn main() {
> }
>
> if !args.flag_attribute.is_empty() {
> - unimplemented!();
> + let mut vec_attr: Vec<Attribute> = Vec::new();
> + let mut args_attr: Vec<String> = args.flag_attribute;
> + for attr in args_attr.iter_mut() {
> + let mut res: Vec<String> = attr.split("=").map(|s|
> s.to_string()).collect();
> + let mut at = riemann_client::proto::Attribute::new();
> + if let Some(x) = res.pop() { at.set_value(x) };
> + if let Some(x) = res.pop() { at.set_key(x) };
> + vec_attr.push(at);
> + }
> +
> event.set_attributes(protobuf::RepeatedField::from_vec(vec_attr));
> }
>
> println!("--> {{ {:?} }}", event);
>
> From riemann-health
> #riemann.codec.Event{:host "sanchayan-arch", :service "load", :state "ok",
> :description "1-minute load average/core is 0.2075", :metric 0.2075, :tags
> ["sanchayan"], :time 1512858320 <0151%20285%208320>, :ttl 10.0, :fosscafe
> "hello"}
>
> From rust riemann client
> #riemann.codec.Event{:host "sanchayan-arch", :service "riemann_cli",
> :state "ok", :description nil, :metric 11.0, :tags ["sanchayan"], :time
> 1.512858508201E9, :ttl nil, :fosscafe "hello"}
>
> The last part of putting in an attribute for the event was added to the
> main code. I was wrong in assuming that the attributes property of the
> event is not implemented. It is implemented using set_attributes method,
> only that the cli client never parsed it from command line.
>
> This crate should be usable to send the "event" stream by allowing us to
> set any set any of the fields in the "event" as defined by the proto and
> then sending it using the tcp transport layer implementation of the crate.
>
> I guess what remains is the implementation of data parsers for whatever
> data we want to send to riemann for example, in case of riemann-health for
> CPU load we would parse /proc/stat.
>
> Regards,
> Sanchayan.
>
> --
> https://meetup.com/rustox
> ---
> You received this message because you are subscribed to the Google Groups
> "Rust Bangalore Community" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/rustox.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/rustox/76bd544f-d406-44cb-b908-962c82e1d416%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
Regards,
Raj Kiran Gade
--
https://meetup.com/rustox
---
You received this message because you are subscribed to the Google Groups "Rust
Bangalore Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/rustox.
To view this discussion on the web visit
https://groups.google.com/d/msgid/rustox/CAAva_QcDv%2BTtaUq19Jfo%2BLe-PXRzC1fy4F50bMEKHf56Do6Lcg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.