Cleaner output if sections are empty

Even with a completely empty config we still get the following output:

root
  sysinfo
    load: 0.87/0.92/0.98
    ram: 243/168/0
    uptime: 1d 22:18:19
  netdev
  ping
  file
  shellcmd

With this patch the sections are skipped if there are no entries and the
command no sysinfo can be used to skip displaying the system
information.

Change-Id: I429fe7626b43aef74ff7458f5c2864888fa9a562
diff --git a/src/osysmon_ping.c b/src/osysmon_ping.c
index f736798..3484374 100644
--- a/src/osysmon_ping.c
+++ b/src/osysmon_ping.c
@@ -229,6 +229,10 @@
 	struct value_node *vn_host;
 	int num_host = iterator_count(g_oss->pings->ping_handle);
 	pingobj_iter_t *iter;
+
+	if (!num_host)
+		return 0;
+
 	struct value_node *vn_ping = value_node_add(parent, "ping", NULL);
 	if (!vn_ping)
 		return -ENOMEM;
@@ -257,8 +261,5 @@
 		add_ttl(iter, vn_host);
 	}
 
-	if (num_host)
-		return ping_send(g_oss->pings->ping_handle);
-
-	return 0;
+	return ping_send(g_oss->pings->ping_handle);
 }