= monitor = Monitor and save log output from servers == Usage == monitor [options] {{{ Monitor one or several processes within Tcs. Options: --version show program's version number and exit -h, --help show this help message and exit -D, --daemon start in the background as a daemon. -A, --All catch all possible server output. -a, --apc catch the apc server output. -t, --tracker catch the tracker server output. -T, --tcs catch the tcs server output. -p, --pas catch the pas server output. -P, --pfip catcj the pfip server output. -L, --legacy catch the legacy system output. -l, --lrs2 send a command to the lrs2 system (default help()). -V, --vdas send a command to the vdas system (default help()). -r, --log-relay catch the logging relay server output. -v, --verbose Send output to stdout as well as the output file. -o FILE, --output=FILE Send output to FILE -d FILE, --db-file=FILE Send output to database FILE -m rwx, --mode=rwx Set permissions on the log db output file to "rwx". --system-filter=SYSTEM_FILTER Specify filters on the system.. --source-filter=SOURCE_FILTER Specify filters on the source --key-filter=KEY_FILTER Specify filters on the key. --log-print print formatted output like on a console. }}} == Description: == The **monitor** program listens for broadcast events from the servers specified and writes the events to an SQLite database file with the `--db-file` flag or a text file using the `--output-file` or the standard output or any combination of these three outputs. An event has a name comprised of `system.source.key` where source will be something like `tcs`, `tracker`, or `pas`, etc. These fields may be used as sorting filters when selecting certain events. The **monitor** function launches an instance of **tcs_monitor** with the appropriate command line flags. == Output == If either the `--verbose` flag and/or the `-output-file` flag are enabled that the events are written to standard out or a file as they are received. The output will look something like this. {{{ $ monitor -v -V Press Cntl-C to exit servers 2017-02-14T16:20:12.499 INFO [tcs_config.cpp :configure : 101] - Parsing command line arguments (looking for a config file)... 2017-02-14T16:20:13.044 INFO [tcs_app.h :run : 78] - Configuration complete. 2017-02-14T16:20:13.044 INFO [tcs_app.h :run : 79] - tcs_monitor-r7233 2017-02-06T22:40:19.000 2017-02-14T16:20:13.044 INFO [tcs_app.h :run : 80] - Linux 2.6.32-642.13.1.el6.x86_64 2017-02-14T16:20:13.044 INFO [tcs_config.cpp :lookupRoute : 346] - TCSNamed lookup of monitor-route returned 'tcp://192.168.66.47:30200' 2017-02-14T16:20:13.045 INFO [tcs_app.h :run : 81] - Using route: tcp://192.168.66.47:30200 2017-02-14T16:20:13.045 INFO [tcs_config.cpp :lookupEventRoute : 354] - TCSNamed lookup of monitor-event-route returned 'tcp://192.168.66.47:30201' 2017-02-14T16:20:13.045 INFO [tcs_app.h :run : 82] - Using event-route: tcp://192.168.66.47:30201 2017-02-14T16:20:13.045 INFO [tcs_config.cpp :lookupEventRoute : 354] - TCSNamed lookup of monitor-event-route returned 'tcp://192.168.66.47:30201' 2017-02-14T16:20:13.145 INFO [tcs_config.cpp :lookupEventRoute : 354] - TCSNamed lookup of virus-event-route returned 'tcp://192.168.66.40:31301' 2017-02-14T16:20:13.246 INFO [s_monitor_driver.cpp:message_thread : 90] - Accepting commands... { "time": "2017-02-14T16:20:18.024", "virus.receiver.heartbeat": { "ru_utime": "39.000962924", "ru_stime": "80.000867706", "ru_maxrss": 426820, "ru_ixrss": 0, "ru_idrss": 0, "ru_isrss": 0, "ru_minflt": 689045, "ru_majflt": 0, "ru_nswap": 0, "ru_inblock": 0, "ru_oublock": 936, "ru_msgsnd": 0, "ru_msgrcv": 0, "ru_nsignals": 0, "ru_nvcsw": 1421372, "ru_nivcsw": 3296, "__system": "virus", "__source": "receiver", "__key": "heartbeat", "__data_time": "1487089218.024568830", "__wire_time": "1487089218.024585954", "__data": "false", "__pid": 24003 } } { "time": "2017-02-14T16:20:23.030", "virus.receiver.heartbeat": { "ru_utime": "39.000962924", "ru_stime": "80.000868706", "ru_maxrss": 426820, "ru_ixrss": 0, "ru_idrss": 0, "ru_isrss": 0, "ru_minflt": 689045, "ru_majflt": 0, }}} If the `--log-print` option is given, then the output will look like the console output and only the log_* events will be shown. {{{ $ monitor --log-print -T -v Press Cntl-C to exit servers 2017-02-14T16:20:53.762 INFO [tcs_config.cpp :configure : 101] - Parsing command line arguments (looking for a config file)... 2017-02-14T16:20:54.305 INFO [tcs_app.h :run : 78] - Configuration complete. 2017-02-14T16:20:54.305 INFO [tcs_app.h :run : 79] - tcs_monitor-r7233 2017-02-06T22:40:19.000 2017-02-14T16:20:54.305 INFO [tcs_app.h :run : 80] - Linux 2.6.32-642.13.1.el6.x86_64 2017-02-14T16:20:54.306 INFO [tcs_config.cpp :lookupRoute : 346] - TCSNamed lookup of monitor-route returned 'tcp://192.168.66.47:30200' 2017-02-14T16:20:54.306 INFO [tcs_app.h :run : 81] - Using route: tcp://192.168.66.47:30200 2017-02-14T16:20:54.306 INFO [tcs_config.cpp :lookupEventRoute : 354] - TCSNamed lookup of monitor-event-route returned 'tcp://192.168.66.47:30201' 2017-02-14T16:20:54.306 INFO [tcs_app.h :run : 82] - Using event-route: tcp://192.168.66.47:30201 2017-02-14T16:20:54.306 INFO [tcs_config.cpp :lookupEventRoute : 354] - TCSNamed lookup of monitor-event-route returned 'tcp://192.168.66.47:30201' 2017-02-14T16:20:54.407 INFO [tcs_config.cpp :lookupEventRoute : 354] - TCSNamed lookup of tcs-event-route returned 'tcp://192.168.66.31:30301' 2017-02-14T16:20:54.508 INFO [s_monitor_driver.cpp:message_thread : 90] - Accepting commands... 2017-02-14T20:48:54.011 INFO [pfip_client.cpp :clear_positions : 280] - Clearing probe positions. 2017-02-14T21:41:03.192 INFO [tcs_driver.cpp :~TCSDriver : 56] - tcs is shutting down... 2017-02-14T21:41:03.192 INFO [tcs_driver.cpp :~TCSDriver : 63] - tcs has shutdown 2017-02-14T21:42:19.703 ERROR [weather_client.h :WeatherClient : 27] - Error initializing weather client, using nominal values: Timeout waiting for message ID 1 ACK, spent 5.000098 seconds. Receiver for weather is likely offline. 2017-02-14T21:42:25.208 INFO [tcs_driver.cpp :start : 115] - Accepting commands... 2017-02-14T21:44:01.968 INFO [tcs_driver.cpp :~TCSDriver : 56] - tcs is shutting down... 2017-02-14T21:44:03.968 INFO [tcs_driver.cpp :~TCSDriver : 63] - tcs has shutdown }}}