+
+ /***** initialize the monitoring interface instance *****/
+ if (NULL == (tr->mons = mons_new(tr))) {
+ tr_crit("Error initializing monitoring interface instance.");
+ return 1;
+ }
+ /* Monitor our tids/trps instances */
+ tr->mons->tids = tr->tids;
+ tr->mons->trps = tr->trps;
+
+ /* Register monitoring handlers */
+ mons_register_handler(tr->mons, MON_CMD_SHOW, OPT_TYPE_SHOW_VERSION, tr_handle_version, NULL);
+ mons_register_handler(tr->mons, MON_CMD_SHOW, OPT_TYPE_SHOW_CONFIG_FILES, tr_handle_show_cfg_serial, tr->cfg_mgr);
+ mons_register_handler(tr->mons, MON_CMD_SHOW, OPT_TYPE_SHOW_UPTIME, tr_handle_uptime, &start_time);
+ mons_register_handler(tr->mons, MON_CMD_SHOW, OPT_TYPE_SHOW_RP_CLIENTS, tr_handle_show_rp_clients, tr->cfg_mgr);
+ tr_tid_register_mons_handlers(tr->tids, tr->mons);
+ tr_trp_register_mons_handlers(tr->trps, tr->mons);
+
+ /***** process configuration *****/
+ tr->cfgwatch=tr_cfgwatch_create(tr);
+ if (tr->cfgwatch == NULL) {
+ tr_crit("Unable to create configuration watcher object, exiting.");
+ return 1;
+ }
+ tr->cfgwatch->config_dir=opts.config_dir;
+ tr->cfgwatch->cfg_mgr=tr->cfg_mgr;
+ tr->cfgwatch->update_cb=tr_config_changed; /* handle configuration changes */
+ tr->cfgwatch->update_cookie=(void *)tr;
+ if (0 != tr_read_and_apply_config(tr->cfgwatch)) {
+ tr_crit("Error reading configuration, exiting.");
+ return 1;