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_main.c b/src/osysmon_main.c
index 82df61f..eb4f50b 100644
--- a/src/osysmon_main.c
+++ b/src/osysmon_main.c
@@ -193,7 +193,7 @@
int main(int argc, char **argv)
{
- int rc;
+ int rc, ping_init;
osmo_init_logging2(NULL, &log_info);
@@ -207,6 +207,7 @@
osysmon_sysinfo_init();
osysmon_ctrl_init();
osysmon_rtnl_init();
+ ping_init = osysmon_ping_init();
osysmon_file_init();
rc = vty_read_config_file(cmdline_opts.config_file, NULL);
@@ -233,6 +234,10 @@
osysmon_sysinfo_poll(root);
osysmon_ctrl_poll(root);
osysmon_rtnl_poll(root);
+
+ if (ping_init == 0)
+ osysmon_ping_poll(root);
+
osysmon_file_poll(root);
display_update(root);