/// <summary> /// prepares data to be sent and trigger sending event. /// </summary> /// <param name="data">EventData to be sent to Riemann</param> public void sendEvent(EventData data) { var message = new RiemannClient.Msg(); var e = new RiemannClient.Event { time =data.time, host = data.host, service = data.service, state = data.state, description = data.description, metric_d = data.metric_d, ttl = data.ttl }; if (data.tags != null) { foreach (string tag in data.tags) { e.tags.Add(tag); } } message.events.Add(e); var memoryStream = new MemoryStream(); Serializer.Serialize(memoryStream, message); var array = memoryStream.ToArray(); deliverEvent(array); }
static void Main(string[] args) { Riemann cli = new Riemann("10.40.8.11", 5555); while (true) { try { String[] tags = new string[] { "top10", "top5" }; long time = 9988; String host = "host"; String service = "servis"; String state = "durum"; String description = "açıklama"; float metric_f = 15; float ttl = 300; EventData data = new EventData(time, host, service, state, description, metric_f, ttl, tags); cli.sendEvent(data); } catch (Exception e) { Console.WriteLine(e.Message); } } }