diff --git a/cluster_deploy.yml b/cluster_deploy.yml index d85cbda..4677b82 100644 --- a/cluster_deploy.yml +++ b/cluster_deploy.yml @@ -2,8 +2,7 @@ roles: - oam_cluster - consul-cluster - # mariadb复用毕方 - #- mariadb + - mariadb - influxdb - ha_master @@ -11,8 +10,7 @@ roles: - oam_cluster - consul-cluster - # mariadb复用毕方 - #- mariadb + - mariadb - influxdb - ha_backup diff --git a/install_config/group_vars/all.yml b/install_config/group_vars/all.yml index dcc6633..ebe8974 100644 --- a/install_config/group_vars/all.yml +++ b/install_config/group_vars/all.yml @@ -28,21 +28,31 @@ consul: mariadb: username: root - password: 111111 + password: tsg2019 cluster_password: tsg369258 cluster_ip: "10.4.62.251" oam: cluster_port: 880 - core_port: 880 - cli_agent_port: 822 + core_port: 1180 + cli_agent_port: 1122 snmp_port: 1611 snmptrapd_ip: "127.0.0.1" snmptrapd_port: 164 mcn0_ip: "192.168.100.1" - + alarm_cpu_critical_high: 90 + alarm_cpu_major_high: 85 + alarm_mem_critical_high: 90 + alarm_mem_major_high: 85 + alarm_disk_critical_high: 90 + alarm_disk_major_high: 85 + alarm_interface_critical_high: "0.0005" + alarm_interface_major_high: "0.0001" + alarm_app_network_critical_high: "0.0005" + alarm_app_network_major_high: "0.0001" + tsg_cli: - rpm_file_name: "tsg-cli-1.1.1.ea016fc-1.el7.x86_64.rpm" + rpm_file_name: "tsg-cli-1.1.8.dc13c5d-1.el7.x86_64.rpm" ha_master: instance_state: MASTER @@ -57,7 +67,7 @@ ha_backup: oam_virtual_router_id: 54 java_version: jdk1.8.0_73 -bifang_api_ip: "10.4.62.252" +bifang_api_ip: "192.168.44.71" bifang_api_port: 8080 tag_location: "Nur-sultan" diff --git a/roles/mariadb/files/my.cnf b/roles/mariadb/files/my.cnf index 382cb34..d3d9bc3 100644 --- a/roles/mariadb/files/my.cnf +++ b/roles/mariadb/files/my.cnf @@ -19,45 +19,78 @@ [client] #password = your_password port = 3306 -socket = /tmp/mysql.sock +socket = /var/lib/mysql/mysql.sock +default-character-set = utf8mb4 # Here follows entries for some specific programs # The MySQL server [mysqld] +basedir=/home/cries/mysql +datadir=/home/cries/dbdata +#timezone test +#default-time_zone = '+6:00' +#relay_log=/home/ceiec/mariadb/binlogs/master-bin/relay-log +#log_bin=/home/ceiec/mariadb/relaylogs/relay-bin/master-log +binlog_format=mixed +auto-increment-offset=1 +auto-increment-increment=2 +log_bin_trust_function_creators=1 +log_slave_updates=true +sync_binlog=0 +binlog-checksum=CRC32 +master-verify-checksum=1 +slave-sql-verify-checksum=1 +slave-skip-errors=all +relay_log_recovery=1 +port = 3306 +#datadir = /home/dbdata +innodb_file_per_table = on +skip_name_resolve = on +lower_case_table_names = 1 +character-set-server = utf8mb4 +character-set-client-handshake = FALSE +#slow_query_log_file = /home/mariadb/logs/slow_query.log +#log_error = /home/mariadb/host01.err +socket = /var/lib/mysql/mysql.sock skip-external-locking -thread_stack = 256K -table_cache = 128K -sort_buffer_size = 6M +back_log = 384 +key_buffer_size = 256M +max_allowed_packet = 4M +table_open_cache = 512 +thread_stack = 256K +table_cache = 128K +sort_buffer_size = 6M read_buffer_size = 4M -read_rnd_buffer_size = 8M -myisam_sort_buffer_size = 64M -thread_cache_size = 8 -query_cache_size = 32M +read_rnd_buffer_size = 8M +myisam_sort_buffer_size = 64M +thread_cache_size = 8 +query_cache_size = 32M join_buffer_size = 8M -# Try number of CPU's*2 for thread_concurrency +# Try number of CPU's*2 for thread_concurrency thread_concurrency = 8 wait_timeout=2880000 -interactive_timeout = 2880000 +interactive_timeout = 2880000 max_allowed_packet = 200M -max_connections = 1500 -open-files-limit = 10240 -key_buffer_size=256M -back_log = 512 -table_open_cache=2048 -innodb_file_per_table= 1 -innodb_buffer_pool_size = 2048M -innodb_log_file_size = 1024M -innodb_log_buffer_size = 16M -innodb_flush_log_at_trx_commit = 2 -innodb_flush_method = 'O_DIRECT' -innodb_max_dirty_pages_pct = 90 -innodb_log_file_size = 100M -innodb_log_buffer_size = 1G -innodb_buffer_pool_instances = 1 -innodb_flush_log_at_trx_commit = 1 -# Try number of CPU's*2 for thread_concurrency +max_connections = 1500 +open-files-limit = 10240 + + +key_buffer_size=256M +back_log = 512 +table_open_cache=2048 + +innodb_file_per_table= 1 +innodb_buffer_pool_size = 2048M + +innodb_log_file_size = 1024M +innodb_log_buffer_size = 16M + +innodb_flush_log_at_trx_commit = 2 +innodb_flush_method = 'O_DIRECT' + +innodb_max_dirty_pages_pct = 90 # Point the following paths to a dedicated disk #tmpdir = /tmp/ @@ -145,10 +178,11 @@ server-id = 1 # of RAM but beware of setting memory usage too high #innodb_buffer_pool_size = 384M # Set .._log_file_size to 25 % of buffer pool size -#innodb_log_file_size = 100M -#innodb_log_buffer_size = 8M -#innodb_flush_log_at_trx_commit = 1 -#innodb_lock_wait_timeout = 50 +innodb_log_file_size = 100M +innodb_log_buffer_size = 1G +innodb_buffer_pool_instances = 1 +innodb_flush_log_at_trx_commit = 1 +innodb_lock_wait_timeout = 50 [mysqldump] quick diff --git a/roles/mariadb/tasks/main.yml b/roles/mariadb/tasks/main.yml index 57df61a..6736352 100644 --- a/roles/mariadb/tasks/main.yml +++ b/roles/mariadb/tasks/main.yml @@ -114,6 +114,11 @@ shell: cp -rf /home/database/mysql/bin/mysqladmin /usr/local/bin when: return.rc != 0 +- name: "copy my.cnf" + copy: + src: "{{ role_path }}/files/my.cnf" + dest: /etc/mysql/my.cnf + - name: "start and enable mariadb" systemd: name: mariadb diff --git a/roles/oam_cli_agent/tasks/main.yml b/roles/oam_cli_agent/tasks/main.yml index 8480524..59a0557 100644 --- a/roles/oam_cli_agent/tasks/main.yml +++ b/roles/oam_cli_agent/tasks/main.yml @@ -1,39 +1,13 @@ -- name: "copy oam_cli_agent.rpm to destination server" - copy: - src: "{{ role_path }}/files/" - dest: /tmp - -- name: "install oam_cli_agent" - yum: - name: - - /tmp/oam_cli_agent-1.0-1.0.x86_64.rpm - state: present - -- name: "bak snmpd.conf" - shell: cp -rf /usr/share/snmp/snmpd.conf /usr/share/snmp/snmpd.conf_origin - ignore_errors: yes - -- name: "Templates snmpd.conf" - template: - src: "{{role_path}}/templates/snmpd.conf" - dest: /usr/share/snmp/snmpd.conf - tags: template - -- name: "Templates oam_cli_agent.service" - template: - src: "{{ role_path }}/templates/oam_cli_agent.service.j2" - dest: /usr/lib/systemd/system/oam_cli_agent.service - - name: "Templates application.properties.j2" template: src: "{{ role_path }}/templates/application.properties.j2" dest: /opt/tsg/cli_agent/application.properties -- name: "Start snmpd" - systemd: - name: snmpd - state: restarted - enabled: yes + +- name: "Templates oam_cli_agent.service" + template: + src: "{{ role_path }}/templates/oam_cli_agent.service.j2" + dest: /usr/lib/systemd/system/oam_cli_agent.service - name: "Start oam_cli_agent" systemd: diff --git a/roles/oam_cli_agent/templates/oam_cli_agent.service.j2 b/roles/oam_cli_agent/templates/oam_cli_agent.service.j2 index 45ec95a..cde95e5 100644 --- a/roles/oam_cli_agent/templates/oam_cli_agent.service.j2 +++ b/roles/oam_cli_agent/templates/oam_cli_agent.service.j2 @@ -3,6 +3,7 @@ Description=oam_cli_agent daemon [Service] Type=simple +ExecStartPre=/usr/bin/mkdir -p /tmp/__tsg_monitor_tmp_dir Environment=OAM_DIR=/opt/tsg/cli_agent/ ExecStart=/usr/lib/jvm/{{ java_version }}/bin/java -jar ${OAM_DIR}oam_cli_agent.jar --spring.config.location=${OAM_DIR}application.properties,${OAM_DIR}application-centos2.properties --logging.file=${OAM_DIR}oam-cli-agent.log diff --git a/roles/oam_cli_agent_mxn/tasks/main.yml b/roles/oam_cli_agent_mxn/tasks/main.yml index c373084..e5e1357 100644 --- a/roles/oam_cli_agent_mxn/tasks/main.yml +++ b/roles/oam_cli_agent_mxn/tasks/main.yml @@ -1,27 +1,13 @@ -- name: "copy oam_cli_agent_mxn.rpm to destination server" - copy: - src: "{{ role_path }}/files/" - dest: /tmp - -- name: "install oam_cli_agent_mxn" - yum: - name: - - /tmp/oam_cli_agent_mxn-1.0-1.0.x86_64.rpm - state: present - name: "Templates oam_cli_agent_mxn.service" template: src: "{{ role_path }}/templates/oam_cli_agent_mxn.service.j2" dest: /usr/lib/systemd/system/oam_cli_agent_mxn.service -- name: "Templates application.properties.j2" - template: - src: "{{ role_path }}/templates/application.properties.j2" - dest: /opt/tsg/cli_agent/application.properties -#- name: "Start oam_cli_agent_mxn" -# systemd: -# name: oam_cli_agent_mxn -# state: restarted -# enabled: yes -# daemon_reload: yes +- name: "Start oam_cli_agent_mxn" + systemd: + name: oam_cli_agent_mxn + state: restarted + enabled: yes + daemon_reload: yes diff --git a/roles/oam_cli_agent_mxn/templates/oam_cli_agent_mxn.service.j2 b/roles/oam_cli_agent_mxn/templates/oam_cli_agent_mxn.service.j2 index 3226171..e2102c0 100644 --- a/roles/oam_cli_agent_mxn/templates/oam_cli_agent_mxn.service.j2 +++ b/roles/oam_cli_agent_mxn/templates/oam_cli_agent_mxn.service.j2 @@ -4,6 +4,7 @@ Description=oam_cli_agent daemon [Service] Type=simple Environment=OAM_DIR=/opt/tsg/cli_agent/ +ExecStartPre=/usr/bin/mkdir -p /tmp/__tsg_monitor_tmp_dir ExecStart=/usr/lib/jvm/{{ java_version }}/bin/java -jar ${OAM_DIR}oam_cli_agent.jar --spring.config.location=${OAM_DIR}application.properties,${OAM_DIR}application-centos2.properties --logging.file=${OAM_DIR}oam-cli-agent.log [Install] diff --git a/roles/oam_core/files/oam_core-1.0-1.0.x86_64.rpm b/roles/oam_core/files/oam_core-1.0-1.0.x86_64.rpm index 79dc3f6..31fb26b 100644 Binary files a/roles/oam_core/files/oam_core-1.0-1.0.x86_64.rpm and b/roles/oam_core/files/oam_core-1.0-1.0.x86_64.rpm differ diff --git a/roles/setup_mariadb/files/my.cnf b/roles/setup_mariadb/files/my.cnf new file mode 100644 index 0000000..d3d9bc3 --- /dev/null +++ b/roles/setup_mariadb/files/my.cnf @@ -0,0 +1,203 @@ +# Example MariaDB config file for very large systems. +# +# This is for a large system with memory of 1G-2G where the system runs mainly +# MariaDB. +# +# MariaDB programs look for option files in a set of +# locations which depend on the deployment platform. +# You can copy this option file to one of those +# locations. For information about these locations, do: +# 'my_print_defaults --help' and see what is printed under +# Default options are read from the following files in the given order: +# More information at: http://dev.mysql.com/doc/mysql/en/option-files.html +# +# In this file, you can use all long options that a program supports. +# If you want to know which options a program supports, run the program +# with the "--help" option. + +# The following options will be passed to all MySQL clients +[client] +#password = your_password +port = 3306 +socket = /var/lib/mysql/mysql.sock +default-character-set = utf8mb4 + +# Here follows entries for some specific programs + +# The MySQL server +[mysqld] +basedir=/home/cries/mysql +datadir=/home/cries/dbdata +#timezone test +#default-time_zone = '+6:00' +#relay_log=/home/ceiec/mariadb/binlogs/master-bin/relay-log +#log_bin=/home/ceiec/mariadb/relaylogs/relay-bin/master-log +binlog_format=mixed +auto-increment-offset=1 +auto-increment-increment=2 +log_bin_trust_function_creators=1 +log_slave_updates=true +sync_binlog=0 +binlog-checksum=CRC32 +master-verify-checksum=1 +slave-sql-verify-checksum=1 +slave-skip-errors=all +relay_log_recovery=1 +port = 3306 +#datadir = /home/dbdata +innodb_file_per_table = on +skip_name_resolve = on +lower_case_table_names = 1 +character-set-server = utf8mb4 +character-set-client-handshake = FALSE +#slow_query_log_file = /home/mariadb/logs/slow_query.log +#log_error = /home/mariadb/host01.err +socket = /var/lib/mysql/mysql.sock +skip-external-locking +back_log = 384 +key_buffer_size = 256M +max_allowed_packet = 4M +table_open_cache = 512 +thread_stack = 256K +table_cache = 128K +sort_buffer_size = 6M +read_buffer_size = 4M +read_rnd_buffer_size = 8M +myisam_sort_buffer_size = 64M +thread_cache_size = 8 +query_cache_size = 32M +join_buffer_size = 8M +# Try number of CPU's*2 for thread_concurrency +thread_concurrency = 8 +wait_timeout=2880000 +interactive_timeout = 2880000 +max_allowed_packet = 200M + +max_connections = 1500 +open-files-limit = 10240 + + +key_buffer_size=256M +back_log = 512 +table_open_cache=2048 + +innodb_file_per_table= 1 +innodb_buffer_pool_size = 2048M + +innodb_log_file_size = 1024M +innodb_log_buffer_size = 16M + +innodb_flush_log_at_trx_commit = 2 +innodb_flush_method = 'O_DIRECT' + +innodb_max_dirty_pages_pct = 90 + +# Point the following paths to a dedicated disk +#tmpdir = /tmp/ + +# Don't listen on a TCP/IP port at all. This can be a security enhancement, +# if all processes that need to connect to mysqld run on the same host. +# All interaction with mysqld must be made via Unix sockets or named pipes. +# Note that using this option without enabling named pipes on Windows +# (via the "enable-named-pipe" option) will render mysqld useless! +# +#skip-networking + +# Replication Master Server (default) +# binary logging is required for replication +log-bin=mysql-bin + +# required unique id between 1 and 2^32 - 1 +# defaults to 1 if master-host is not set +# but will not function as a master if omitted +server-id = 1 + +# Replication Slave (comment out master section to use this) +# +# To configure this host as a replication slave, you can choose between +# two methods : +# +# 1) Use the CHANGE MASTER TO command (fully described in our manual) - +# the syntax is: +# +# CHANGE MASTER TO MASTER_HOST=, MASTER_PORT=, +# MASTER_USER=, MASTER_PASSWORD= ; +# +# where you replace , , by quoted strings and +# by the master's port number (3306 by default). +# +# Example: +# +# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306, +# MASTER_USER='joe', MASTER_PASSWORD='secret'; +# +# OR +# +# 2) Set the variables below. However, in case you choose this method, then +# start replication for the first time (even unsuccessfully, for example +# if you mistyped the password in master-password and the slave fails to +# connect), the slave will create a master.info file, and any later +# change in this file to the variables' values below will be ignored and +# overridden by the content of the master.info file, unless you shutdown +# the slave server, delete master.info and restart the slaver server. +# For that reason, you may want to leave the lines below untouched +# (commented) and instead use CHANGE MASTER TO (see above) +# +# required unique id between 2 and 2^32 - 1 +# (and different from the master) +# defaults to 2 if master-host is set +# but will not function as a slave if omitted +#server-id = 2 +# +# The replication master for this slave - required +#master-host = +# +# The username the slave will use for authentication when connecting +# to the master - required +#master-user = +# +# The password the slave will authenticate with when connecting to +# the master - required +#master-password = +# +# The port the master is listening on. +# optional - defaults to 3306 +#master-port = +# +# binary logging - not required for slaves, but recommended +#log-bin=mysql-bin +# +# binary logging format - mixed recommended +#binlog_format=mixed + +# Uncomment the following if you are using InnoDB tables +#innodb_data_home_dir = /usr/local/mysql/data +#innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend +#innodb_log_group_home_dir = /usr/local/mysql/data +# You can set .._buffer_pool_size up to 50 - 80 % +# of RAM but beware of setting memory usage too high +#innodb_buffer_pool_size = 384M +# Set .._log_file_size to 25 % of buffer pool size +innodb_log_file_size = 100M +innodb_log_buffer_size = 1G +innodb_buffer_pool_instances = 1 +innodb_flush_log_at_trx_commit = 1 +innodb_lock_wait_timeout = 50 + +[mysqldump] +quick +max_allowed_packet = 16M + +[mysql] +no-auto-rehash +# Remove the next comment character if you are not familiar with SQL +#safe-updates + +[myisamchk] +key_buffer_size = 256M +sort_buffer_size = 256M +read_buffer = 2M +write_buffer = 2M + +[mysqlhotcopy] +interactive-timeout diff --git a/roles/setup_mariadb/tasks/main.yml b/roles/setup_mariadb/tasks/main.yml index 61c226b..3a88b0f 100644 --- a/roles/setup_mariadb/tasks/main.yml +++ b/roles/setup_mariadb/tasks/main.yml @@ -1,11 +1,11 @@ - name: "judge tsg_oam" - shell: mysql -uroot -p111111 -e "show databases;" |grep tsg_oam + shell: mysql -u {{ mariadb.username }} -p{{ mariadb.password }} -e "show databases;" |grep tsg_oam register: return ignore_errors: true - name: "set tsg_oam database" shell: mysql -uroot -p{{ mariadb.password }} -e "create database tsg_oam" - #when: return.rc != 0 + when: return.rc != 0 - name: "Templates tsg_threshold.sql" template: @@ -15,3 +15,14 @@ - name: "import the sql after template" shell: mysql -s -h 127.0.0.1 -u {{ mariadb.username }} -p{{ mariadb.password }} < /tmp/tsg-cli-deploy/tsg_threshold.sql + +- name: "copy my.cnf" + copy: + src: "{{ role_path }}/files/my.cnf" + dest: /etc/mysql/my.cnf + +- name: "restart mariadb.service" + systemd: + name: mariadb + state: restarted + enable: yes diff --git a/roles/setup_mariadb/templates/tsg_threshold.sql.j2 b/roles/setup_mariadb/templates/tsg_threshold.sql.j2 index 3325e20..67de102 100644 --- a/roles/setup_mariadb/templates/tsg_threshold.sql.j2 +++ b/roles/setup_mariadb/templates/tsg_threshold.sql.j2 @@ -37,115 +37,115 @@ CREATE TABLE `tsg_threshold` ( -- ---------------------------- -- Records of tsg_threshold -- ---------------------------- -INSERT INTO `tsg_threshold` VALUES ('1', '{{ SN }}_mxn_hardware', 'CMM_TEMP', '55', '-10', '46', '-5', '39', '0'); +INSERT INTO `tsg_threshold` VALUES ('1', '{{ SN }}_mxn_hardware', 'CMM_TEMP', '55', '-10', '46', '-5', null, null); INSERT INTO `tsg_threshold` VALUES ('2', '{{ SN }}_mxn_network_port_1', 'ifInUcastPkts', null, null, null, null, null, null); -INSERT INTO `tsg_threshold` VALUES ('3', '{{ SN }}_mxn_hardware', 'COME_TEMP', '90', '-10', '76', '-5', '63', '0'); -INSERT INTO `tsg_threshold` VALUES ('4', '{{ SN }}_mxn_hardware', 'RRC_TEMP', '90', '-10', '76', '-5', '63', '0'); -INSERT INTO `tsg_threshold` VALUES ('5', '{{ SN }}_mxn_hardware', 'P1V', '1.15', '0.85', '1.1', '0.9', '1.05', '0.95'); -INSERT INTO `tsg_threshold` VALUES ('6', '{{ SN }}_mxn_hardware', 'PVDDS', '1.07', '0.71', '1.04', '0.73', '1', '0.76'); -INSERT INTO `tsg_threshold` VALUES ('7', '{{ SN }}_mxn_hardware', 'PVDDF', '1.12', '0.71', '1.1', '0.73', '1.05', '0.76'); -INSERT INTO `tsg_threshold` VALUES ('8', '{{ SN }}_mxn_hardware', 'P3V3', '3.636', '2.964', '3.535', '3.066', '3.475', '3.139'); -INSERT INTO `tsg_threshold` VALUES ('9', '{{ SN }}_mxn_hardware', 'P5V', '5.745', '4.234', '5.494', '4.486', '5.242', '4.738'); -INSERT INTO `tsg_threshold` VALUES ('10', '{{ SN }}_mxn_hardware', 'P12V', '13.583', '10.415', '13.072', '10.926', '12.51', '11.488'); -INSERT INTO `tsg_threshold` VALUES ('11', '{{ SN }}_mxn_hardware', 'P1V_RT', '1.15', '0.85', '1.1', '0.9', '1.05', '0.95'); -INSERT INTO `tsg_threshold` VALUES ('12', '{{ SN }}_mxn_hardware', 'Fan_1', '9472', '512', '8672', '672', '7872', '832'); -INSERT INTO `tsg_threshold` VALUES ('13', '{{ SN }}_mxn_hardware', 'Fan_2', '9472', '512', '8672', '672', '7872', '832'); -INSERT INTO `tsg_threshold` VALUES ('14', '{{ SN }}_mxn_hardware', 'Fan_3', '9472', '512', '8672', '672', '7872', '832'); -INSERT INTO `tsg_threshold` VALUES ('15', '{{ SN }}_mcn0_hardware', 'HS_Current0', '40.25', '0', '37.25', '0', '36.75', '0'); -INSERT INTO `tsg_threshold` VALUES ('16', '{{ SN }}_mcn1_hardware', 'HS_Current0', '40.25', '0', '37.25', '0', '36.75', '0'); -INSERT INTO `tsg_threshold` VALUES ('17', '{{ SN }}_mcn2_hardware', 'HS_Current0', '40.25', '0', '37.25', '0', '36.75', '0'); -INSERT INTO `tsg_threshold` VALUES ('18', '{{ SN }}_mcn3_hardware', 'HS_Current0', '40.25', '0', '37.25', '0', '36.75', '0'); -INSERT INTO `tsg_threshold` VALUES ('19', '{{ SN }}_mcn0_hardware', 'HS_Volt0', '12.75', '10.5', '12.5', '10.875', '12.25', '11.125'); -INSERT INTO `tsg_threshold` VALUES ('20', '{{ SN }}_mcn1_hardware', 'HS_Volt0', '12.75', '10.5', '12.5', '10.875', '12.25', '11.125'); -INSERT INTO `tsg_threshold` VALUES ('21', '{{ SN }}_mcn2_hardware', 'HS_Volt0', '12.75', '10.5', '12.5', '10.875', '12.25', '11.125'); -INSERT INTO `tsg_threshold` VALUES ('22', '{{ SN }}_mcn3_hardware', 'HS_Volt0', '12.75', '10.5', '12.5', '10.875', '12.25', '11.125'); -INSERT INTO `tsg_threshold` VALUES ('23', '{{ SN }}_mcn0_hardware', 'P1V05_PCH', '1.147', '0.941', '1.117', '0.97', '1.098', '1'); -INSERT INTO `tsg_threshold` VALUES ('24', '{{ SN }}_mcn1_hardware', 'P1V05_PCH', '1.147', '0.941', '1.117', '0.97', '1.098', '1'); -INSERT INTO `tsg_threshold` VALUES ('25', '{{ SN }}_mcn2_hardware', 'P1V05_PCH', '1.147', '0.941', '1.117', '0.97', '1.098', '1'); -INSERT INTO `tsg_threshold` VALUES ('26', '{{ SN }}_mcn3_hardware', 'P1V05_PCH', '1.147', '0.941', '1.117', '0.97', '1.098', '1'); -INSERT INTO `tsg_threshold` VALUES ('27', '{{ SN }}_mcn0_hardware', 'P1V2_DDR0', '1.303', '1.078', '1.284', '1.117', '1.254', '1.137'); -INSERT INTO `tsg_threshold` VALUES ('28', '{{ SN }}_mcn1_hardware', 'P1V2_DDR0', '1.303', '1.078', '1.284', '1.117', '1.254', '1.137'); -INSERT INTO `tsg_threshold` VALUES ('29', '{{ SN }}_mcn2_hardware', 'P1V2_DDR0', '1.303', '1.078', '1.284', '1.117', '1.254', '1.137'); -INSERT INTO `tsg_threshold` VALUES ('30', '{{ SN }}_mcn3_hardware', 'P1V2_DDR0', '1.303', '1.078', '1.284', '1.117', '1.254', '1.137'); -INSERT INTO `tsg_threshold` VALUES ('31', '{{ SN }}_mcn0_hardware', 'P1V2_DDR1', '1.303', '1.078', '1.284', '1.117', '1.254', '1.137'); -INSERT INTO `tsg_threshold` VALUES ('32', '{{ SN }}_mcn1_hardware', 'P1V2_DDR1', '1.303', '1.078', '1.284', '1.117', '1.254', '1.137'); -INSERT INTO `tsg_threshold` VALUES ('33', '{{ SN }}_mcn2_hardware', 'P1V2_DDR1', '1.303', '1.078', '1.284', '1.117', '1.254', '1.137'); -INSERT INTO `tsg_threshold` VALUES ('34', '{{ SN }}_mcn3_hardware', 'P1V2_DDR1', '1.303', '1.078', '1.284', '1.117', '1.254', '1.137'); -INSERT INTO `tsg_threshold` VALUES ('35', '{{ SN }}_mcn0_hardware', 'P3V3', '3.569', '2.945', '3.51', '3.042', '3.452', '3.12'); -INSERT INTO `tsg_threshold` VALUES ('36', '{{ SN }}_mcn1_hardware', 'P3V3', '3.569', '2.945', '3.51', '3.042', '3.452', '3.12'); -INSERT INTO `tsg_threshold` VALUES ('37', '{{ SN }}_mcn2_hardware', 'P3V3', '3.569', '2.945', '3.51', '3.042', '3.452', '3.12'); -INSERT INTO `tsg_threshold` VALUES ('38', '{{ SN }}_mcn3_hardware', 'P3V3', '3.569', '2.945', '3.51', '3.042', '3.452', '3.12'); -INSERT INTO `tsg_threshold` VALUES ('39', '{{ SN }}_mcn0_hardware', 'P5V', '5.453', '4.494', '5.343', '4.631', '5.233', '4.74'); -INSERT INTO `tsg_threshold` VALUES ('40', '{{ SN }}_mcn1_hardware', 'P5V', '5.453', '4.494', '5.343', '4.631', '5.233', '4.74'); -INSERT INTO `tsg_threshold` VALUES ('41', '{{ SN }}_mcn2_hardware', 'P5V', '5.453', '4.494', '5.343', '4.631', '5.233', '4.74'); -INSERT INTO `tsg_threshold` VALUES ('42', '{{ SN }}_mcn3_hardware', 'P5V', '5.453', '4.494', '5.343', '4.631', '5.233', '4.74'); -INSERT INTO `tsg_threshold` VALUES ('43', '{{ SN }}_mcn0_hardware', 'PVCCIN_CPU0', '2.019', '1.323', '1.98', '1.343', '1.94', '1.352'); -INSERT INTO `tsg_threshold` VALUES ('44', '{{ SN }}_mcn1_hardware', 'PVCCIN_CPU0', '2.019', '1.323', '1.98', '1.343', '1.94', '1.352'); -INSERT INTO `tsg_threshold` VALUES ('45', '{{ SN }}_mcn2_hardware', 'PVCCIN_CPU0', '2.019', '1.323', '1.98', '1.343', '1.94', '1.352'); -INSERT INTO `tsg_threshold` VALUES ('46', '{{ SN }}_mcn3_hardware', 'PVCCIN_CPU0', '2.019', '1.323', '1.98', '1.343', '1.94', '1.352'); -INSERT INTO `tsg_threshold` VALUES ('47', '{{ SN }}_mcn0_hardware', 'PVCCIN_CPU1', '2.019', '1.323', '1.98', '1.343', '1.94', '1.352'); -INSERT INTO `tsg_threshold` VALUES ('48', '{{ SN }}_mcn1_hardware', 'PVCCIN_CPU1', '2.019', '1.323', '1.98', '1.343', '1.94', '1.352'); -INSERT INTO `tsg_threshold` VALUES ('49', '{{ SN }}_mcn2_hardware', 'PVCCIN_CPU1', '2.019', '1.323', '1.98', '1.343', '1.94', '1.352'); -INSERT INTO `tsg_threshold` VALUES ('50', '{{ SN }}_mcn3_hardware', 'PVCCIN_CPU1', '2.019', '1.323', '1.98', '1.343', '1.94', '1.352'); -INSERT INTO `tsg_threshold` VALUES ('51', '{{ SN }}_mcn0_hardware', 'PVCCIO', '1.029', '0.853', '1.009', '0.882', '1', '0.902'); -INSERT INTO `tsg_threshold` VALUES ('52', '{{ SN }}_mcn1_hardware', 'PVCCIO', '1.029', '0.853', '1.009', '0.882', '1', '0.902'); -INSERT INTO `tsg_threshold` VALUES ('53', '{{ SN }}_mcn2_hardware', 'PVCCIO', '1.029', '0.853', '1.009', '0.882', '1', '0.902'); -INSERT INTO `tsg_threshold` VALUES ('54', '{{ SN }}_mcn3_hardware', 'PVCCIO', '1.029', '0.853', '1.009', '0.882', '1', '0.902'); -INSERT INTO `tsg_threshold` VALUES ('55', '{{ SN }}_mcn0_hardware', 'Temp_LL', '60', '-10', '50', '-5', '40', '0'); -INSERT INTO `tsg_threshold` VALUES ('56', '{{ SN }}_mcn1_hardware', 'Temp_LL', '60', '-10', '50', '-5', '40', '0'); -INSERT INTO `tsg_threshold` VALUES ('57', '{{ SN }}_mcn2_hardware', 'Temp_LL', '60', '-10', '50', '-5', '40', '0'); -INSERT INTO `tsg_threshold` VALUES ('58', '{{ SN }}_mcn3_hardware', 'Temp_LL', '60', '-10', '50', '-5', '40', '0'); -INSERT INTO `tsg_threshold` VALUES ('59', '{{ SN }}_mcn0_hardware', 'Temp_LR', '45', '-10', '42', '-5', '40', '0'); -INSERT INTO `tsg_threshold` VALUES ('60', '{{ SN }}_mcn1_hardware', 'Temp_LR', '45', '-10', '42', '-5', '40', '0'); -INSERT INTO `tsg_threshold` VALUES ('61', '{{ SN }}_mcn2_hardware', 'Temp_LR', '45', '-10', '42', '-5', '40', '0'); -INSERT INTO `tsg_threshold` VALUES ('62', '{{ SN }}_mcn3_hardware', 'Temp_LR', '45', '-10', '42', '-5', '40', '0'); -INSERT INTO `tsg_threshold` VALUES ('63', '{{ SN }}_mcn0_hardware', 'Temp_PCH', '82', '-10', '74', '-5', '66', '0'); -INSERT INTO `tsg_threshold` VALUES ('64', '{{ SN }}_mcn1_hardware', 'Temp_PCH', '82', '-10', '74', '-5', '66', '0'); -INSERT INTO `tsg_threshold` VALUES ('65', '{{ SN }}_mcn2_hardware', 'Temp_PCH', '82', '-10', '74', '-5', '66', '0'); -INSERT INTO `tsg_threshold` VALUES ('66', '{{ SN }}_mcn3_hardware', 'Temp_PCH', '82', '-10', '74', '-5', '66', '0'); -INSERT INTO `tsg_threshold` VALUES ('67', '{{ SN }}_mcn0_hardware', 'Temp_UL', '85', '-10', '75', '-5', '66', '0'); -INSERT INTO `tsg_threshold` VALUES ('68', '{{ SN }}_mcn1_hardware', 'Temp_UL', '85', '-10', '75', '-5', '66', '0'); -INSERT INTO `tsg_threshold` VALUES ('69', '{{ SN }}_mcn2_hardware', 'Temp_UL', '85', '-10', '75', '-5', '66', '0'); -INSERT INTO `tsg_threshold` VALUES ('70', '{{ SN }}_mcn3_hardware', 'Temp_UL', '85', '-10', '75', '-5', '66', '0'); -INSERT INTO `tsg_threshold` VALUES ('71', '{{ SN }}_mcn0_hardware', 'Temp_UR', '90', '-10', '80', '-5', '70', '0'); -INSERT INTO `tsg_threshold` VALUES ('72', '{{ SN }}_mcn1_hardware', 'Temp_UR', '90', '-10', '80', '-5', '70', '0'); -INSERT INTO `tsg_threshold` VALUES ('73', '{{ SN }}_mcn2_hardware', 'Temp_UR', '90', '-10', '80', '-5', '70', '0'); -INSERT INTO `tsg_threshold` VALUES ('74', '{{ SN }}_mcn3_hardware', 'Temp_UR', '90', '-10', '80', '-5', '70', '0'); -INSERT INTO `tsg_threshold` VALUES ('75', '{{ SN }}_mcn0_hardware', 'Temp_XL710_82599', '90', '-10', '80', '-5', '70', '0'); -INSERT INTO `tsg_threshold` VALUES ('76', '{{ SN }}_mcn1_hardware', 'Temp_XL710_82599', '90', '-10', '80', '-5', '70', '0'); -INSERT INTO `tsg_threshold` VALUES ('77', '{{ SN }}_mcn2_hardware', 'Temp_XL710_82599', '90', '-10', '80', '-5', '70', '0'); -INSERT INTO `tsg_threshold` VALUES ('78', '{{ SN }}_mcn3_hardware', 'Temp_XL710_82599', '90', '-10', '80', '-5', '70', '0'); -INSERT INTO `tsg_threshold` VALUES ('79', '{{ SN }}_mcn0_hardware', 'Temp_mIO0', '60', '-10', '50', '-5', '40', '0'); -INSERT INTO `tsg_threshold` VALUES ('80', '{{ SN }}_mcn1_hardware', 'Temp_mIO0', '60', '-10', '50', '-5', '40', '0'); -INSERT INTO `tsg_threshold` VALUES ('81', '{{ SN }}_mcn2_hardware', 'Temp_mIO0', '60', '-10', '50', '-5', '40', '0'); -INSERT INTO `tsg_threshold` VALUES ('82', '{{ SN }}_mcn3_hardware', 'Temp_mIO0', '60', '-10', '50', '-5', '40', '0'); -INSERT INTO `tsg_threshold` VALUES ('83', '{{ SN }}_mcn0_hardware', 'Temp_mIO1', '60', '-10', '50', '-5', '40', '0'); -INSERT INTO `tsg_threshold` VALUES ('84', '{{ SN }}_mcn1_hardware', 'Temp_mIO1', '60', '-10', '50', '-5', '40', '0'); -INSERT INTO `tsg_threshold` VALUES ('85', '{{ SN }}_mcn2_hardware', 'Temp_mIO1', '60', '-10', '50', '-5', '40', '0'); -INSERT INTO `tsg_threshold` VALUES ('86', '{{ SN }}_mcn3_hardware', 'Temp_mIO1', '60', '-10', '50', '-5', '40', '0'); -INSERT INTO `tsg_threshold` VALUES ('87', '{{ SN }}_mcn0_hardware', 'PECI_CPU0', '90', '-10', '80', '-5', '70', '0'); -INSERT INTO `tsg_threshold` VALUES ('88', '{{ SN }}_mcn1_hardware', 'PECI_CPU0', '90', '-10', '80', '-5', '70', '0'); -INSERT INTO `tsg_threshold` VALUES ('89', '{{ SN }}_mcn2_hardware', 'PECI_CPU0', '90', '-10', '80', '-5', '70', '0'); -INSERT INTO `tsg_threshold` VALUES ('90', '{{ SN }}_mcn3_hardware', 'PECI_CPU0', '90', '-10', '80', '-5', '70', '0'); -INSERT INTO `tsg_threshold` VALUES ('91', '{{ SN }}_mcn0_hardware', 'PECI_CPU1', '90', '-10', '80', '-5', '70', '0'); -INSERT INTO `tsg_threshold` VALUES ('92', '{{ SN }}_mcn1_hardware', 'PECI_CPU1', '90', '-10', '80', '-5', '70', '0'); -INSERT INTO `tsg_threshold` VALUES ('93', '{{ SN }}_mcn2_hardware', 'PECI_CPU1', '90', '-10', '80', '-5', '70', '0'); -INSERT INTO `tsg_threshold` VALUES ('94', '{{ SN }}_mcn3_hardware', 'PECI_CPU1', '90', '-10', '80', '-5', '70', '0'); -INSERT INTO `tsg_threshold` VALUES ('95', '{{ SN }}_mxn_cpu', 'laLoad_1', '99', null, '85', null, null, null); -INSERT INTO `tsg_threshold` VALUES ('96', '{{ SN }}_mcn0_cpu', 'laLoad_1', '99', null, '85', null, null, null); -INSERT INTO `tsg_threshold` VALUES ('97', '{{ SN }}_mcn1_cpu', 'laLoad_1', '99', null, '85', null, null, null); -INSERT INTO `tsg_threshold` VALUES ('98', '{{ SN }}_mcn2_cpu', 'laLoad_1', '99', null, '85', null, null, null); -INSERT INTO `tsg_threshold` VALUES ('99', '{{ SN }}_mcn3_cpu', 'laLoad_1', '99', null, '85', null, null, null); -INSERT INTO `tsg_threshold` VALUES ('100', '{{ SN }}_mxn_cpu', 'laLoad_5', '99', null, '85', null, null, null); -INSERT INTO `tsg_threshold` VALUES ('101', '{{ SN }}_mcn0_cpu', 'laLoad_5', '99', null, '85', null, null, null); -INSERT INTO `tsg_threshold` VALUES ('102', '{{ SN }}_mcn1_cpu', 'laLoad_5', '99', null, '85', null, null, null); -INSERT INTO `tsg_threshold` VALUES ('103', '{{ SN }}_mcn2_cpu', 'laLoad_5', '99', null, '85', null, null, null); -INSERT INTO `tsg_threshold` VALUES ('104', '{{ SN }}_mcn3_cpu', 'laLoad_5', '99', null, '85', null, null, null); -INSERT INTO `tsg_threshold` VALUES ('105', '{{ SN }}_mxn_cpu', 'laLoad_10', '99', null, '85', null, null, null); -INSERT INTO `tsg_threshold` VALUES ('106', '{{ SN }}_mcn0_cpu', 'laLoad_10', '99', null, '85', null, null, null); -INSERT INTO `tsg_threshold` VALUES ('107', '{{ SN }}_mcn1_cpu', 'laLoad_10', '99', null, '85', null, null, null); -INSERT INTO `tsg_threshold` VALUES ('108', '{{ SN }}_mcn2_cpu', 'laLoad_10', '99', null, '85', null, null, null); -INSERT INTO `tsg_threshold` VALUES ('109', '{{ SN }}_mcn3_cpu', 'laLoad_10', '99', null, '85', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('3', '{{ SN }}_mxn_hardware', 'COME_TEMP', '90', '-10', '76', '-5', null, null); +INSERT INTO `tsg_threshold` VALUES ('4', '{{ SN }}_mxn_hardware', 'RRC_TEMP', '90', '-10', '76', '-5', null, null); +INSERT INTO `tsg_threshold` VALUES ('5', '{{ SN }}_mxn_hardware', 'P1V', '1.15', '0.85', '1.1', '0.9', null, null); +INSERT INTO `tsg_threshold` VALUES ('6', '{{ SN }}_mxn_hardware', 'PVDDS', '1.07', '0.71', '1.04', '0.73', null, null); +INSERT INTO `tsg_threshold` VALUES ('7', '{{ SN }}_mxn_hardware', 'PVDDF', '1.12', '0.71', '1.1', '0.73', null, null); +INSERT INTO `tsg_threshold` VALUES ('8', '{{ SN }}_mxn_hardware', 'P3V3', '3.636', '2.964', '3.535', '3.066', null, null); +INSERT INTO `tsg_threshold` VALUES ('9', '{{ SN }}_mxn_hardware', 'P5V', '5.745', '4.234', '5.494', '4.486', null, null); +INSERT INTO `tsg_threshold` VALUES ('10', '{{ SN }}_mxn_hardware', 'P12V', '13.583', '10.415', '13.072', '10.926', null, null); +INSERT INTO `tsg_threshold` VALUES ('11', '{{ SN }}_mxn_hardware', 'P1V_RT', '1.15', '0.85', '1.1', '0.9', null, null); +INSERT INTO `tsg_threshold` VALUES ('12', '{{ SN }}_mxn_hardware', 'Fan_1', '9472', '512', '8672', '672', null, null); +INSERT INTO `tsg_threshold` VALUES ('13', '{{ SN }}_mxn_hardware', 'Fan_2', '9472', '512', '8672', '672', null, null); +INSERT INTO `tsg_threshold` VALUES ('14', '{{ SN }}_mxn_hardware', 'Fan_3', '9472', '512', '8672', '672', null, null); +INSERT INTO `tsg_threshold` VALUES ('15', '{{ SN }}_mcn0_hardware', 'HS_Current0', '40.25', '0', '37.25', '0', null, null); +INSERT INTO `tsg_threshold` VALUES ('16', '{{ SN }}_mcn1_hardware', 'HS_Current0', '40.25', '0', '37.25', '0', null, null); +INSERT INTO `tsg_threshold` VALUES ('17', '{{ SN }}_mcn2_hardware', 'HS_Current0', '40.25', '0', '37.25', '0', null, null); +INSERT INTO `tsg_threshold` VALUES ('18', '{{ SN }}_mcn3_hardware', 'HS_Current0', '40.25', '0', '37.25', '0', null, null); +INSERT INTO `tsg_threshold` VALUES ('19', '{{ SN }}_mcn0_hardware', 'HS_Volt0', '12.75', '10.5', '12.5', '10.875', null, null); +INSERT INTO `tsg_threshold` VALUES ('20', '{{ SN }}_mcn1_hardware', 'HS_Volt0', '12.75', '10.5', '12.5', '10.875', null, null); +INSERT INTO `tsg_threshold` VALUES ('21', '{{ SN }}_mcn2_hardware', 'HS_Volt0', '12.75', '10.5', '12.5', '10.875', null, null); +INSERT INTO `tsg_threshold` VALUES ('22', '{{ SN }}_mcn3_hardware', 'HS_Volt0', '12.75', '10.5', '12.5', '10.875', null, null); +INSERT INTO `tsg_threshold` VALUES ('23', '{{ SN }}_mcn0_hardware', 'P1V05_PCH', '1.147', '0.941', '1.117', '0.97', null, null); +INSERT INTO `tsg_threshold` VALUES ('24', '{{ SN }}_mcn1_hardware', 'P1V05_PCH', '1.147', '0.941', '1.117', '0.97', null, null); +INSERT INTO `tsg_threshold` VALUES ('25', '{{ SN }}_mcn2_hardware', 'P1V05_PCH', '1.147', '0.941', '1.117', '0.97', null, null); +INSERT INTO `tsg_threshold` VALUES ('26', '{{ SN }}_mcn3_hardware', 'P1V05_PCH', '1.147', '0.941', '1.117', '0.97', null, null); +INSERT INTO `tsg_threshold` VALUES ('27', '{{ SN }}_mcn0_hardware', 'P1V2_DDR0', '1.303', '1.078', '1.284', '1.117', null, null); +INSERT INTO `tsg_threshold` VALUES ('28', '{{ SN }}_mcn1_hardware', 'P1V2_DDR0', '1.303', '1.078', '1.284', '1.117', null, null); +INSERT INTO `tsg_threshold` VALUES ('29', '{{ SN }}_mcn2_hardware', 'P1V2_DDR0', '1.303', '1.078', '1.284', '1.117', null, null); +INSERT INTO `tsg_threshold` VALUES ('30', '{{ SN }}_mcn3_hardware', 'P1V2_DDR0', '1.303', '1.078', '1.284', '1.117', null, null); +INSERT INTO `tsg_threshold` VALUES ('31', '{{ SN }}_mcn0_hardware', 'P1V2_DDR1', '1.303', '1.078', '1.284', '1.117', null, null); +INSERT INTO `tsg_threshold` VALUES ('32', '{{ SN }}_mcn1_hardware', 'P1V2_DDR1', '1.303', '1.078', '1.284', '1.117', null, null); +INSERT INTO `tsg_threshold` VALUES ('33', '{{ SN }}_mcn2_hardware', 'P1V2_DDR1', '1.303', '1.078', '1.284', '1.117', null, null); +INSERT INTO `tsg_threshold` VALUES ('34', '{{ SN }}_mcn3_hardware', 'P1V2_DDR1', '1.303', '1.078', '1.284', '1.117', null, null); +INSERT INTO `tsg_threshold` VALUES ('35', '{{ SN }}_mcn0_hardware', 'P3V3', '3.569', '2.945', '3.51', '3.042', null, null); +INSERT INTO `tsg_threshold` VALUES ('36', '{{ SN }}_mcn1_hardware', 'P3V3', '3.569', '2.945', '3.51', '3.042', null, null); +INSERT INTO `tsg_threshold` VALUES ('37', '{{ SN }}_mcn2_hardware', 'P3V3', '3.569', '2.945', '3.51', '3.042', null, null); +INSERT INTO `tsg_threshold` VALUES ('38', '{{ SN }}_mcn3_hardware', 'P3V3', '3.569', '2.945', '3.51', '3.042', null, null); +INSERT INTO `tsg_threshold` VALUES ('39', '{{ SN }}_mcn0_hardware', 'P5V', '5.453', '4.494', '5.343', '4.631', null, null); +INSERT INTO `tsg_threshold` VALUES ('40', '{{ SN }}_mcn1_hardware', 'P5V', '5.453', '4.494', '5.343', '4.631', null, null); +INSERT INTO `tsg_threshold` VALUES ('41', '{{ SN }}_mcn2_hardware', 'P5V', '5.453', '4.494', '5.343', '4.631', null, null); +INSERT INTO `tsg_threshold` VALUES ('42', '{{ SN }}_mcn3_hardware', 'P5V', '5.453', '4.494', '5.343', '4.631', null, null); +INSERT INTO `tsg_threshold` VALUES ('43', '{{ SN }}_mcn0_hardware', 'PVCCIN_CPU0', '2.019', '1.323', '1.98', '1.343', null, null); +INSERT INTO `tsg_threshold` VALUES ('44', '{{ SN }}_mcn1_hardware', 'PVCCIN_CPU0', '2.019', '1.323', '1.98', '1.343', null, null); +INSERT INTO `tsg_threshold` VALUES ('45', '{{ SN }}_mcn2_hardware', 'PVCCIN_CPU0', '2.019', '1.323', '1.98', '1.343', null, null); +INSERT INTO `tsg_threshold` VALUES ('46', '{{ SN }}_mcn3_hardware', 'PVCCIN_CPU0', '2.019', '1.323', '1.98', '1.343', null, null); +INSERT INTO `tsg_threshold` VALUES ('47', '{{ SN }}_mcn0_hardware', 'PVCCIN_CPU1', '2.019', '1.323', '1.98', '1.343', null, null); +INSERT INTO `tsg_threshold` VALUES ('48', '{{ SN }}_mcn1_hardware', 'PVCCIN_CPU1', '2.019', '1.323', '1.98', '1.343', null, null); +INSERT INTO `tsg_threshold` VALUES ('49', '{{ SN }}_mcn2_hardware', 'PVCCIN_CPU1', '2.019', '1.323', '1.98', '1.343', null, null); +INSERT INTO `tsg_threshold` VALUES ('50', '{{ SN }}_mcn3_hardware', 'PVCCIN_CPU1', '2.019', '1.323', '1.98', '1.343', null, null); +INSERT INTO `tsg_threshold` VALUES ('51', '{{ SN }}_mcn0_hardware', 'PVCCIO', '1.029', '0.853', '1.009', '0.882', null, null); +INSERT INTO `tsg_threshold` VALUES ('52', '{{ SN }}_mcn1_hardware', 'PVCCIO', '1.029', '0.853', '1.009', '0.882', null, null); +INSERT INTO `tsg_threshold` VALUES ('53', '{{ SN }}_mcn2_hardware', 'PVCCIO', '1.029', '0.853', '1.009', '0.882', null, null); +INSERT INTO `tsg_threshold` VALUES ('54', '{{ SN }}_mcn3_hardware', 'PVCCIO', '1.029', '0.853', '1.009', '0.882', null, null); +INSERT INTO `tsg_threshold` VALUES ('55', '{{ SN }}_mcn0_hardware', 'Temp_LL', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('56', '{{ SN }}_mcn1_hardware', 'Temp_LL', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('57', '{{ SN }}_mcn2_hardware', 'Temp_LL', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('58', '{{ SN }}_mcn3_hardware', 'Temp_LL', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('59', '{{ SN }}_mcn0_hardware', 'Temp_LR', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('60', '{{ SN }}_mcn1_hardware', 'Temp_LR', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('61', '{{ SN }}_mcn2_hardware', 'Temp_LR', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('62', '{{ SN }}_mcn3_hardware', 'Temp_LR', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('63', '{{ SN }}_mcn0_hardware', 'Temp_PCH', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('64', '{{ SN }}_mcn1_hardware', 'Temp_PCH', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('65', '{{ SN }}_mcn2_hardware', 'Temp_PCH', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('66', '{{ SN }}_mcn3_hardware', 'Temp_PCH', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('67', '{{ SN }}_mcn0_hardware', 'Temp_UL', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('68', '{{ SN }}_mcn1_hardware', 'Temp_UL', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('69', '{{ SN }}_mcn2_hardware', 'Temp_UL', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('70', '{{ SN }}_mcn3_hardware', 'Temp_UL', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('71', '{{ SN }}_mcn0_hardware', 'Temp_UR', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('72', '{{ SN }}_mcn1_hardware', 'Temp_UR', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('73', '{{ SN }}_mcn2_hardware', 'Temp_UR', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('74', '{{ SN }}_mcn3_hardware', 'Temp_UR', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('75', '{{ SN }}_mcn0_hardware', 'Temp_XL710_82599', '90', '-10', '80', '-5', null, null); +INSERT INTO `tsg_threshold` VALUES ('76', '{{ SN }}_mcn1_hardware', 'Temp_XL710_82599', '90', '-10', '80', '-5', null, null); +INSERT INTO `tsg_threshold` VALUES ('77', '{{ SN }}_mcn2_hardware', 'Temp_XL710_82599', '90', '-10', '80', '-5', null, null); +INSERT INTO `tsg_threshold` VALUES ('78', '{{ SN }}_mcn3_hardware', 'Temp_XL710_82599', '90', '-10', '80', '-5', null, null); +INSERT INTO `tsg_threshold` VALUES ('79', '{{ SN }}_mcn0_hardware', 'Temp_mIO0', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('80', '{{ SN }}_mcn1_hardware', 'Temp_mIO0', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('81', '{{ SN }}_mcn2_hardware', 'Temp_mIO0', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('82', '{{ SN }}_mcn3_hardware', 'Temp_mIO0', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('83', '{{ SN }}_mcn0_hardware', 'Temp_mIO1', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('84', '{{ SN }}_mcn1_hardware', 'Temp_mIO1', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('85', '{{ SN }}_mcn2_hardware', 'Temp_mIO1', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('86', '{{ SN }}_mcn3_hardware', 'Temp_mIO1', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('87', '{{ SN }}_mcn0_hardware', 'PECI_CPU0', '90', '-10', '80', '-5', null, null); +INSERT INTO `tsg_threshold` VALUES ('88', '{{ SN }}_mcn1_hardware', 'PECI_CPU0', '90', '-10', '80', '-5', null, null); +INSERT INTO `tsg_threshold` VALUES ('89', '{{ SN }}_mcn2_hardware', 'PECI_CPU0', '90', '-10', '80', '-5', null, null); +INSERT INTO `tsg_threshold` VALUES ('90', '{{ SN }}_mcn3_hardware', 'PECI_CPU0', '90', '-10', '80', '-5', null, null); +INSERT INTO `tsg_threshold` VALUES ('91', '{{ SN }}_mcn0_hardware', 'PECI_CPU1', '90', '-10', '80', '-5', null, null); +INSERT INTO `tsg_threshold` VALUES ('92', '{{ SN }}_mcn1_hardware', 'PECI_CPU1', '90', '-10', '80', '-5', null, null); +INSERT INTO `tsg_threshold` VALUES ('93', '{{ SN }}_mcn2_hardware', 'PECI_CPU1', '90', '-10', '80', '-5', null, null); +INSERT INTO `tsg_threshold` VALUES ('94', '{{ SN }}_mcn3_hardware', 'PECI_CPU1', '90', '-10', '80', '-5', null, null); +INSERT INTO `tsg_threshold` VALUES ('95', '{{ SN }}_mxn_cpu', 'laLoad_1', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('96', '{{ SN }}_mcn0_cpu', 'laLoad_1', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('97', '{{ SN }}_mcn1_cpu', 'laLoad_1', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('98', '{{ SN }}_mcn2_cpu', 'laLoad_1', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('99', '{{ SN }}_mcn3_cpu', 'laLoad_1', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('100', '{{ SN }}_mxn_cpu', 'laLoad_5', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('101', '{{ SN }}_mcn0_cpu', 'laLoad_5', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('102', '{{ SN }}_mcn1_cpu', 'laLoad_5', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('103', '{{ SN }}_mcn2_cpu', 'laLoad_5', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('104', '{{ SN }}_mcn3_cpu', 'laLoad_5', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('105', '{{ SN }}_mxn_cpu', 'laLoad_10', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('106', '{{ SN }}_mcn0_cpu', 'laLoad_10', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('107', '{{ SN }}_mcn1_cpu', 'laLoad_10', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('108', '{{ SN }}_mcn2_cpu', 'laLoad_10', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('109', '{{ SN }}_mcn3_cpu', 'laLoad_10', null, null, null, null, null, null); INSERT INTO `tsg_threshold` VALUES ('110', '{{ SN }}_mxn_cpu', 'ssCpuUser', null, null, null, null, null, null); INSERT INTO `tsg_threshold` VALUES ('111', '{{ SN }}_mcn0_cpu', 'ssCpuUser', null, null, null, null, null, null); INSERT INTO `tsg_threshold` VALUES ('112', '{{ SN }}_mcn1_cpu', 'ssCpuUser', null, null, null, null, null, null); @@ -156,11 +156,11 @@ INSERT INTO `tsg_threshold` VALUES ('116', '{{ SN }}_mcn0_cpu', 'ssCpuSystem', n INSERT INTO `tsg_threshold` VALUES ('117', '{{ SN }}_mcn1_cpu', 'ssCpuSystem', null, null, null, null, null, null); INSERT INTO `tsg_threshold` VALUES ('118', '{{ SN }}_mcn2_cpu', 'ssCpuSystem', null, null, null, null, null, null); INSERT INTO `tsg_threshold` VALUES ('119', '{{ SN }}_mcn3_cpu', 'ssCpuSystem', null, null, null, null, null, null); -INSERT INTO `tsg_threshold` VALUES ('120', '{{ SN }}_mxn_cpu', 'ssCpuIdle', null, '15', null, '30', null, '40'); -INSERT INTO `tsg_threshold` VALUES ('121', '{{ SN }}_mcn0_cpu', 'ssCpuIdle', null, '15', null, '30', null, '40'); -INSERT INTO `tsg_threshold` VALUES ('122', '{{ SN }}_mcn1_cpu', 'ssCpuIdle', null, '15', null, '30', null, '40'); -INSERT INTO `tsg_threshold` VALUES ('123', '{{ SN }}_mcn2_cpu', 'ssCpuIdle', null, '15', null, '30', null, '40'); -INSERT INTO `tsg_threshold` VALUES ('124', '{{ SN }}_mcn3_cpu', 'ssCpuIdle', null, '15', null, '30', null, '40'); +INSERT INTO `tsg_threshold` VALUES ('120', '{{ SN }}_mxn_cpu', 'ssCpuIdle', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('121', '{{ SN }}_mcn0_cpu', 'ssCpuIdle', null, '10', null, '15', null, null); +INSERT INTO `tsg_threshold` VALUES ('122', '{{ SN }}_mcn1_cpu', 'ssCpuIdle', null, '10', null, '15', null, null); +INSERT INTO `tsg_threshold` VALUES ('123', '{{ SN }}_mcn2_cpu', 'ssCpuIdle', null, '10', null, '15', null, null); +INSERT INTO `tsg_threshold` VALUES ('124', '{{ SN }}_mcn3_cpu', 'ssCpuIdle', null, '10', null, '15', null, null); INSERT INTO `tsg_threshold` VALUES ('125', '{{ SN }}_mxn_memory', 'memTotalReal', null, null, null, null, null, null); INSERT INTO `tsg_threshold` VALUES ('126', '{{ SN }}_mcn0_memory', 'memTotalReal', null, null, null, null, null, null); INSERT INTO `tsg_threshold` VALUES ('127', '{{ SN }}_mcn1_memory', 'memTotalReal', null, null, null, null, null, null); @@ -201,11 +201,11 @@ INSERT INTO `tsg_threshold` VALUES ('161', '{{ SN }}_mcn0_disk', 'dskAvail', nul INSERT INTO `tsg_threshold` VALUES ('162', '{{ SN }}_mcn1_disk', 'dskAvail', null, null, null, null, null, null); INSERT INTO `tsg_threshold` VALUES ('163', '{{ SN }}_mcn2_disk', 'dskAvail', null, null, null, null, null, null); INSERT INTO `tsg_threshold` VALUES ('164', '{{ SN }}_mcn3_disk', 'dskAvail', null, null, null, null, null, null); -INSERT INTO `tsg_threshold` VALUES ('165', '{{ SN }}_mxn_disk', 'dskPercent', '90', null, '80', null, '70', null); -INSERT INTO `tsg_threshold` VALUES ('166', '{{ SN }}_mcn0_disk', 'dskPercent', '90', null, '80', null, '70', null); -INSERT INTO `tsg_threshold` VALUES ('167', '{{ SN }}_mcn1_disk', 'dskPercent', '90', null, '80', null, '70', null); -INSERT INTO `tsg_threshold` VALUES ('168', '{{ SN }}_mcn2_disk', 'dskPercent', '90', null, '80', null, '70', null); -INSERT INTO `tsg_threshold` VALUES ('169', '{{ SN }}_mcn3_disk', 'dskPercent', '90', null, '80', null, '70', null); +INSERT INTO `tsg_threshold` VALUES ('165', '{{ SN }}_mxn_disk', 'dskPercent', '90', null, '85', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('166', '{{ SN }}_mcn0_disk', 'dskPercent', '90', null, '85', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('167', '{{ SN }}_mcn1_disk', 'dskPercent', '90', null, '85', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('168', '{{ SN }}_mcn2_disk', 'dskPercent', '90', null, '85', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('169', '{{ SN }}_mcn3_disk', 'dskPercent', '90', null, '85', null, null, null); INSERT INTO `tsg_threshold` VALUES ('170', '{{ SN }}_mxn_disk', 'dskPercentSled', null, null, null, null, null, null); INSERT INTO `tsg_threshold` VALUES ('171', '{{ SN }}_mcn0_disk', 'dskPercentSled', null, null, null, null, null, null); INSERT INTO `tsg_threshold` VALUES ('172', '{{ SN }}_mcn1_disk', 'dskPercentSled', null, null, null, null, null, null); @@ -271,17 +271,17 @@ INSERT INTO `tsg_threshold` VALUES ('231', '{{ SN }}_mxn_network_port_39', 'ifOu INSERT INTO `tsg_threshold` VALUES ('232', '{{ SN }}_mxn_network_port_41', 'ifOutUcastPkts', null, null, null, null, null, null); INSERT INTO `tsg_threshold` VALUES ('233', '{{ SN }}_mxn_network_port_43', 'ifOutUcastPkts', null, null, null, null, null, null); INSERT INTO `tsg_threshold` VALUES ('234', '{{ SN }}_mxn_memory', 'memPercent', null, null, null, null, null, null); -INSERT INTO `tsg_threshold` VALUES ('235', '{{ SN }}_mcn0_memory', 'memPercent', '0.9', null, '0.8', null, '0.7', null); -INSERT INTO `tsg_threshold` VALUES ('236', '{{ SN }}_mcn1_memory', 'memPercent', '0.9', null, '0.8', null, '0.7', null); -INSERT INTO `tsg_threshold` VALUES ('237', '{{ SN }}_mcn2_memory', 'memPercent', '0.9', null, '0.8', null, '0.7', null); -INSERT INTO `tsg_threshold` VALUES ('238', '{{ SN }}_mcn3_memory', 'memPercent', '0.9', null, '0.8', null, '0.7', null); -INSERT INTO `tsg_threshold` VALUES ('239', '{{ SN }}_mcn0_app', 'AppRxLoss', '0.0005', null, '0.0001', null, '0.00001', null); -INSERT INTO `tsg_threshold` VALUES ('240', '{{ SN }}_mcn0_app', 'AppTxLoss', '0.0005', null, '0.0001', null, '0.00001', null); -INSERT INTO `tsg_threshold` VALUES ('241', '{{ SN }}_mcn0_interface', 'PhyRxLoss', '0.0005', null, '0.0001', null, '0.00001', null); -INSERT INTO `tsg_threshold` VALUES ('242', '{{ SN }}_mcn1_interface', 'PhyRxLoss', '0.0005', null, '0.0001', null, '0.00001', null); -INSERT INTO `tsg_threshold` VALUES ('243', '{{ SN }}_mcn2_interface', 'PhyRxLoss', '0.0005', null, '0.0001', null, '0.00001', null); -INSERT INTO `tsg_threshold` VALUES ('244', '{{ SN }}_mcn3_interface', 'PhyRxLoss', '0.0005', null, '0.0001', null, '0.00001', null); -INSERT INTO `tsg_threshold` VALUES ('245', '{{ SN }}_mcn0_interface', 'PhyTxLoss', '0.0005', null, '0.0001', null, '0.00001', null); -INSERT INTO `tsg_threshold` VALUES ('246', '{{ SN }}_mcn1_interface', 'PhyTxLoss', '0.0005', null, '0.0001', null, '0.00001', null); -INSERT INTO `tsg_threshold` VALUES ('247', '{{ SN }}_mcn2_interface', 'PhyTxLoss', '0.0005', null, '0.0001', null, '0.00001', null); -INSERT INTO `tsg_threshold` VALUES ('248', '{{ SN }}_mcn3_interface', 'PhyTxLoss', '0.0005', null, '0.0001', null, '0.00001', null); +INSERT INTO `tsg_threshold` VALUES ('235', '{{ SN }}_mcn0_memory', 'memPercent', '0.9', null, '0.85', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('236', '{{ SN }}_mcn1_memory', 'memPercent', '0.9', null, '0.85', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('237', '{{ SN }}_mcn2_memory', 'memPercent', '0.9', null, '0.85', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('238', '{{ SN }}_mcn3_memory', 'memPercent', '0.9', null, '0.85', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('239', '{{ SN }}_mcn0_app', 'AppRxLoss', '0.0005', null, '0.0001', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('240', '{{ SN }}_mcn0_app', 'AppTxLoss', '0.0005', null, '0.0001', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('241', '{{ SN }}_mcn0_interface', 'PhyRxLoss', '0.0005', null, '0.0001', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('242', '{{ SN }}_mcn1_interface', 'PhyRxLoss', '0.0005', null, '0.0001', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('243', '{{ SN }}_mcn2_interface', 'PhyRxLoss', '0.0005', null, '0.0001', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('244', '{{ SN }}_mcn3_interface', 'PhyRxLoss', '0.0005', null, '0.0001', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('245', '{{ SN }}_mcn0_interface', 'PhyTxLoss', '0.0005', null, '0.0001', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('246', '{{ SN }}_mcn1_interface', 'PhyTxLoss', '0.0005', null, '0.0001', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('247', '{{ SN }}_mcn2_interface', 'PhyTxLoss', '0.0005', null, '0.0001', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('248', '{{ SN }}_mcn3_interface', 'PhyTxLoss', '0.0005', null, '0.0001', null, null, null); diff --git a/roles/tsg-cli-mcn0/files/tsg-monitor.sh b/roles/tsg-cli-mcn0/files/tsg-monitor.sh index 7a8cd2e..55b9692 100644 --- a/roles/tsg-cli-mcn0/files/tsg-monitor.sh +++ b/roles/tsg-cli-mcn0/files/tsg-monitor.sh @@ -13,31 +13,22 @@ killall_uncompleted_cmd(){ killall -9 -q tsg_monit_app killall -9 -q tsg_monit_intercept killall -9 -q tsg_monit_interface - #killall -9 -q tsg_monit_protocol_v3 killall -9 -q tsg_monit_protocol_v4 - #killall -9 -q tsg_monit_stream_v3 killall -9 -q tsg_monit_stream_v4 - 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_diagnose_background > /dev/null & #/opt/tsg/tsg-monitor/tsg_update_tags > /dev/null & - /opt/tsg/tsg-monitor/tsg_monit_app > /dev/null & /opt/tsg/tsg-monitor/tsg_monit_intercept > /dev/null & /opt/tsg/tsg-monitor/tsg_monit_interface > /dev/null & - #/opt/tsg/tsg-monitor/tsg_monit_protocol_v3 > /dev/null & /opt/tsg/tsg-monitor/tsg_monit_protocol_v4 > /dev/null & - #/opt/tsg/tsg-monitor/tsg_monit_stream_v3 > /dev/null & /opt/tsg/tsg-monitor/tsg_monit_stream_v4 > /dev/null & } diff --git a/roles/tsg-cli-mcn0/tasks/main.yml b/roles/tsg-cli-mcn0/tasks/main.yml index 41da864..c247a91 100644 --- a/roles/tsg-cli-mcn0/tasks/main.yml +++ b/roles/tsg-cli-mcn0/tasks/main.yml @@ -57,6 +57,13 @@ 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 diff --git a/roles/tsg-cli-mcn0/templates/tsg_cli_env.ini.j2 b/roles/tsg-cli-mcn0/templates/tsg_cli_env.ini.j2 index 3b891d8..d962f51 100644 --- a/roles/tsg-cli-mcn0/templates/tsg_cli_env.ini.j2 +++ b/roles/tsg-cli-mcn0/templates/tsg_cli_env.ini.j2 @@ -21,9 +21,13 @@ fs2_stat_file=/var/log/tfe/tfe.fs2 [threshold] #means percent, n% -cpu_critical_high=90 -cpu_major_high=80 -mem_critical_high=90 -mem_major_high=80 -disk_critical_high=90 -disk_major_high=80 +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 }} diff --git a/roles/tsg-cli-mcn1/files/tsg-monitor.sh b/roles/tsg-cli-mcn1/files/tsg-monitor.sh index 300ebc3..c974a65 100644 --- a/roles/tsg-cli-mcn1/files/tsg-monitor.sh +++ b/roles/tsg-cli-mcn1/files/tsg-monitor.sh @@ -12,14 +12,11 @@ killall_uncompleted_cmd(){ killall -9 -q tsg_monit_interface killall -9 -q tsg_monit_intercept - 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_diagnose_background > /dev/null & diff --git a/roles/tsg-cli-mcn1/tasks/main.yml b/roles/tsg-cli-mcn1/tasks/main.yml index a8be273..28ff424 100644 --- a/roles/tsg-cli-mcn1/tasks/main.yml +++ b/roles/tsg-cli-mcn1/tasks/main.yml @@ -57,6 +57,12 @@ 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 diff --git a/roles/tsg-cli-mcn1/templates/tsg_cli_env.ini.j2 b/roles/tsg-cli-mcn1/templates/tsg_cli_env.ini.j2 index 3b891d8..ae5942d 100644 --- a/roles/tsg-cli-mcn1/templates/tsg_cli_env.ini.j2 +++ b/roles/tsg-cli-mcn1/templates/tsg_cli_env.ini.j2 @@ -21,9 +21,13 @@ fs2_stat_file=/var/log/tfe/tfe.fs2 [threshold] #means percent, n% -cpu_critical_high=90 -cpu_major_high=80 -mem_critical_high=90 -mem_major_high=80 -disk_critical_high=90 -disk_major_high=80 +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 diff --git a/roles/tsg-cli-mcn2/files/tsg-monitor.sh b/roles/tsg-cli-mcn2/files/tsg-monitor.sh index b039721..1938465 100644 --- a/roles/tsg-cli-mcn2/files/tsg-monitor.sh +++ b/roles/tsg-cli-mcn2/files/tsg-monitor.sh @@ -12,14 +12,11 @@ killall_uncompleted_cmd(){ killall -9 -q tsg_monit_interface killall -9 -q tsg_monit_intercept - 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_diagnose_background > /dev/null & diff --git a/roles/tsg-cli-mcn2/tasks/main.yml b/roles/tsg-cli-mcn2/tasks/main.yml index 000a44e..c71a2f3 100644 --- a/roles/tsg-cli-mcn2/tasks/main.yml +++ b/roles/tsg-cli-mcn2/tasks/main.yml @@ -57,6 +57,12 @@ 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 diff --git a/roles/tsg-cli-mcn2/templates/tsg_cli_env.ini.j2 b/roles/tsg-cli-mcn2/templates/tsg_cli_env.ini.j2 index 3b891d8..d962f51 100644 --- a/roles/tsg-cli-mcn2/templates/tsg_cli_env.ini.j2 +++ b/roles/tsg-cli-mcn2/templates/tsg_cli_env.ini.j2 @@ -21,9 +21,13 @@ fs2_stat_file=/var/log/tfe/tfe.fs2 [threshold] #means percent, n% -cpu_critical_high=90 -cpu_major_high=80 -mem_critical_high=90 -mem_major_high=80 -disk_critical_high=90 -disk_major_high=80 +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 }} diff --git a/roles/tsg-cli-mcn3/files/tsg-monitor.sh b/roles/tsg-cli-mcn3/files/tsg-monitor.sh index 2eaa0e2..7cdf021 100644 --- a/roles/tsg-cli-mcn3/files/tsg-monitor.sh +++ b/roles/tsg-cli-mcn3/files/tsg-monitor.sh @@ -12,14 +12,11 @@ killall_uncompleted_cmd(){ killall -9 -q tsg_monit_interface killall -9 -q tsg_monit_intercept - 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_diagnose_background > /dev/null & diff --git a/roles/tsg-cli-mcn3/tasks/main.yml b/roles/tsg-cli-mcn3/tasks/main.yml index 1c5533b..ea57491 100644 --- a/roles/tsg-cli-mcn3/tasks/main.yml +++ b/roles/tsg-cli-mcn3/tasks/main.yml @@ -57,6 +57,12 @@ 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 diff --git a/roles/tsg-cli-mcn3/templates/tsg_cli_env.ini.j2 b/roles/tsg-cli-mcn3/templates/tsg_cli_env.ini.j2 index 3b891d8..d962f51 100644 --- a/roles/tsg-cli-mcn3/templates/tsg_cli_env.ini.j2 +++ b/roles/tsg-cli-mcn3/templates/tsg_cli_env.ini.j2 @@ -21,9 +21,13 @@ fs2_stat_file=/var/log/tfe/tfe.fs2 [threshold] #means percent, n% -cpu_critical_high=90 -cpu_major_high=80 -mem_critical_high=90 -mem_major_high=80 -disk_critical_high=90 -disk_major_high=80 +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 }} 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 diff --git a/roles/tsg-common-files/tsg-cli-1.1.1.ea016fc-1.el7.x86_64.rpm b/roles/tsg-common-files/tsg-cli-1.1.8.dc13c5d-1.el7.x86_64.rpm similarity index 72% rename from roles/tsg-common-files/tsg-cli-1.1.1.ea016fc-1.el7.x86_64.rpm rename to roles/tsg-common-files/tsg-cli-1.1.8.dc13c5d-1.el7.x86_64.rpm index 160e489..8367aa5 100644 Binary files a/roles/tsg-common-files/tsg-cli-1.1.1.ea016fc-1.el7.x86_64.rpm and b/roles/tsg-common-files/tsg-cli-1.1.8.dc13c5d-1.el7.x86_64.rpm differ diff --git a/roles/tsg-common-files/tsg_monitor_cleanup_tmp.sh b/roles/tsg-common-files/tsg_monitor_cleanup_tmp.sh new file mode 100644 index 0000000..c7cf3f1 --- /dev/null +++ b/roles/tsg-common-files/tsg_monitor_cleanup_tmp.sh @@ -0,0 +1,13 @@ +#!/bin/sh +cd /tmp/__tsg_monitor_tmp_dir + +if [ $? != 0 ]; then + #echo "cd to dir error!" + exit 1 +fi + +#cur_dir=`pwd` +#echo "cur dir is: $cur_dir" + +find . -ctime +1 -type d -name "_MEI*" | xargs rm -rf +