fault/fm-mgr/sources/fm_main.cpp
Tao Liu c8159ea6cb Decouple Fault Management from stx-config
Create fault management REST API service
Create fault management client and CLI shell
Add a python extension for fault management application APIs
Update fault management python APIs to use the python extension
Update fault manager to retrieve the SNMP configuration from the config file

Story: 2002828
Task: 22747

Depends-On: https://review.openstack.org/#/c/592176/
Change-Id: I888d8d23edf75d05d51594ccca55570ae366c848
Signed-off-by: Tao Liu <tao.liu@windriver.com>
2018-08-16 13:23:33 -04:00

55 lines
906 B
C++

//
// Copyright (c) 2014 Wind River Systems, Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <unistd.h>
#include <signal.h>
#include <syslog.h>
#include <fmAPI.h>
#include <fmConfig.h>
#include <fmLog.h>
void sig_handler(int signo) {
if (signo == SIGHUP){
fm_get_config_paramters();
fmLoggingInit();
}
}
int main(int argc, char *argv[]) {
int c;
const char *fn = NULL;
if (argc < 3) {
syslog(LOG_ERR, "Wrong arguments\n");
exit(-1);
}
while ((c=getopt(argc,argv,"c:")) != -1) {
switch(c) {
case 'c':
fn = optarg;
break;
default:
syslog(LOG_ERR, "Invalid option...\n");
exit(-1);
}
}
/* ignore SIGPIPE */
signal(SIGPIPE, SIG_IGN);
if (signal(SIGHUP, sig_handler) == SIG_ERR){
syslog(LOG_INFO, "Can't catch SIGHUP\n");
}
fm_server_create(fn);
exit(0);
}