Add ping probe support
Use liboping (new dependency) to add 'ping XXX' entries support in .cfg
file, where XXX can be either IP address or FQDN.
Sample output:
...
ping
ya.ru
IP: 2a02:6b8::2:242
dropped: 3/3
8.8.8.8
IP: 8.8.8.8
dropped: 0/3
latency: 20.4 ms
TTL: 120
...
N. B: to gather actual ping statistic we have to be able to send ICMP
requests (have enough privileges to work with RAW sockets).
Related: SYS#2655
Change-Id: Ife32540b532fb54368f63c78fb7837b84d4e8c76
diff --git a/src/osysmon.h b/src/osysmon.h
index 735b11e..df8bf8d 100644
--- a/src/osysmon.h
+++ b/src/osysmon.h
@@ -9,6 +9,7 @@
#include "value_node.h"
struct rtnl_client_state;
+struct ping_state;
struct osysmon_state {
struct rtnl_client_state *rcs;
@@ -18,6 +19,7 @@
struct llist_head netdevs;
/* list of 'struct osysmon_file' */
struct llist_head files;
+ struct ping_state *pings;
};
extern struct osysmon_state *g_oss;
@@ -28,6 +30,7 @@
CTRL_CLIENT_NODE = _LAST_OSMOVTY_NODE + 1,
CTRL_CLIENT_GETVAR_NODE,
NETDEV_NODE,
+ PING_NODE,
};
@@ -42,5 +45,8 @@
int osysmon_sysinfo_init();
int osysmon_sysinfo_poll(struct value_node *parent);
+int osysmon_ping_init();
+int osysmon_ping_poll(struct value_node *parent);
+
int osysmon_file_init();
int osysmon_file_poll(struct value_node *parent);