summaryrefslogtreecommitdiff
path: root/roles/tsg-cli-mxn
diff options
context:
space:
mode:
authorzhangzhihan <[email protected]>2020-12-16 19:23:21 +0600
committerzhangzhihan <[email protected]>2020-12-16 19:23:21 +0600
commit7cfb1254b351c24c9c7264ab55c941fb509c494c (patch)
tree57f0537526a74e27d6a4864c66bac21cac8fe46d /roles/tsg-cli-mxn
parent465622889c26809b2e9c52d535412a18b3293f1f (diff)
设备管理21.01临时版本,oam-core和oam-snmp还未更新devmgmt_version21.01-deploy
Diffstat (limited to 'roles/tsg-cli-mxn')
-rw-r--r--roles/tsg-cli-mxn/files/tsg-monitor.sh12
-rw-r--r--roles/tsg-cli-mxn/files/tsg_cluster_register.service14
-rw-r--r--roles/tsg-cli-mxn/tasks/main.yml21
-rw-r--r--roles/tsg-cli-mxn/templates/tsg_cli_env.ini.j215
4 files changed, 52 insertions, 10 deletions
diff --git a/roles/tsg-cli-mxn/files/tsg-monitor.sh b/roles/tsg-cli-mxn/files/tsg-monitor.sh
index 3205950..6ae3525 100644
--- a/roles/tsg-cli-mxn/files/tsg-monitor.sh
+++ b/roles/tsg-cli-mxn/files/tsg-monitor.sh
@@ -8,21 +8,17 @@
#导致10秒内还不结束, 要强行杀掉,
#否则长时间运行后, 会有大量后台进程运行!
killall_uncompleted_cmd(){
- killall -9 -q tsg_cluster_register
+ #killall -9 -q tsg_cluster_register
#killall -9 -q tsg_diagnose_background
#killall -9 -q tsg_update_tags
-
- cmd_run=`ps -ef | grep tsg_ | grep -v grep`
- if [ ${#cmd_run} -lt 1 ] ; then
- #在没有其他tsg_xxx命令正在执行时, 删除执行命令错误被强制kill时, python生成的临时文件
- rm -rf /tmp/_MEI*
- fi
+ /opt/tsg/tsg-monitor/tsg_monitor_cleanup_tmp.sh
}
start_background_cmd(){
+ mkdir -p /tmp/__tsg_monitor_tmp_dir
#后台并发运行, 保证所有命令的开始运行时间基本一样,
#且不会因某个命令网络拥塞、执行时间长等问题,阻塞while(1)主循环
- /opt/tsg/tsg-monitor/tsg_cluster_register > /dev/null &
+ #/opt/tsg/tsg-monitor/tsg_cluster_register > /dev/null &
#mxn板只检测cpu, mem, disk等, 前台cli命令启用diagnose,
#后台服务依靠oam snmp模块, 无需运行tsg_diagnose_background
diff --git a/roles/tsg-cli-mxn/files/tsg_cluster_register.service b/roles/tsg-cli-mxn/files/tsg_cluster_register.service
new file mode 100644
index 0000000..8c6add7
--- /dev/null
+++ b/roles/tsg-cli-mxn/files/tsg_cluster_register.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=TSG Device register to consul
+Requires=consul-client.service
+After=consul-client.service
+
+[Service]
+ExecStartPre=/usr/bin/mkdir -p /tmp/__tsg_monitor_tmp_dir
+ExecStart=/opt/tsg/tsg-monitor/tsg_cluster_register
+Type=oneshot
+RemainAfterExit=yes
+
+
+[Install]
+WantedBy=multi-user.target \ No newline at end of file
diff --git a/roles/tsg-cli-mxn/tasks/main.yml b/roles/tsg-cli-mxn/tasks/main.yml
index 8577032..7c32a82 100644
--- a/roles/tsg-cli-mxn/tasks/main.yml
+++ b/roles/tsg-cli-mxn/tasks/main.yml
@@ -74,11 +74,15 @@
dest: "/opt/tsg/etc/tsg_series.json"
tags: template
-
- name: "copy tsg-monitor.service to destination server"
synchronize:
src: "{{ role_path }}/files/tsg-monitor.service"
dest: "/usr/lib/systemd/system"
+
+- name: "copy tsg_cluster_register.service to destination server"
+ synchronize:
+ src: "{{ role_path }}/files/tsg_cluster_register.service"
+ dest: "/usr/lib/systemd/system"
- name: "copy tsg-monitor.sh to destination server"
copy:
@@ -91,14 +95,27 @@
src: "{{ role_path }}/files/rsyslog.conf"
dest: "/etc/"
+- name: "copy tsg_monitor_cleanup_tmp.sh to destination server"
+ synchronize:
+ src: "{{ role_path }}/../tsg-common-files/tsg_monitor_cleanup_tmp.sh"
+ dest: "/opt/tsg/tsg-monitor/"
+ mode: 0755
+
- name: "restart rsyslog service"
systemd:
name: rsyslog
state: restarted
-
+
- name: "enable tsg-monitor service"
systemd:
name: tsg-monitor
enabled: yes
daemon_reload: yes
+ state: restarted
+
+- name: "enable tsg_cluster_register.service"
+ systemd:
+ name: tsg_cluster_register
+ enabled: yes
+ daemon_reload: yes
state: restarted
diff --git a/roles/tsg-cli-mxn/templates/tsg_cli_env.ini.j2 b/roles/tsg-cli-mxn/templates/tsg_cli_env.ini.j2
index f928a12..04412e0 100644
--- a/roles/tsg-cli-mxn/templates/tsg_cli_env.ini.j2
+++ b/roles/tsg-cli-mxn/templates/tsg_cli_env.ini.j2
@@ -17,3 +17,18 @@ fs2_stat_file=/home/mesasoft/sapp_run/fs2_kni.status
[tfe]
fs2_stat_file=/var/log/tfe/tfe.fs2
+
+
+
+[threshold]
+#means percent, n%
+cpu_critical_high={{ oam.alarm_cpu_critical_high }}
+cpu_major_high={{ oam.alarm_cpu_major_high }}
+mem_critical_high={{ oam.alarm_mem_critical_high }}
+mem_major_high={{ oam.alarm_mem_major_high }}
+disk_critical_high={{ oam.alarm_disk_critical_high }}
+disk_major_high={{ oam.alarm_disk_major_high }}
+interface_critical_high={{ oam.alarm_interface_critical_high }}
+interface_major_high={{ oam.alarm_interface_major_high }}
+app_network_critical_high={{ oam.alarm_app_network_critical_high }}
+app_network_major_high={{ oam.alarm_app_network_major_high }} \ No newline at end of file