diff options
| author | Qiuwen Lu <[email protected]> | 2017-07-18 18:50:33 +0800 |
|---|---|---|
| committer | Qiuwen Lu <[email protected]> | 2017-07-18 18:50:33 +0800 |
| commit | 0639f75a2bcd4bd39834e0d2e5706827f52c07c5 (patch) | |
| tree | fa47b6234fba23d36ae625ddd07c84d71cad97a7 /app/src/monit.c | |
| parent | 5b20219049145a3239a60be8a5335de19d4e5fe3 (diff) | |
增加ARP邻居子系统的状态输出功能,支持查看IP地址与MAC地址的对应关系。
Diffstat (limited to 'app/src/monit.c')
| -rw-r--r-- | app/src/monit.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/app/src/monit.c b/app/src/monit.c index 03747f4..a4dc2f8 100644 --- a/app/src/monit.c +++ b/app/src/monit.c @@ -202,20 +202,28 @@ static cJSON * monit_root(struct mr_instance * instance) cJSON_AddItemToObject(j_root, "appinfo", monit_app_info(instance)); cJSON_AddItemToObject(j_root, "raw", monit_vdev(instance)); cJSON_AddItemToObject(j_root, "appstat", monit_app_stat(instance)); + + if (instance->neigh != NULL) + { + struct cJSON * j_monit_neigh = neighbour_manager_monit(instance->neigh); + cJSON_AddItemToObject(j_root, "neigh", j_monit_neigh); + } + return j_root; } int mrapp_monit_loop(struct mr_instance * instance) { - FILE * fp_monit = fopen(instance->monit_file_path, "w"); - if (fp_monit == NULL) - { - MR_WARNING("monit file %s open failed, cannot dump program stat info : %s", - instance->monit_file_path, strerror(errno)); return 0; - } - cJSON * j_root = monit_root(instance); char * str_json_print = cJSON_Print(j_root); + + FILE * fp_monit = fopen(instance->monit_file_path, "w"); + if (fp_monit == NULL) + { + MR_WARNING("monit file %s open failed, cannot dump program stat info : %s", + instance->monit_file_path, strerror(errno)); return 0; + } + fprintf(fp_monit, "%s", str_json_print); free(j_root); fclose(fp_monit); |
