From eedca2990e249e7192a3374b8d12b940d6f523ae Mon Sep 17 00:00:00 2001 From: Qiuwen Lu Date: Sat, 19 Sep 2020 15:59:14 +0800 Subject: 调整CMakeLists.txt,增加APM服务的定义、样例配置文件。 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmake/Package.cmake | 1 + conf/CMakeLists.txt | 1 + conf/mrapm.conf | 4 ++++ tools/monit_device/monit_device.py | 2 +- tools/monit_stream/monit_stream.py | 2 +- tools/systemd/CMakeLists.txt | 8 ++++++-- tools/systemd/mrapm_device.service.in | 13 +++++++++++++ tools/systemd/mrapm_stream.service.in | 12 ++++++++++++ 8 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 conf/mrapm.conf create mode 100644 tools/systemd/mrapm_device.service.in create mode 100644 tools/systemd/mrapm_stream.service.in diff --git a/cmake/Package.cmake b/cmake/Package.cmake index 37ea68a..2531aa6 100644 --- a/cmake/Package.cmake +++ b/cmake/Package.cmake @@ -34,5 +34,6 @@ endif() # setup %config(noreplace) set(CPACK_RPM_USER_FILELIST "%config(noreplace) ${CMAKE_INSTALL_PREFIX}/etc/mrglobal.conf" "%config(noreplace) ${CMAKE_INSTALL_PREFIX}/etc/mrtunnat.conf" + "%config(noreplace) ${CMAKE_INSTALL_PREFIX}/etc/mrapm.conf" "%config(noreplace) /etc/sysconfig/mrzcpd") include(CPack) diff --git a/conf/CMakeLists.txt b/conf/CMakeLists.txt index b0c0eba..e4d76c8 100644 --- a/conf/CMakeLists.txt +++ b/conf/CMakeLists.txt @@ -6,6 +6,7 @@ configure_file(mrzcpd.sh.in mrzcpd.sh) install(FILES mrglobal.conf DESTINATION etc COMPONENT Profile) install(FILES mrtunnat.conf DESTINATION etc COMPONENT Profile) +install(FILES mrapm.conf DESTINATION etc COMPONENT Profile) install(FILES ${CMAKE_BINARY_DIR}/conf/mrzcpd.conf DESTINATION ${MR_INSTALL_LDCONFDIR} COMPONENT Profile) install(FILES ${CMAKE_BINARY_DIR}/conf/mrzcpd.pc DESTINATION ${MR_INSTALL_LIBDIR}/pkgconfig COMPONENT Profile) install(FILES ${CMAKE_BINARY_DIR}/conf/mrzcpd DESTINATION ${MR_INSTALL_SYSUNITCONFDIR} COMPONENT Profile) diff --git a/conf/mrapm.conf b/conf/mrapm.conf new file mode 100644 index 0000000..d4ae4f1 --- /dev/null +++ b/conf/mrapm.conf @@ -0,0 +1,4 @@ +[sendlog_apm] +apm_device_server=udp://127.0.0.1:8100 +apm_stream_server=udp://127.0.0.1:8100 +apm_send_interval=15 \ No newline at end of file diff --git a/tools/monit_device/monit_device.py b/tools/monit_device/monit_device.py index 299f81b..4e82bcc 100644 --- a/tools/monit_device/monit_device.py +++ b/tools/monit_device/monit_device.py @@ -142,7 +142,7 @@ def setup_argv_parser(phydev_list): parser.add_argument('--sendlog-apm', help='send log to apm server', action='store_true', default=0) parser.add_argument('--sendlog-apm-cfg', help='send log configure file', - type=str, default='/opt/mrzcpd/etc/mrsendlog.conf') + type=str, default='/opt/mrzcpd/etc/mrapm.conf') return parser.parse_args() diff --git a/tools/monit_stream/monit_stream.py b/tools/monit_stream/monit_stream.py index e7a5840..9175ef0 100644 --- a/tools/monit_stream/monit_stream.py +++ b/tools/monit_stream/monit_stream.py @@ -291,7 +291,7 @@ def setup_argv_parser(applist): parser.add_argument('--sendlog-apm', help='send log to apm server', action='store_true', default=0) parser.add_argument('--sendlog-apm-cfg', help='send log configure file', - type=str, default='/opt/mrzcpd/etc/mrsendlog.conf') + type=str, default='/opt/mrzcpd/etc/mrapm.conf') return parser.parse_args() diff --git a/tools/systemd/CMakeLists.txt b/tools/systemd/CMakeLists.txt index 96022a6..ea91982 100644 --- a/tools/systemd/CMakeLists.txt +++ b/tools/systemd/CMakeLists.txt @@ -1,7 +1,8 @@ configure_file(mrenv.service.in mrenv.service) configure_file(mrzcpd.service.in mrzcpd.service) configure_file(mrtunnat.service.in mrtunnat.service) -configure_file(mrmonit.service.in mrmonit.service) +configure_file(mrapm_device.service.in mrapm_device.service) +configure_file(mrapm_stream.service.in mrapm_stream.service) install(FILES ${CMAKE_BINARY_DIR}/tools/systemd/mrenv.service DESTINATION ${MR_INSTALL_SYSUNITDIR} COMPONENT Program) @@ -12,7 +13,10 @@ install(FILES ${CMAKE_BINARY_DIR}/tools/systemd/mrzcpd.service install(FILES ${CMAKE_BINARY_DIR}/tools/systemd/mrtunnat.service DESTINATION ${MR_INSTALL_SYSUNITDIR} COMPONENT Program) -install(FILES ${CMAKE_BINARY_DIR}/tools/systemd/mrmonit.service +install(FILES ${CMAKE_BINARY_DIR}/tools/systemd/mrapm_device.service + DESTINATION ${MR_INSTALL_SYSUNITDIR} COMPONENT Program) + +install(FILES ${CMAKE_BINARY_DIR}/tools/systemd/mrapm_stream.service DESTINATION ${MR_INSTALL_SYSUNITDIR} COMPONENT Program) install(PROGRAMS mrenv-script DESTINATION bin COMPONENT Program) \ No newline at end of file diff --git a/tools/systemd/mrapm_device.service.in b/tools/systemd/mrapm_device.service.in new file mode 100644 index 0000000..ab24e07 --- /dev/null +++ b/tools/systemd/mrapm_device.service.in @@ -0,0 +1,13 @@ +[Unit] +Description=Marsio APM logwritter(monit_device) +After=network.target + +[Service] +Type=simple +ExecStartPre=/usr/bin/systemctl is-active mrzcpd +ExecStart=@MR_INSTALL_BINDIR@/monit_device -l --sendlog-apm +RestartSec=10s +Restart=always + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/tools/systemd/mrapm_stream.service.in b/tools/systemd/mrapm_stream.service.in new file mode 100644 index 0000000..98e31fb --- /dev/null +++ b/tools/systemd/mrapm_stream.service.in @@ -0,0 +1,12 @@ +[Unit] +Description=Marsio APM logwritter(monit_stream) +After=network.target + +[Service] +Type=simple +ExecStart=@MR_INSTALL_BINDIR@/monit_stream -l --sendlog-apm -m rx tx ftx +RestartSec=10s +Restart=always + +[Install] +WantedBy=multi-user.target \ No newline at end of file -- cgit v1.2.3