00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "XrdMon/XrdMonArgParserConvert.hh"
00014 #include "XrdMon/XrdMonArgParser.hh"
00015 #include "XrdMon/XrdMonException.hh"
00016 #include "XrdSys/XrdSysHeaders.hh"
00017
00018 using std::cout;
00019 using std::endl;
00020 using namespace XrdMonArgParserConvert;
00021
00022
00023 int main(int argc, char* argv[])
00024 {
00025 #define OA XrdMonArgParser::ArgImpl
00026
00027 OA<const char*, Convert2String> arg_ctrLogDir ("-ctrLogDir", "./logs/collector");
00028 OA<const char*, Convert2String> arg_decLogDir ("-decLogDir", "./logs/decoder");
00029 OA<const char*, Convert2String> arg_rtLogDir ("-rtLogDir", "./logs/rt");
00030 OA<int, Convert2Int> arg_decFlushDel("-decFlushDelay", 600);
00031 OA<bool, ConvertOnOff> arg_rtOnOff ("-rt", 600);
00032 #undef OA
00033
00034 try {
00035 XrdMonArgParser argParser;
00036 argParser.registerExpectedArg(&arg_ctrLogDir);
00037 argParser.registerExpectedArg(&arg_decLogDir);
00038 argParser.registerExpectedArg(&arg_rtLogDir);
00039 argParser.registerExpectedArg(&arg_decFlushDel);
00040 argParser.registerExpectedArg(&arg_rtOnOff);
00041 argParser.parseArguments(argc, argv);
00042 } catch (XrdMonException& e) {
00043 e.printIt();
00044 cout << "Expected arguments:"
00045 << " [-ctrLogDir <path>]"
00046 << " [-decLogDir <path>]"
00047 << " [-rtLogDir <path>]"
00048 << " [-decFlushDelay <number>]"
00049 << " [-rt <on|off>]\n"
00050 << "where:\n"
00051 << " ctrLogDir is a directory where collector's log file are stored\n"
00052 << " decLogDir is a directory where decoder's log file are stored\n"
00053 << " rtLogDir is a directory where real time log file are stored\n"
00054 << " decFlushDelay is a value in sec specifying how often data is "
00055 << "flushed to collector's log files\n"
00056 << " -rt turns on/off real time monitoring. If off, rtLogDir ignored\n"
00057 << endl;
00058
00059 return 1;
00060 }
00061
00062 cout << "ctrLogDir is " << arg_ctrLogDir.myVal() << endl;
00063 cout << "decLogDir is " << arg_decLogDir.myVal() << endl;
00064 cout << "rtLogDir is " << arg_rtLogDir.myVal() << endl;
00065 cout << "decFlushDelay is " << arg_decFlushDel.myVal() << endl;
00066 cout << "rt monitoring is " << ( arg_rtOnOff.myVal()? "on" : " off") << endl;
00067
00068 return 0;
00069 }