public PrtgResponse ReadOverview(dynamic data) { var response = new PrtgResponse(); // queue_totals response.result.Add(new PrtgResult { channel = "Total", unit = PrtgUnit.Count, value = ReadInt64(() => data.queue_totals.messages) }); response.result.Add(new PrtgResult { channel = "Ready", unit = PrtgUnit.Count, value = ReadInt64(() => data.queue_totals.messages_ready) }); response.result.Add(new PrtgResult { channel = "Unacked", unit = PrtgUnit.Count, value = ReadInt64(() => data.queue_totals.messages_unacknowledged) }); // message_stats response.result.Add(new PrtgResult { channel = "Publish per Second", unit = PrtgUnit.Custom, Float = 1, value = ReadDecimal(() => data.message_stats.publish_details.rate) }); response.result.Add(new PrtgResult { channel = "Deliver per Second", unit = PrtgUnit.Custom, Float = 1, value = ReadDecimal(() => data.message_stats.deliver_details.rate) }); response.result.Add(new PrtgResult { channel = "Ack per Second", unit = PrtgUnit.Custom, Float = 1, value = ReadDecimal(() => data.message_stats.ack_details.rate) }); response.result.Add(new PrtgResult { channel = "Confirm per Second", unit = PrtgUnit.Custom, Float = 1, value = ReadDecimal(() => data.message_stats.confirm_details.rate) }); // object_totals response.result.Add(new PrtgResult { channel = "Consumers", unit = PrtgUnit.Count, value = ReadInt64(() => data.object_totals.consumers) }); response.result.Add(new PrtgResult { channel = "Queues", unit = PrtgUnit.Count, value = ReadInt64(() => data.object_totals.queues) }); response.result.Add(new PrtgResult { channel = "Exchanges", unit = PrtgUnit.Count, value = ReadInt64(() => data.object_totals.exchanges) }); response.result.Add(new PrtgResult { channel = "Connections", unit = PrtgUnit.Count, value = ReadInt64(() => data.object_totals.connections) }); response.result.Add(new PrtgResult { channel = "Channels", unit = PrtgUnit.Count, value = ReadInt64(() => data.object_totals.channels) }); return(response); }
public PrtgResponse ReadNode(dynamic data, string nodeName) { var response = new PrtgResponse(); var nodes = data as IEnumerable; if (nodes == null) { return(new PrtgResponse()); } dynamic node = nodes.Cast <dynamic>().FirstOrDefault(x => x.name == nodeName); if (node == null) { return(new PrtgResponse()); } response.result.Add(new PrtgResult { channel = "Used Memory", unit = PrtgUnit.BytesMemory, value = ReadInt64(() => node.mem_used) }); response.result.Add(new PrtgResult { channel = "Disk Free", unit = PrtgUnit.BytesDisk, value = ReadInt64(() => node.disk_free) }); response.result.Add(new PrtgResult { channel = "Used File Descriptors", unit = PrtgUnit.Count, value = ReadInt64(() => node.fd_used) }); response.result.Add(new PrtgResult { channel = "Used Socket Descriptors", unit = PrtgUnit.Count, value = ReadInt64(() => node.sockets_used) }); response.result.Add(new PrtgResult { channel = "Used Erlang Processes", unit = PrtgUnit.Count, value = ReadInt64(() => node.proc_used) }); response.result.Add(new PrtgResult { channel = "Memory Alarm", unit = PrtgUnit.Count, value = (bool)node.mem_alarm ? "1" : "0" }); response.result.Add(new PrtgResult { channel = "Disk Free Alarm", unit = PrtgUnit.Count, value = (bool)node.disk_free_alarm ? "1" : "0" }); response.result.Add(new PrtgResult { channel = "Used Memory per Second", unit = PrtgUnit.BytesMemory, value = ReadInt64(() => node.mem_used_details.rate) }); response.result.Add(new PrtgResult { channel = "GC per Second", unit = PrtgUnit.Count, value = ReadInt64(() => node.gc_num_details.rate) }); response.result.Add(new PrtgResult { channel = "GC Bytes Reclaimed per Second", unit = PrtgUnit.BytesMemory, value = ReadInt64(() => node.gc_bytes_reclaimed_details.rate) }); response.result.Add(new PrtgResult { channel = "I/O Reads per Second", unit = PrtgUnit.Custom, Float = 1, value = ReadDecimal(() => node.io_read_count_details.rate) }); response.result.Add(new PrtgResult { channel = "I/O Writes per Second", unit = PrtgUnit.Custom, Float = 1, value = ReadDecimal(() => node.io_write_count_details.rate) }); response.result.Add(new PrtgResult { channel = "I/O Syncs per Second", unit = PrtgUnit.Custom, Float = 1, value = ReadDecimal(() => node.io_sync_count_details.rate) }); response.result.Add(new PrtgResult { channel = "I/O Seeks per Second", unit = PrtgUnit.Custom, Float = 1, value = ReadDecimal(() => node.io_seek_count_details.rate) }); response.result.Add(new PrtgResult { channel = "Reopened File Handle", unit = PrtgUnit.Custom, Float = 1, value = ReadDecimal(() => node.io_reopen_count) }); response.result.Add(new PrtgResult { channel = "Reopened File Handle per Second", unit = PrtgUnit.Custom, Float = 1, value = ReadDecimal(() => node.io_reopen_count_details.rate) }); response.result.Add(new PrtgResult { channel = "Opened File Handle per Second", unit = PrtgUnit.Custom, Float = 1, value = ReadDecimal(() => node.io_file_handle_open_attempt_count_details.rate) }); response.result.Add(new PrtgResult { channel = "I/O Read Time (ms)", unit = PrtgUnit.Custom, Float = 1, value = ReadDecimal(() => node.io_read_avg_time) }); response.result.Add(new PrtgResult { channel = "I/O Write Time (ms)", unit = PrtgUnit.Custom, Float = 1, value = ReadDecimal(() => node.io_write_avg_time) }); response.result.Add(new PrtgResult { channel = "I/O Sync Time (ms)", unit = PrtgUnit.Custom, Float = 1, value = ReadDecimal(() => node.io_sync_avg_time) }); response.result.Add(new PrtgResult { channel = "I/O Seek Time (ms)", unit = PrtgUnit.Custom, Float = 1, value = ReadDecimal(() => node.io_seek_avg_time) }); response.result.Add(new PrtgResult { channel = "File Handle Open Time (ms)", unit = PrtgUnit.Custom, Float = 1, value = ReadDecimal(() => node.io_file_handle_open_attempt_avg_time) }); return(response); }