diff --git a/deploy.yml b/deploy.yml index f9201e6..113bba2 100644 --- a/deploy.yml +++ b/deploy.yml @@ -2,7 +2,7 @@ roles: - consul-cluster - influxdb - - MariaDB + - mariadb - hosts: blade-mxn roles: @@ -14,3 +14,51 @@ - telegraf - influxdb - grafana + +- hosts: blade-01 + roles: + - consul-internal + +- hosts: blade-02 + roles: + - consul-internal + +- hosts: blade-03 + roles: + - consul-internal + +- hosts: sled-mxn + roles: + - tsg-cli-mxn + - oam_cli_agent_mxn + - oam_cli + - oam_core + - oam_snmp + +- hosts: sled-mcn0 + roles: + - tsg-cli-mcn0 + - oam_cli_agent + +- hosts: sled-mcn1 + roles: + - tsg-cli-mcn1 + - oam_cli_agent + +- hosts: sled-mcn2 + roles: + - tsg-cli-mcn2 + - oam_cli_agent + +- hosts: sled-mcn3 + roles: + - tsg-cli-mcn3 + - oam_cli_agent + +- hosts: sled-mxn + roles: + - oam_core_start + +- hosts: cluster_server + roles: + - oam_cluster diff --git a/roles/mariadb/files/my.cnf b/roles/mariadb/files/my.cnf new file mode 100644 index 0000000..82f9b36 --- /dev/null +++ b/roles/mariadb/files/my.cnf @@ -0,0 +1,169 @@ +# 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 = /tmp/mysql.sock + +# Here follows entries for some specific programs + +# The MySQL server +[mysqld] +skip-external-locking +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 +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 + +# 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 = 8M +#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/mariadb/files/tsg_threshold.sql b/roles/mariadb/files/tsg_threshold.sql new file mode 100644 index 0000000..6291bb7 --- /dev/null +++ b/roles/mariadb/files/tsg_threshold.sql @@ -0,0 +1,270 @@ +/* +Navicat MySQL Data Transfer + +Source Server : 192.168.161.134 +Source Server Version : 50505 +Source Host : 192.168.161.134:3306 +Source Database : tsg_oam + +Target Server Type : MYSQL +Target Server Version : 50505 +File Encoding : 65001 + +Date: 2019-10-03 22:27:26 +*/ + +SET FOREIGN_KEY_CHECKS=0; + +-- ---------------------------- +-- Table structure for `tsg_threshold` +-- ---------------------------- +DROP TABLE IF EXISTS `tsg_threshold`; +CREATE TABLE `tsg_threshold` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `component` varchar(200) COLLATE utf8_unicode_ci NOT NULL, + `counter` varchar(64) COLLATE utf8_unicode_ci NOT NULL, + `critical_high` float DEFAULT NULL, + `critical_low` float DEFAULT NULL, + `major_high` float DEFAULT NULL, + `major_low` float DEFAULT NULL, + `minor_high` float DEFAULT NULL, + `minor_low` float DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=234 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- ---------------------------- +-- Records of tsg_threshold +-- ---------------------------- +INSERT INTO `tsg_threshold` VALUES ('1', 'CBT2201925000001_mxn_hardware', 'CMM_TEMP', '55', '-10', '46', '-5', '39', '0'); +INSERT INTO `tsg_threshold` VALUES ('2', 'CBT2201925000001_mxn_network_port_1', 'ifInUcastPkts', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('3', 'CBT2201925000001_mxn_hardware', 'COME_TEMP', '90', '-10', '76', '-5', '63', '0'); +INSERT INTO `tsg_threshold` VALUES ('4', 'CBT2201925000001_mxn_hardware', 'RRC_TEMP', '90', '-10', '76', '-5', '63', '0'); +INSERT INTO `tsg_threshold` VALUES ('5', 'CBT2201925000001_mxn_hardware', 'P1V', '1.15', '0.85', '1.1', '0.9', '1.05', '0.95'); +INSERT INTO `tsg_threshold` VALUES ('6', 'CBT2201925000001_mxn_hardware', 'PVDDS', '1.07', '0.71', '1.04', '0.73', '1', '0.76'); +INSERT INTO `tsg_threshold` VALUES ('7', 'CBT2201925000001_mxn_hardware', 'PVDDF', '1.12', '0.71', '1.1', '0.73', '1.05', '0.76'); +INSERT INTO `tsg_threshold` VALUES ('8', 'CBT2201925000001_mxn_hardware', 'P3V3', '3.636', '2.964', '3.535', '3.066', '3.475', '3.139'); +INSERT INTO `tsg_threshold` VALUES ('9', 'CBT2201925000001_mxn_hardware', 'P5V', '5.745', '4.234', '5.494', '4.486', '5.242', '4.738'); +INSERT INTO `tsg_threshold` VALUES ('10', 'CBT2201925000001_mxn_hardware', 'P12V', '13.583', '10.415', '13.072', '10.926', '12.51', '11.488'); +INSERT INTO `tsg_threshold` VALUES ('11', 'CBT2201925000001_mxn_hardware', 'P1V_RT', '1.15', '0.85', '1.1', '0.9', '1.05', '0.95'); +INSERT INTO `tsg_threshold` VALUES ('12', 'CBT2201925000001_mxn_hardware', 'Fan_1', '9472', '512', '8672', '672', '7872', '832'); +INSERT INTO `tsg_threshold` VALUES ('13', 'CBT2201925000001_mxn_hardware', 'Fan_2', '9472', '512', '8672', '672', '7872', '832'); +INSERT INTO `tsg_threshold` VALUES ('14', 'CBT2201925000001_mxn_hardware', 'Fan_3', '9472', '512', '8672', '672', '7872', '832'); +INSERT INTO `tsg_threshold` VALUES ('15', 'CBT2201925000001_mcn0_hardware', 'HS_Current0', '40.25', '0', '37.25', '0', '36.75', '0'); +INSERT INTO `tsg_threshold` VALUES ('16', 'CBT2201925000001_mcn1_hardware', 'HS_Current0', '40.25', '0', '37.25', '0', '36.75', '0'); +INSERT INTO `tsg_threshold` VALUES ('17', 'CBT2201925000001_mcn2_hardware', 'HS_Current0', '40.25', '0', '37.25', '0', '36.75', '0'); +INSERT INTO `tsg_threshold` VALUES ('18', 'CBT2201925000001_mcn3_hardware', 'HS_Current0', '40.25', '0', '37.25', '0', '36.75', '0'); +INSERT INTO `tsg_threshold` VALUES ('19', 'CBT2201925000001_mcn0_hardware', 'HS_Volt0', '12.75', '10.5', '12.5', '10.875', '12.25', '11.125'); +INSERT INTO `tsg_threshold` VALUES ('20', 'CBT2201925000001_mcn1_hardware', 'HS_Volt0', '12.75', '10.5', '12.5', '10.875', '12.25', '11.125'); +INSERT INTO `tsg_threshold` VALUES ('21', 'CBT2201925000001_mcn2_hardware', 'HS_Volt0', '12.75', '10.5', '12.5', '10.875', '12.25', '11.125'); +INSERT INTO `tsg_threshold` VALUES ('22', 'CBT2201925000001_mcn3_hardware', 'HS_Volt0', '12.75', '10.5', '12.5', '10.875', '12.25', '11.125'); +INSERT INTO `tsg_threshold` VALUES ('23', 'CBT2201925000001_mcn0_hardware', 'P1V05_PCH', '1.147', '0.941', '1.117', '0.97', '1.098', '1'); +INSERT INTO `tsg_threshold` VALUES ('24', 'CBT2201925000001_mcn1_hardware', 'P1V05_PCH', '1.147', '0.941', '1.117', '0.97', '1.098', '1'); +INSERT INTO `tsg_threshold` VALUES ('25', 'CBT2201925000001_mcn2_hardware', 'P1V05_PCH', '1.147', '0.941', '1.117', '0.97', '1.098', '1'); +INSERT INTO `tsg_threshold` VALUES ('26', 'CBT2201925000001_mcn3_hardware', 'P1V05_PCH', '1.147', '0.941', '1.117', '0.97', '1.098', '1'); +INSERT INTO `tsg_threshold` VALUES ('27', 'CBT2201925000001_mcn0_hardware', 'P1V2_DDR0', '1.303', '1.078', '1.284', '1.117', '1.254', '1.137'); +INSERT INTO `tsg_threshold` VALUES ('28', 'CBT2201925000001_mcn1_hardware', 'P1V2_DDR0', '1.303', '1.078', '1.284', '1.117', '1.254', '1.137'); +INSERT INTO `tsg_threshold` VALUES ('29', 'CBT2201925000001_mcn2_hardware', 'P1V2_DDR0', '1.303', '1.078', '1.284', '1.117', '1.254', '1.137'); +INSERT INTO `tsg_threshold` VALUES ('30', 'CBT2201925000001_mcn3_hardware', 'P1V2_DDR0', '1.303', '1.078', '1.284', '1.117', '1.254', '1.137'); +INSERT INTO `tsg_threshold` VALUES ('31', 'CBT2201925000001_mcn0_hardware', 'P1V2_DDR1', '1.303', '1.078', '1.284', '1.117', '1.254', '1.137'); +INSERT INTO `tsg_threshold` VALUES ('32', 'CBT2201925000001_mcn1_hardware', 'P1V2_DDR1', '1.303', '1.078', '1.284', '1.117', '1.254', '1.137'); +INSERT INTO `tsg_threshold` VALUES ('33', 'CBT2201925000001_mcn2_hardware', 'P1V2_DDR1', '1.303', '1.078', '1.284', '1.117', '1.254', '1.137'); +INSERT INTO `tsg_threshold` VALUES ('34', 'CBT2201925000001_mcn3_hardware', 'P1V2_DDR1', '1.303', '1.078', '1.284', '1.117', '1.254', '1.137'); +INSERT INTO `tsg_threshold` VALUES ('35', 'CBT2201925000001_mcn0_hardware', 'P3V3', '3.569', '2.945', '3.51', '3.042', '3.452', '3.12'); +INSERT INTO `tsg_threshold` VALUES ('36', 'CBT2201925000001_mcn1_hardware', 'P3V3', '3.569', '2.945', '3.51', '3.042', '3.452', '3.12'); +INSERT INTO `tsg_threshold` VALUES ('37', 'CBT2201925000001_mcn2_hardware', 'P3V3', '3.569', '2.945', '3.51', '3.042', '3.452', '3.12'); +INSERT INTO `tsg_threshold` VALUES ('38', 'CBT2201925000001_mcn3_hardware', 'P3V3', '3.569', '2.945', '3.51', '3.042', '3.452', '3.12'); +INSERT INTO `tsg_threshold` VALUES ('39', 'CBT2201925000001_mcn0_hardware', 'P5V', '5.453', '4.494', '5.343', '4.631', '5.233', '4.74'); +INSERT INTO `tsg_threshold` VALUES ('40', 'CBT2201925000001_mcn1_hardware', 'P5V', '5.453', '4.494', '5.343', '4.631', '5.233', '4.74'); +INSERT INTO `tsg_threshold` VALUES ('41', 'CBT2201925000001_mcn2_hardware', 'P5V', '5.453', '4.494', '5.343', '4.631', '5.233', '4.74'); +INSERT INTO `tsg_threshold` VALUES ('42', 'CBT2201925000001_mcn3_hardware', 'P5V', '5.453', '4.494', '5.343', '4.631', '5.233', '4.74'); +INSERT INTO `tsg_threshold` VALUES ('43', 'CBT2201925000001_mcn0_hardware', 'PVCCIN_CPU0', '2.019', '1.323', '1.98', '1.343', '1.94', '1.352'); +INSERT INTO `tsg_threshold` VALUES ('44', 'CBT2201925000001_mcn1_hardware', 'PVCCIN_CPU0', '2.019', '1.323', '1.98', '1.343', '1.94', '1.352'); +INSERT INTO `tsg_threshold` VALUES ('45', 'CBT2201925000001_mcn2_hardware', 'PVCCIN_CPU0', '2.019', '1.323', '1.98', '1.343', '1.94', '1.352'); +INSERT INTO `tsg_threshold` VALUES ('46', 'CBT2201925000001_mcn3_hardware', 'PVCCIN_CPU0', '2.019', '1.323', '1.98', '1.343', '1.94', '1.352'); +INSERT INTO `tsg_threshold` VALUES ('47', 'CBT2201925000001_mcn0_hardware', 'PVCCIN_CPU1', '2.019', '1.323', '1.98', '1.343', '1.94', '1.352'); +INSERT INTO `tsg_threshold` VALUES ('48', 'CBT2201925000001_mcn1_hardware', 'PVCCIN_CPU1', '2.019', '1.323', '1.98', '1.343', '1.94', '1.352'); +INSERT INTO `tsg_threshold` VALUES ('49', 'CBT2201925000001_mcn2_hardware', 'PVCCIN_CPU1', '2.019', '1.323', '1.98', '1.343', '1.94', '1.352'); +INSERT INTO `tsg_threshold` VALUES ('50', 'CBT2201925000001_mcn3_hardware', 'PVCCIN_CPU1', '2.019', '1.323', '1.98', '1.343', '1.94', '1.352'); +INSERT INTO `tsg_threshold` VALUES ('51', 'CBT2201925000001_mcn0_hardware', 'PVCCIO', '1.029', '0.853', '1.009', '0.882', '1', '0.902'); +INSERT INTO `tsg_threshold` VALUES ('52', 'CBT2201925000001_mcn1_hardware', 'PVCCIO', '1.029', '0.853', '1.009', '0.882', '1', '0.902'); +INSERT INTO `tsg_threshold` VALUES ('53', 'CBT2201925000001_mcn2_hardware', 'PVCCIO', '1.029', '0.853', '1.009', '0.882', '1', '0.902'); +INSERT INTO `tsg_threshold` VALUES ('54', 'CBT2201925000001_mcn3_hardware', 'PVCCIO', '1.029', '0.853', '1.009', '0.882', '1', '0.902'); +INSERT INTO `tsg_threshold` VALUES ('55', 'CBT2201925000001_mcn0_hardware', 'Temp_LL', '60', '-10', '50', '-5', '40', '0'); +INSERT INTO `tsg_threshold` VALUES ('56', 'CBT2201925000001_mcn1_hardware', 'Temp_LL', '60', '-10', '50', '-5', '40', '0'); +INSERT INTO `tsg_threshold` VALUES ('57', 'CBT2201925000001_mcn2_hardware', 'Temp_LL', '60', '-10', '50', '-5', '40', '0'); +INSERT INTO `tsg_threshold` VALUES ('58', 'CBT2201925000001_mcn3_hardware', 'Temp_LL', '60', '-10', '50', '-5', '40', '0'); +INSERT INTO `tsg_threshold` VALUES ('59', 'CBT2201925000001_mcn0_hardware', 'Temp_LR', '45', '-10', '42', '-5', '40', '0'); +INSERT INTO `tsg_threshold` VALUES ('60', 'CBT2201925000001_mcn1_hardware', 'Temp_LR', '45', '-10', '42', '-5', '40', '0'); +INSERT INTO `tsg_threshold` VALUES ('61', 'CBT2201925000001_mcn2_hardware', 'Temp_LR', '45', '-10', '42', '-5', '40', '0'); +INSERT INTO `tsg_threshold` VALUES ('62', 'CBT2201925000001_mcn3_hardware', 'Temp_LR', '45', '-10', '42', '-5', '40', '0'); +INSERT INTO `tsg_threshold` VALUES ('63', 'CBT2201925000001_mcn0_hardware', 'Temp_PCH', '82', '-10', '74', '-5', '66', '0'); +INSERT INTO `tsg_threshold` VALUES ('64', 'CBT2201925000001_mcn1_hardware', 'Temp_PCH', '82', '-10', '74', '-5', '66', '0'); +INSERT INTO `tsg_threshold` VALUES ('65', 'CBT2201925000001_mcn2_hardware', 'Temp_PCH', '82', '-10', '74', '-5', '66', '0'); +INSERT INTO `tsg_threshold` VALUES ('66', 'CBT2201925000001_mcn3_hardware', 'Temp_PCH', '82', '-10', '74', '-5', '66', '0'); +INSERT INTO `tsg_threshold` VALUES ('67', 'CBT2201925000001_mcn0_hardware', 'Temp_UL', '85', '-10', '75', '-5', '66', '0'); +INSERT INTO `tsg_threshold` VALUES ('68', 'CBT2201925000001_mcn1_hardware', 'Temp_UL', '85', '-10', '75', '-5', '66', '0'); +INSERT INTO `tsg_threshold` VALUES ('69', 'CBT2201925000001_mcn2_hardware', 'Temp_UL', '85', '-10', '75', '-5', '66', '0'); +INSERT INTO `tsg_threshold` VALUES ('70', 'CBT2201925000001_mcn3_hardware', 'Temp_UL', '85', '-10', '75', '-5', '66', '0'); +INSERT INTO `tsg_threshold` VALUES ('71', 'CBT2201925000001_mcn0_hardware', 'Temp_UR', '90', '-10', '80', '-5', '70', '0'); +INSERT INTO `tsg_threshold` VALUES ('72', 'CBT2201925000001_mcn1_hardware', 'Temp_UR', '90', '-10', '80', '-5', '70', '0'); +INSERT INTO `tsg_threshold` VALUES ('73', 'CBT2201925000001_mcn2_hardware', 'Temp_UR', '90', '-10', '80', '-5', '70', '0'); +INSERT INTO `tsg_threshold` VALUES ('74', 'CBT2201925000001_mcn3_hardware', 'Temp_UR', '90', '-10', '80', '-5', '70', '0'); +INSERT INTO `tsg_threshold` VALUES ('75', 'CBT2201925000001_mcn0_hardware', 'Temp_XL710_82599', '90', '-10', '80', '-5', '70', '0'); +INSERT INTO `tsg_threshold` VALUES ('76', 'CBT2201925000001_mcn1_hardware', 'Temp_XL710_82599', '90', '-10', '80', '-5', '70', '0'); +INSERT INTO `tsg_threshold` VALUES ('77', 'CBT2201925000001_mcn2_hardware', 'Temp_XL710_82599', '90', '-10', '80', '-5', '70', '0'); +INSERT INTO `tsg_threshold` VALUES ('78', 'CBT2201925000001_mcn3_hardware', 'Temp_XL710_82599', '90', '-10', '80', '-5', '70', '0'); +INSERT INTO `tsg_threshold` VALUES ('79', 'CBT2201925000001_mcn0_hardware', 'Temp_mIO0', '60', '-10', '50', '-5', '40', '0'); +INSERT INTO `tsg_threshold` VALUES ('80', 'CBT2201925000001_mcn1_hardware', 'Temp_mIO0', '60', '-10', '50', '-5', '40', '0'); +INSERT INTO `tsg_threshold` VALUES ('81', 'CBT2201925000001_mcn2_hardware', 'Temp_mIO0', '60', '-10', '50', '-5', '40', '0'); +INSERT INTO `tsg_threshold` VALUES ('82', 'CBT2201925000001_mcn3_hardware', 'Temp_mIO0', '60', '-10', '50', '-5', '40', '0'); +INSERT INTO `tsg_threshold` VALUES ('83', 'CBT2201925000001_mcn0_hardware', 'Temp_mIO1', '60', '-10', '50', '-5', '40', '0'); +INSERT INTO `tsg_threshold` VALUES ('84', 'CBT2201925000001_mcn1_hardware', 'Temp_mIO1', '60', '-10', '50', '-5', '40', '0'); +INSERT INTO `tsg_threshold` VALUES ('85', 'CBT2201925000001_mcn2_hardware', 'Temp_mIO1', '60', '-10', '50', '-5', '40', '0'); +INSERT INTO `tsg_threshold` VALUES ('86', 'CBT2201925000001_mcn3_hardware', 'Temp_mIO1', '60', '-10', '50', '-5', '40', '0'); +INSERT INTO `tsg_threshold` VALUES ('87', 'CBT2201925000001_mcn0_hardware', 'PECI_CPU0', '90', '-10', '80', '-5', '70', '0'); +INSERT INTO `tsg_threshold` VALUES ('88', 'CBT2201925000001_mcn1_hardware', 'PECI_CPU0', '90', '-10', '80', '-5', '70', '0'); +INSERT INTO `tsg_threshold` VALUES ('89', 'CBT2201925000001_mcn2_hardware', 'PECI_CPU0', '90', '-10', '80', '-5', '70', '0'); +INSERT INTO `tsg_threshold` VALUES ('90', 'CBT2201925000001_mcn3_hardware', 'PECI_CPU0', '90', '-10', '80', '-5', '70', '0'); +INSERT INTO `tsg_threshold` VALUES ('91', 'CBT2201925000001_mcn0_hardware', 'PECI_CPU1', '90', '-10', '80', '-5', '70', '0'); +INSERT INTO `tsg_threshold` VALUES ('92', 'CBT2201925000001_mcn1_hardware', 'PECI_CPU1', '90', '-10', '80', '-5', '70', '0'); +INSERT INTO `tsg_threshold` VALUES ('93', 'CBT2201925000001_mcn2_hardware', 'PECI_CPU1', '90', '-10', '80', '-5', '70', '0'); +INSERT INTO `tsg_threshold` VALUES ('94', 'CBT2201925000001_mcn3_hardware', 'PECI_CPU1', '90', '-10', '80', '-5', '70', '0'); +INSERT INTO `tsg_threshold` VALUES ('95', 'CBT2201925000001_mxn_cpu', 'laLoad_1', '99', null, '85', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('96', 'CBT2201925000001_mcn0_cpu', 'laLoad_1', '99', null, '85', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('97', 'CBT2201925000001_mcn1_cpu', 'laLoad_1', '99', null, '85', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('98', 'CBT2201925000001_mcn2_cpu', 'laLoad_1', '99', null, '85', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('99', 'CBT2201925000001_mcn3_cpu', 'laLoad_1', '99', null, '85', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('100', 'CBT2201925000001_mxn_cpu', 'laLoad_5', '99', null, '85', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('101', 'CBT2201925000001_mcn0_cpu', 'laLoad_5', '99', null, '85', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('102', 'CBT2201925000001_mcn1_cpu', 'laLoad_5', '99', null, '85', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('103', 'CBT2201925000001_mcn2_cpu', 'laLoad_5', '99', null, '85', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('104', 'CBT2201925000001_mcn3_cpu', 'laLoad_5', '99', null, '85', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('105', 'CBT2201925000001_mxn_cpu', 'laLoad_10', '99', null, '85', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('106', 'CBT2201925000001_mcn0_cpu', 'laLoad_10', '99', null, '85', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('107', 'CBT2201925000001_mcn1_cpu', 'laLoad_10', '99', null, '85', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('108', 'CBT2201925000001_mcn2_cpu', 'laLoad_10', '99', null, '85', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('109', 'CBT2201925000001_mcn3_cpu', 'laLoad_10', '99', null, '85', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('110', 'CBT2201925000001_mxn_cpu', 'ssCpuUser', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('111', 'CBT2201925000001_mcn0_cpu', 'ssCpuUser', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('112', 'CBT2201925000001_mcn1_cpu', 'ssCpuUser', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('113', 'CBT2201925000001_mcn2_cpu', 'ssCpuUser', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('114', 'CBT2201925000001_mcn3_cpu', 'ssCpuUser', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('115', 'CBT2201925000001_mxn_cpu', 'ssCpuSystem', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('116', 'CBT2201925000001_mcn0_cpu', 'ssCpuSystem', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('117', 'CBT2201925000001_mcn1_cpu', 'ssCpuSystem', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('118', 'CBT2201925000001_mcn2_cpu', 'ssCpuSystem', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('119', 'CBT2201925000001_mcn3_cpu', 'ssCpuSystem', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('120', 'CBT2201925000001_mxn_cpu', 'ssCpuIdle', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('121', 'CBT2201925000001_mcn0_cpu', 'ssCpuIdle', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('122', 'CBT2201925000001_mcn1_cpu', 'ssCpuIdle', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('123', 'CBT2201925000001_mcn2_cpu', 'ssCpuIdle', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('124', 'CBT2201925000001_mcn3_cpu', 'ssCpuIdle', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('125', 'CBT2201925000001_mxn_memory', 'memTotalReal', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('126', 'CBT2201925000001_mcn0_memory', 'memTotalReal', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('127', 'CBT2201925000001_mcn1_memory', 'memTotalReal', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('128', 'CBT2201925000001_mcn2_memory', 'memTotalReal', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('129', 'CBT2201925000001_mcn3_memory', 'memTotalReal', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('130', 'CBT2201925000001_mxn_memory', 'memAvailReal', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('131', 'CBT2201925000001_mcn0_memory', 'memAvailReal', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('132', 'CBT2201925000001_mcn1_memory', 'memAvailReal', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('133', 'CBT2201925000001_mcn2_memory', 'memAvailReal', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('134', 'CBT2201925000001_mcn3_memory', 'memAvailReal', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('135', 'CBT2201925000001_mxn_memory', 'memTotalSwap', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('136', 'CBT2201925000001_mcn0_memory', 'memTotalSwap', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('137', 'CBT2201925000001_mcn1_memory', 'memTotalSwap', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('138', 'CBT2201925000001_mcn2_memory', 'memTotalSwap', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('139', 'CBT2201925000001_mcn3_memory', 'memTotalSwap', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('140', 'CBT2201925000001_mxn_memory', 'memAvailSwap', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('141', 'CBT2201925000001_mcn0_memory', 'memAvailSwap', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('142', 'CBT2201925000001_mcn1_memory', 'memAvailSwap', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('143', 'CBT2201925000001_mcn2_memory', 'memAvailSwap', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('144', 'CBT2201925000001_mcn3_memory', 'memAvailSwap', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('145', 'CBT2201925000001_mxn_memory', 'memTotalFree', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('146', 'CBT2201925000001_mcn0_memory', 'memTotalFree', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('147', 'CBT2201925000001_mcn1_memory', 'memTotalFree', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('148', 'CBT2201925000001_mcn2_memory', 'memTotalFree', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('149', 'CBT2201925000001_mcn3_memory', 'memTotalFree', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('150', 'CBT2201925000001_mxn_disk', 'dskTotal', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('151', 'CBT2201925000001_mcn0_disk', 'dskTotal', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('152', 'CBT2201925000001_mcn1_disk', 'dskTotal', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('153', 'CBT2201925000001_mcn2_disk', 'dskTotal', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('154', 'CBT2201925000001_mcn3_disk', 'dskTotal', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('155', 'CBT2201925000001_mxn_disk', 'dskUsed', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('156', 'CBT2201925000001_mcn0_disk', 'dskUsed', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('157', 'CBT2201925000001_mcn1_disk', 'dskUsed', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('158', 'CBT2201925000001_mcn2_disk', 'dskUsed', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('159', 'CBT2201925000001_mcn3_disk', 'dskUsed', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('160', 'CBT2201925000001_mxn_disk', 'dskAvail', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('161', 'CBT2201925000001_mcn0_disk', 'dskAvail', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('162', 'CBT2201925000001_mcn1_disk', 'dskAvail', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('163', 'CBT2201925000001_mcn2_disk', 'dskAvail', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('164', 'CBT2201925000001_mcn3_disk', 'dskAvail', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('165', 'CBT2201925000001_mxn_disk', 'dskPercent', '99', null, '95', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('166', 'CBT2201925000001_mcn0_disk', 'dskPercent', '99', null, '95', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('167', 'CBT2201925000001_mcn1_disk', 'dskPercent', '99', null, '95', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('168', 'CBT2201925000001_mcn2_disk', 'dskPercent', '99', null, '95', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('169', 'CBT2201925000001_mcn3_disk', 'dskPercent', '99', null, '95', null, null, null); +INSERT INTO `tsg_threshold` VALUES ('170', 'CBT2201925000001_mxn_disk', 'dskPercentSled', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('171', 'CBT2201925000001_mcn0_disk', 'dskPercentSled', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('172', 'CBT2201925000001_mcn1_disk', 'dskPercentSled', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('173', 'CBT2201925000001_mcn2_disk', 'dskPercentSled', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('174', 'CBT2201925000001_mcn3_disk', 'dskPercentSled', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('175', 'CBT2201925000001_mxn_network_port_1', 'ifInOctets', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('176', 'CBT2201925000001_mxn_network_port_2', 'ifInOctets', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('177', 'CBT2201925000001_mxn_network_port_3', 'ifInOctets', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('178', 'CBT2201925000001_mxn_network_port_4', 'ifInOctets', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('179', 'CBT2201925000001_mxn_network_port_5', 'ifInOctets', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('180', 'CBT2201925000001_mxn_network_port_6', 'ifInOctets', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('181', 'CBT2201925000001_mxn_network_port_9', 'ifInOctets', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('182', 'CBT2201925000001_mxn_network_port_10', 'ifInOctets', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('183', 'CBT2201925000001_mxn_network_port_37', 'ifInOctets', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('184', 'CBT2201925000001_mxn_network_port_39', 'ifInOctets', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('185', 'CBT2201925000001_mxn_network_port_41', 'ifInOctets', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('186', 'CBT2201925000001_mxn_network_port_43', 'ifInOctets', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('187', 'CBT2201925000001_mxn_network_port_2', 'ifInUcastPkts', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('188', 'CBT2201925000001_mxn_network_port_3', 'ifInUcastPkts', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('189', 'CBT2201925000001_mxn_network_port_4', 'ifInUcastPkts', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('190', 'CBT2201925000001_mxn_network_port_5', 'ifInUcastPkts', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('191', 'CBT2201925000001_mxn_network_port_6', 'ifInUcastPkts', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('192', 'CBT2201925000001_mxn_network_port_9', 'ifInUcastPkts', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('193', 'CBT2201925000001_mxn_network_port_10', 'ifInUcastPkts', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('194', 'CBT2201925000001_mxn_network_port_37', 'ifInUcastPkts', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('195', 'CBT2201925000001_mxn_network_port_39', 'ifInUcastPkts', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('196', 'CBT2201925000001_mxn_network_port_41', 'ifInUcastPkts', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('197', 'CBT2201925000001_mxn_network_port_43', 'ifInUcastPkts', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('198', 'CBT2201925000001_mxn_network_port_1', 'ifInErrors', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('199', 'CBT2201925000001_mxn_network_port_2', 'ifInErrors', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('200', 'CBT2201925000001_mxn_network_port_3', 'ifInErrors', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('201', 'CBT2201925000001_mxn_network_port_4', 'ifInErrors', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('202', 'CBT2201925000001_mxn_network_port_5', 'ifInErrors', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('203', 'CBT2201925000001_mxn_network_port_6', 'ifInErrors', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('204', 'CBT2201925000001_mxn_network_port_9', 'ifInErrors', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('205', 'CBT2201925000001_mxn_network_port_10', 'ifInErrors', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('206', 'CBT2201925000001_mxn_network_port_37', 'ifInErrors', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('207', 'CBT2201925000001_mxn_network_port_39', 'ifInErrors', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('208', 'CBT2201925000001_mxn_network_port_41', 'ifInErrors', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('209', 'CBT2201925000001_mxn_network_port_43', 'ifInErrors', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('210', 'CBT2201925000001_mxn_network_port_1', 'ifOutOctets', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('211', 'CBT2201925000001_mxn_network_port_2', 'ifOutOctets', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('212', 'CBT2201925000001_mxn_network_port_3', 'ifOutOctets', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('213', 'CBT2201925000001_mxn_network_port_4', 'ifOutOctets', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('214', 'CBT2201925000001_mxn_network_port_5', 'ifOutOctets', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('215', 'CBT2201925000001_mxn_network_port_6', 'ifOutOctets', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('216', 'CBT2201925000001_mxn_network_port_9', 'ifOutOctets', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('217', 'CBT2201925000001_mxn_network_port_10', 'ifOutOctets', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('218', 'CBT2201925000001_mxn_network_port_37', 'ifOutOctets', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('219', 'CBT2201925000001_mxn_network_port_39', 'ifOutOctets', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('220', 'CBT2201925000001_mxn_network_port_41', 'ifOutOctets', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('221', 'CBT2201925000001_mxn_network_port_43', 'ifOutOctets', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('222', 'CBT2201925000001_mxn_network_port_1', 'ifOutUcastPkts', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('223', 'CBT2201925000001_mxn_network_port_2', 'ifOutUcastPkts', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('224', 'CBT2201925000001_mxn_network_port_3', 'ifOutUcastPkts', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('225', 'CBT2201925000001_mxn_network_port_4', 'ifOutUcastPkts', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('226', 'CBT2201925000001_mxn_network_port_5', 'ifOutUcastPkts', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('227', 'CBT2201925000001_mxn_network_port_6', 'ifOutUcastPkts', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('228', 'CBT2201925000001_mxn_network_port_9', 'ifOutUcastPkts', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('229', 'CBT2201925000001_mxn_network_port_10', 'ifOutUcastPkts', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('230', 'CBT2201925000001_mxn_network_port_37', 'ifOutUcastPkts', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('231', 'CBT2201925000001_mxn_network_port_39', 'ifOutUcastPkts', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('232', 'CBT2201925000001_mxn_network_port_41', 'ifOutUcastPkts', null, null, null, null, null, null); +INSERT INTO `tsg_threshold` VALUES ('233', 'CBT2201925000001_mxn_network_port_43', 'ifOutUcastPkts', null, null, null, null, null, null); diff --git a/roles/mariadb/tasks/main.yml b/roles/mariadb/tasks/main.yml index ad6c176..94aad9e 100644 --- a/roles/mariadb/tasks/main.yml +++ b/roles/mariadb/tasks/main.yml @@ -69,7 +69,9 @@ shell: cd /home/database/mysql/scripts;./mysql_install_db --basedir=/home/database/mysql --datadir=/home/database/dbdata --user=mysql - name: "set my.cnf" - shell: cd /home/database/mysql/support-files;cp my-huge.cnf /etc/mysql/my.cnf + copy: + src: "{{ role_path }}/files/my.cnf" + dest: "/etc/mysql/my.cnf" - name: "copy mariadb" copy: diff --git a/roles/oam_cli/files/oam_cli-1.0-1.0.x86_64.rpm b/roles/oam_cli/files/oam_cli-1.0-1.0.x86_64.rpm new file mode 100644 index 0000000..ca061a0 Binary files /dev/null and b/roles/oam_cli/files/oam_cli-1.0-1.0.x86_64.rpm differ diff --git a/roles/oam_cli/tasks/main.yml b/roles/oam_cli/tasks/main.yml new file mode 100644 index 0000000..b109b46 --- /dev/null +++ b/roles/oam_cli/tasks/main.yml @@ -0,0 +1,16 @@ +- name: "copy oam_cli.rpm to destination server" + copy: + src: "{{ role_path }}/files/" + dest: /tmp + +- name: "install oam_cli" + yum: + name: + - /tmp/oam_cli-1.0-1.0.x86_64.rpm + state: present + +- name: "Templates application.properties" + template: + src: "{{role_path}}/templates/application.properties.j2" + dest: /opt/tsg/oam_cli/application.properties + tags: template diff --git a/roles/oam_cli/templates/application.properties.j2 b/roles/oam_cli/templates/application.properties.j2 new file mode 100755 index 0000000..e335ec0 --- /dev/null +++ b/roles/oam_cli/templates/application.properties.j2 @@ -0,0 +1,27 @@ +cli.help=/opt/tsg/cli/help.txt +# 设置宽字符(在linux控制台上打印时占2位)- CJK_SYMBOLS_AND_PUNCTUATION +cli.unicodeblock.wide=CJK_UNIFIED_IDEOGRAPHS,CJK_COMPATIBILITY_IDEOGRAPHS,CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A,CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B,CJK_UNIFIED_IDEOGRAPHS_EXTENSION_C,CJK_UNIFIED_IDEOGRAPHS_EXTENSION_D,HALFWIDTH_AND_FULLWIDTH_FORMS + +mxn.config=/opt/tsg/etc/tsg_chassis_ip.json +port.config=/opt/tsg/etc/tsg_chassis_port.json +sn.config=/opt/tsg/etc/tsg_sn.json +tags.config=/opt/tsg/etc/tsg_tags.json +cli.agent.port=50222 + +# oam.influx.url=http://192.168.161.134:8086 +oam.influx.url=http://{{ mcn0_ip }}:58086 +oam.influx.db=tsg_stat +oam.influx.user=admin +oam.influx.password=tsg2019 + +oam.cli.user.admin=tsgadmin +oam.cli.user.user=tsguser + +cli.rest.root=http://192.168.40.4:8082/v1 +#cli.rest.root=http://192.168.40.4:8082/v1 +cli.rest.login=${cli.rest.root}/user/login +cli.rest.policy=${cli.rest.root}/policy/compile +cli.rest.policy.object=${cli.rest.root}/policy/object +cli.rest.policy.object.batch=${cli.rest.root}/policy/object/batch + +oam.rest.timeout=10000 diff --git a/roles/oam_cli_agent/files/oam_cli_agent-1.0-1.0.x86_64.rpm b/roles/oam_cli_agent/files/oam_cli_agent-1.0-1.0.x86_64.rpm new file mode 100644 index 0000000..82564c5 Binary files /dev/null and b/roles/oam_cli_agent/files/oam_cli_agent-1.0-1.0.x86_64.rpm differ diff --git a/roles/oam_cli_agent/tasks/main.yml b/roles/oam_cli_agent/tasks/main.yml new file mode 100644 index 0000000..c0fb8d7 --- /dev/null +++ b/roles/oam_cli_agent/tasks/main.yml @@ -0,0 +1,31 @@ +- 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 + +- name: "Templates snmpd.conf" + template: + src: "{{role_path}}/templates/snmpd.conf" + dest: /usr/share/snmp/snmpd.conf + tags: template + +- name: "Start snmpd" + systemd: + name: snmpd + state: restarted + enabled: yes + +- name: "Start oam_cli_agent" + systemd: + name: oam_cli_agent + state: restarted + enabled: yes diff --git a/roles/oam_cli_agent/templates/snmpd.conf b/roles/oam_cli_agent/templates/snmpd.conf new file mode 100644 index 0000000..9df8575 --- /dev/null +++ b/roles/oam_cli_agent/templates/snmpd.conf @@ -0,0 +1,473 @@ +############################################################################### +# +# snmpd.conf: +# An example configuration file for configuring the ucd-snmp snmpd agent. +# +############################################################################### +# +# This file is intended to only be as a starting point. Many more +# configuration directives exist than are mentioned in this file. For +# full details, see the snmpd.conf(5) manual page. +# +# All lines beginning with a '#' are comments and are intended for you +# to read. All other lines are configuration commands for the agent. + +############################################################################### +# Access Control +############################################################################### + +# As shipped, the snmpd demon will only respond to queries on the +# system mib group until this file is replaced or modified for +# security purposes. Examples are shown below about how to increase the +# level of access. + +# By far, the most common question I get about the agent is "why won't +# it work?", when really it should be "how do I configure the agent to +# allow me to access it?" +# +# By default, the agent responds to the "public" community for read +# only access, if run out of the box without any configuration file in +# place. The following examples show you other ways of configuring +# the agent so that you can change the community names, and give +# yourself write access to the mib tree as well. +# +# For more information, read the FAQ as well as the snmpd.conf(5) +# manual page. + +#### +# First, map the community name "public" into a "security name" + +# sec.name source community +com2sec notConfigUser default public + +#### +# Second, map the security name into a group name: + +# groupName securityModel securityName +group notConfigGroup v1 notConfigUser +group notConfigGroup v2c notConfigUser + +#### +# Third, create a view for us to let the group have rights to: + +# Make at least snmpwalk -v 1 localhost -c public system fast again. +# name incl/excl subtree mask(optional) +view systemview included .1.3.6.1.2.1.1 +view systemview included .1.3.6.1.2.1.25.1.1 +view systemview included .1.3.6.1.4.1.2021 + +view systemview included .1.3.6.1.4.1.2021.10.1.3 +view systemview included .1.3.6.1.4.1.2021.11 +view systemview included .1.3.6.1.4.1.2021.4 +view systemview included .1.3.6.1.4.1.2021.9.1 +disk / 10000 +includeAllDisks 10% + + +#### +# Finally, grant the group read-only access to the systemview view. + +# group context sec.model sec.level prefix read write notif +access notConfigGroup "" any noauth exact systemview none none + +# ----------------------------------------------------------------------------- + +# Here is a commented out example configuration that allows less +# restrictive access. + +# YOU SHOULD CHANGE THE "COMMUNITY" TOKEN BELOW TO A NEW KEYWORD ONLY +# KNOWN AT YOUR SITE. YOU *MUST* CHANGE THE NETWORK TOKEN BELOW TO +# SOMETHING REFLECTING YOUR LOCAL NETWORK ADDRESS SPACE. + +## sec.name source community +#com2sec local localhost COMMUNITY +#com2sec mynetwork NETWORK/24 COMMUNITY + +## group.name sec.model sec.name +#group MyRWGroup any local +#group MyROGroup any mynetwork +# +#group MyRWGroup any otherv3user +#... + +## incl/excl subtree mask +#view all included .1 80 + +## -or just the mib2 tree- + +#view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc + + +## context sec.model sec.level prefix read write notif +#access MyROGroup "" any noauth 0 all none none +#access MyRWGroup "" any noauth 0 all all all + + +############################################################################### +# Sample configuration to make net-snmpd RFC 1213. +# Unfortunately v1 and v2c don't allow any user based authentification, so +# opening up the default config is not an option from a security point. +# +# WARNING: If you uncomment the following lines you allow write access to your +# snmpd daemon from any source! To avoid this use different names for your +# community or split out the write access to a different community and +# restrict it to your local network. +# Also remember to comment the syslocation and syscontact parameters later as +# otherwise they are still read only (see FAQ for net-snmp). +# + +# First, map the community name "public" into a "security name" +# sec.name source community +#com2sec notConfigUser default public + +# Second, map the security name into a group name: +# groupName securityModel securityName +#group notConfigGroup v1 notConfigUser +#group notConfigGroup v2c notConfigUser + +# Third, create a view for us to let the group have rights to: +# Open up the whole tree for ro, make the RFC 1213 required ones rw. +# name incl/excl subtree mask(optional) +#view roview included .1 +#view rwview included system.sysContact +#view rwview included system.sysName +#view rwview included system.sysLocation +#view rwview included interfaces.ifTable.ifEntry.ifAdminStatus +#view rwview included at.atTable.atEntry.atPhysAddress +#view rwview included at.atTable.atEntry.atNetAddress +#view rwview included ip.ipForwarding +#view rwview included ip.ipDefaultTTL +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteDest +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteIfIndex +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric1 +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric2 +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric3 +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric4 +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteType +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteAge +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMask +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric5 +#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaIfIndex +#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaPhysAddress +#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaNetAddress +#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType +#view rwview included tcp.tcpConnTable.tcpConnEntry.tcpConnState +#view rwview included egp.egpNeighTable.egpNeighEntry.egpNeighEventTrigger +#view rwview included snmp.snmpEnableAuthenTraps + +# Finally, grant the group read-only access to the systemview view. +# group context sec.model sec.level prefix read write notif +#access notConfigGroup "" any noauth exact roview rwview none + + + +############################################################################### +# System contact information +# + +# It is also possible to set the sysContact and sysLocation system +# variables through the snmpd.conf file: + +syslocation Unknown (edit /etc/snmp/snmpd.conf) +syscontact Root (configure /etc/snmp/snmp.local.conf) + +# Example output of snmpwalk: +# % snmpwalk -v 1 localhost -c public system +# system.sysDescr.0 = "SunOS name sun4c" +# system.sysObjectID.0 = OID: enterprises.ucdavis.ucdSnmpAgent.sunos4 +# system.sysUpTime.0 = Timeticks: (595637548) 68 days, 22:32:55 +# system.sysContact.0 = "Me " +# system.sysName.0 = "name" +# system.sysLocation.0 = "Right here, right now." +# system.sysServices.0 = 72 + + +############################################################################### +# Logging +# + +# We do not want annoying "Connection from UDP: " messages in syslog. +# If the following option is commented out, snmpd will print each incoming +# connection, which can be useful for debugging. + +dontLogTCPWrappersConnects yes + +# ----------------------------------------------------------------------------- + + +############################################################################### +# Process checks. +# +# The following are examples of how to use the agent to check for +# processes running on the host. The syntax looks something like: +# +# proc NAME [MAX=0] [MIN=0] +# +# NAME: the name of the process to check for. It must match +# exactly (ie, http will not find httpd processes). +# MAX: the maximum number allowed to be running. Defaults to 0. +# MIN: the minimum number to be running. Defaults to 0. + +# +# Examples (commented out by default): +# + +# Make sure mountd is running +#proc mountd + +# Make sure there are no more than 4 ntalkds running, but 0 is ok too. +#proc ntalkd 4 + +# Make sure at least one sendmail, but less than or equal to 10 are running. +#proc sendmail 10 1 + +# A snmpwalk of the process mib tree would look something like this: +# +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.2 +# enterprises.ucdavis.procTable.prEntry.prIndex.1 = 1 +# enterprises.ucdavis.procTable.prEntry.prIndex.2 = 2 +# enterprises.ucdavis.procTable.prEntry.prIndex.3 = 3 +# enterprises.ucdavis.procTable.prEntry.prNames.1 = "mountd" +# enterprises.ucdavis.procTable.prEntry.prNames.2 = "ntalkd" +# enterprises.ucdavis.procTable.prEntry.prNames.3 = "sendmail" +# enterprises.ucdavis.procTable.prEntry.prMin.1 = 0 +# enterprises.ucdavis.procTable.prEntry.prMin.2 = 0 +# enterprises.ucdavis.procTable.prEntry.prMin.3 = 1 +# enterprises.ucdavis.procTable.prEntry.prMax.1 = 0 +# enterprises.ucdavis.procTable.prEntry.prMax.2 = 4 +# enterprises.ucdavis.procTable.prEntry.prMax.3 = 10 +# enterprises.ucdavis.procTable.prEntry.prCount.1 = 0 +# enterprises.ucdavis.procTable.prEntry.prCount.2 = 0 +# enterprises.ucdavis.procTable.prEntry.prCount.3 = 1 +# enterprises.ucdavis.procTable.prEntry.prErrorFlag.1 = 1 +# enterprises.ucdavis.procTable.prEntry.prErrorFlag.2 = 0 +# enterprises.ucdavis.procTable.prEntry.prErrorFlag.3 = 0 +# enterprises.ucdavis.procTable.prEntry.prErrMessage.1 = "No mountd process running." +# enterprises.ucdavis.procTable.prEntry.prErrMessage.2 = "" +# enterprises.ucdavis.procTable.prEntry.prErrMessage.3 = "" +# enterprises.ucdavis.procTable.prEntry.prErrFix.1 = 0 +# enterprises.ucdavis.procTable.prEntry.prErrFix.2 = 0 +# enterprises.ucdavis.procTable.prEntry.prErrFix.3 = 0 +# +# Note that the errorFlag for mountd is set to 1 because one is not +# running (in this case an rpc.mountd is, but thats not good enough), +# and the ErrMessage tells you what's wrong. The configuration +# imposed in the snmpd.conf file is also shown. +# +# Special Case: When the min and max numbers are both 0, it assumes +# you want a max of infinity and a min of 1. +# + + +# ----------------------------------------------------------------------------- + + +############################################################################### +# Executables/scripts +# + +# +# You can also have programs run by the agent that return a single +# line of output and an exit code. Here are two examples. +# +# exec NAME PROGRAM [ARGS ...] +# +# NAME: A generic name. The name must be unique for each exec statement. +# PROGRAM: The program to run. Include the path! +# ARGS: optional arguments to be passed to the program + +# a simple hello world + +#exec echotest /bin/echo hello world + +# Run a shell script containing: +# +# #!/bin/sh +# echo hello world +# echo hi there +# exit 35 +# +# Note: this has been specifically commented out to prevent +# accidental security holes due to someone else on your system writing +# a /tmp/shtest before you do. Uncomment to use it. +# +#exec shelltest /bin/sh /tmp/shtest + +# Then, +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.8 +# enterprises.ucdavis.extTable.extEntry.extIndex.1 = 1 +# enterprises.ucdavis.extTable.extEntry.extIndex.2 = 2 +# enterprises.ucdavis.extTable.extEntry.extNames.1 = "echotest" +# enterprises.ucdavis.extTable.extEntry.extNames.2 = "shelltest" +# enterprises.ucdavis.extTable.extEntry.extCommand.1 = "/bin/echo hello world" +# enterprises.ucdavis.extTable.extEntry.extCommand.2 = "/bin/sh /tmp/shtest" +# enterprises.ucdavis.extTable.extEntry.extResult.1 = 0 +# enterprises.ucdavis.extTable.extEntry.extResult.2 = 35 +# enterprises.ucdavis.extTable.extEntry.extOutput.1 = "hello world." +# enterprises.ucdavis.extTable.extEntry.extOutput.2 = "hello world." +# enterprises.ucdavis.extTable.extEntry.extErrFix.1 = 0 +# enterprises.ucdavis.extTable.extEntry.extErrFix.2 = 0 + +# Note that the second line of the /tmp/shtest shell script is cut +# off. Also note that the exit status of 35 was returned. + +# ----------------------------------------------------------------------------- + + +############################################################################### +# disk checks +# + +# The agent can check the amount of available disk space, and make +# sure it is above a set limit. + +# disk PATH [MIN=100000] +# +# PATH: mount path to the disk in question. +# MIN: Disks with space below this value will have the Mib's errorFlag set. +# Default value = 100000. + +# Check the / partition and make sure it contains at least 10 megs. + +#disk / 10000 + +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.9 +# enterprises.ucdavis.diskTable.dskEntry.diskIndex.1 = 0 +# enterprises.ucdavis.diskTable.dskEntry.diskPath.1 = "/" Hex: 2F +# enterprises.ucdavis.diskTable.dskEntry.diskDevice.1 = "/dev/dsk/c201d6s0" +# enterprises.ucdavis.diskTable.dskEntry.diskMinimum.1 = 10000 +# enterprises.ucdavis.diskTable.dskEntry.diskTotal.1 = 837130 +# enterprises.ucdavis.diskTable.dskEntry.diskAvail.1 = 316325 +# enterprises.ucdavis.diskTable.dskEntry.diskUsed.1 = 437092 +# enterprises.ucdavis.diskTable.dskEntry.diskPercent.1 = 58 +# enterprises.ucdavis.diskTable.dskEntry.diskErrorFlag.1 = 0 +# enterprises.ucdavis.diskTable.dskEntry.diskErrorMsg.1 = "" + +# ----------------------------------------------------------------------------- + + +############################################################################### +# load average checks +# + +# load [1MAX=12.0] [5MAX=12.0] [15MAX=12.0] +# +# 1MAX: If the 1 minute load average is above this limit at query +# time, the errorFlag will be set. +# 5MAX: Similar, but for 5 min average. +# 15MAX: Similar, but for 15 min average. + +# Check for loads: +#load 12 14 14 + +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.10 +# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.1 = 1 +# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.2 = 2 +# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.3 = 3 +# enterprises.ucdavis.loadTable.laEntry.loadaveNames.1 = "Load-1" +# enterprises.ucdavis.loadTable.laEntry.loadaveNames.2 = "Load-5" +# enterprises.ucdavis.loadTable.laEntry.loadaveNames.3 = "Load-15" +# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.1 = "0.49" Hex: 30 2E 34 39 +# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.2 = "0.31" Hex: 30 2E 33 31 +# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.3 = "0.26" Hex: 30 2E 32 36 +# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.1 = "12.00" +# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.2 = "14.00" +# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.3 = "14.00" +# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.1 = 0 +# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.2 = 0 +# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.3 = 0 +# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.1 = "" +# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.2 = "" +# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.3 = "" + +# ----------------------------------------------------------------------------- + + +############################################################################### +# Extensible sections. +# + +# This alleviates the multiple line output problem found in the +# previous executable mib by placing each mib in its own mib table: + +# Run a shell script containing: +# +# #!/bin/sh +# echo hello world +# echo hi there +# exit 35 +# +# Note: this has been specifically commented out to prevent +# accidental security holes due to someone else on your system writing +# a /tmp/shtest before you do. Uncomment to use it. +# +# exec .1.3.6.1.4.1.2021.50 shelltest /bin/sh /tmp/shtest + +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.50 +# enterprises.ucdavis.50.1.1 = 1 +# enterprises.ucdavis.50.2.1 = "shelltest" +# enterprises.ucdavis.50.3.1 = "/bin/sh /tmp/shtest" +# enterprises.ucdavis.50.100.1 = 35 +# enterprises.ucdavis.50.101.1 = "hello world." +# enterprises.ucdavis.50.101.2 = "hi there." +# enterprises.ucdavis.50.102.1 = 0 + +# Now the Output has grown to two lines, and we can see the 'hi +# there.' output as the second line from our shell script. +# +# Note that you must alter the mib.txt file to be correct if you want +# the .50.* outputs above to change to reasonable text descriptions. + +# Other ideas: +# +# exec .1.3.6.1.4.1.2021.51 ps /bin/ps +# exec .1.3.6.1.4.1.2021.52 top /usr/local/bin/top +# exec .1.3.6.1.4.1.2021.53 mailq /usr/bin/mailq + +# ----------------------------------------------------------------------------- + + +############################################################################### +# Pass through control. +# + +# Usage: +# pass MIBOID EXEC-COMMAND +# +# This will pass total control of the mib underneath the MIBOID +# portion of the mib to the EXEC-COMMAND. +# +# Note: You'll have to change the path of the passtest script to your +# source directory or install it in the given location. +# +# Example: (see the script for details) +# (commented out here since it requires that you place the +# script in the right location. (its not installed by default)) + +# pass .1.3.6.1.4.1.2021.255 /bin/sh /usr/local/local/passtest + +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.255 +# enterprises.ucdavis.255.1 = "life the universe and everything" +# enterprises.ucdavis.255.2.1 = 42 +# enterprises.ucdavis.255.2.2 = OID: 42.42.42 +# enterprises.ucdavis.255.3 = Timeticks: (363136200) 42 days, 0:42:42 +# enterprises.ucdavis.255.4 = IpAddress: 127.0.0.1 +# enterprises.ucdavis.255.5 = 42 +# enterprises.ucdavis.255.6 = Gauge: 42 +# +# % snmpget -v 1 localhost public .1.3.6.1.4.1.2021.255.5 +# enterprises.ucdavis.255.5 = 42 +# +# % snmpset -v 1 localhost public .1.3.6.1.4.1.2021.255.1 s "New string" +# enterprises.ucdavis.255.1 = "New string" +# + +# For specific usage information, see the man/snmpd.conf.5 manual page +# as well as the local/passtest script used in the above example. + +############################################################################### +# Further Information +# +# See the snmpd.conf manual page, and the output of "snmpd -H". +disk / 10000 +includeAllDisks 10% diff --git a/roles/oam_cli_agent_mxn/files/oam_cli_agent_mxn-1.0-1.0.x86_64.rpm b/roles/oam_cli_agent_mxn/files/oam_cli_agent_mxn-1.0-1.0.x86_64.rpm new file mode 100644 index 0000000..0a4274c Binary files /dev/null and b/roles/oam_cli_agent_mxn/files/oam_cli_agent_mxn-1.0-1.0.x86_64.rpm differ diff --git a/roles/oam_cli_agent_mxn/tasks/main.yml b/roles/oam_cli_agent_mxn/tasks/main.yml new file mode 100644 index 0000000..b7d3e2d --- /dev/null +++ b/roles/oam_cli_agent_mxn/tasks/main.yml @@ -0,0 +1,16 @@ +- 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: "Start oam_cli_agent_mxn" + systemd: + name: oam_cli_agent_mxn + state: restarted + enabled: yes diff --git a/roles/oam_cluster/files/oam_cluster-1.0-1.0.x86_64.rpm b/roles/oam_cluster/files/oam_cluster-1.0-1.0.x86_64.rpm new file mode 100644 index 0000000..626e01c Binary files /dev/null and b/roles/oam_cluster/files/oam_cluster-1.0-1.0.x86_64.rpm differ diff --git a/roles/oam_cluster/tasks/main.yml b/roles/oam_cluster/tasks/main.yml new file mode 100644 index 0000000..76bc72e --- /dev/null +++ b/roles/oam_cluster/tasks/main.yml @@ -0,0 +1,16 @@ +- name: "copy oam_cluster.rpm to destination server" + copy: + src: "{{ role_path }}/files/" + dest: /tmp + +- name: "install oam_cluster" + yum: + name: + - /tmp/oam_cluster-1.0-1.0.x86_64.rpm + state: present + +- name: "Start oam_cluster" + systemd: + name: oam_cluster + state: restarted + enabled: yes 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 new file mode 100644 index 0000000..4e37a8c Binary files /dev/null and b/roles/oam_core/files/oam_core-1.0-1.0.x86_64.rpm differ diff --git a/roles/oam_core/task/main.yml b/roles/oam_core/task/main.yml new file mode 100644 index 0000000..d621744 --- /dev/null +++ b/roles/oam_core/task/main.yml @@ -0,0 +1,16 @@ +- name: "copy oam_core.rpm to destination server" + copy: + src: "{{ role_path }}/files/" + dest: /tmp + +- name: "install oam_core" + yum: + name: + - /tmp/oam_core-1.0-1.0.x86_64.rpm + state: present + +- name: "Templates application-centos2.properties" + template: + src: "{{role_path}}/templates/application-centos2.properties.j2" + dest: /opt/tsg/oam_core/application-centos2.properties + tags: template diff --git a/roles/oam_core/templates/application-centos2.properties.j2 b/roles/oam_core/templates/application-centos2.properties.j2 new file mode 100644 index 0000000..955e084 --- /dev/null +++ b/roles/oam_core/templates/application-centos2.properties.j2 @@ -0,0 +1,53 @@ +sn.config=/opt/tsg/etc/tsg_sn.json +mxn.config=/opt/tsg/etc/tsg_chassis_ip.json +tags.config=/opt/tsg/etc/tsg_tags.json +port.config=/opt/tsg/etc/tsg_chassis_port.json + +mxn.dir=/opt/tsg/bin/ +mxn.tsg_software_reboot=${mxn.dir}tsg_software_reboot +mxn.tsg_hardware_reboot=${mxn.dir}tsg_hardware_reboot + +oam.syslog.dir=/var/log +# 系统日志最近处理时间保存文件 +oam.syslog.time.file=/opt/tsg/oam_core/syslog_time.txt + +ipmi.sensor.mxn=ipmitool sensor +ipmi.sensor.mcn0=ipmitool -t 0x90 sensor +ipmi.sensor.mcn1=ipmitool -t 0x80 sensor +ipmi.sensor.mcn2=ipmitool -t 0x98 sensor +ipmi.sensor.mcn3=ipmitool -t 0x88 sensor +ipmi.fru.mxn=ipmitool fru +ipmi.fru.mcn0=ipmitool -t 0x90 fru +ipmi.fru.mcn1=ipmitool -t 0x80 fru +ipmi.fru.mcn2=ipmitool -t 0x98 fru +ipmi.fru.mcn3=ipmitool -t 0x88 fru +network.data=/opt/tsg/oam_core/shell/network.sh + +# 本机influx和mariadb地址 +oam.local.server.ip={{ mcn0_ip }} +# 集群influx和mariadb地址 +oam.cluster.server.ip={{ influxdb.cluster_ip }} +# influxdb端口 +oam.influx.port=58086 + +# influxdb - cluster +oam.writer.influxcluster.db=tsg_stat + +# datasource - local +datasource.first.password=tsg2019 + +# datasource - cluster +datasource.second.username=root +datasource.second.password=111111 + + +oam.writer.scheduler.interval=60000 +oam.writer.scheduler.ipmi.interval=180000 + +logging.level.com.cs.oam=ERROR + +# Absolute path +oam.rest.oam_core=/opt/tsg/oam_core/application-centos2.properties +oam.rest.oam_snmp=/opt/tsg/snmp/application.properties +#oam.rest.cli_agent=opt/tsg/snmp/application-centos2.properties +oam.rest.cli=/home/tsgroot/opt/tsg/cli/application.properties diff --git a/roles/oam_core_start/tasks/main.yml b/roles/oam_core_start/tasks/main.yml new file mode 100644 index 0000000..95900c8 --- /dev/null +++ b/roles/oam_core_start/tasks/main.yml @@ -0,0 +1,5 @@ +- name: "Start oam_core" + systemd: + name: oam_core + state: restarted + enabled: yes diff --git a/roles/oam_snmp/files/oam_snmp-1.0-1.0.x86_64.rpm b/roles/oam_snmp/files/oam_snmp-1.0-1.0.x86_64.rpm new file mode 100644 index 0000000..143b57c Binary files /dev/null and b/roles/oam_snmp/files/oam_snmp-1.0-1.0.x86_64.rpm differ diff --git a/roles/oam_snmp/tasks/main.yml b/roles/oam_snmp/tasks/main.yml new file mode 100644 index 0000000..263e27d --- /dev/null +++ b/roles/oam_snmp/tasks/main.yml @@ -0,0 +1,37 @@ +- name: "copy oam_snmp.rpm to destination server" + copy: + src: "{{ role_path }}/files/" + dest: /tmp + +- name: "install oam_snmp" + yum: + name: + - /tmp/oam_snmp-1.0-1.0.x86_64.rpm + state: present + +- name: "Templates application-centos2.properties" + template: + src: "{{role_path}}/templates/application.properties.j2" + dest: /opt/tsg/oam_snmp/application.properties + tags: template + +- name: "Start oam_snmp" + systemd: + name: oam_snmp + state: restarted + enabled: yes + +- name: "bak snmpd.conf" + shell: cp -rf /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf_origin + +- name: "Templates snmpd.conf" + template: + src: "{{role_path}}/templates/snmpd.conf" + dest: /etc/snmp/snmpd.conf + tags: template + +- name: "Start snmpd" + systemd: + name: snmpd + state: restarted + enabled: yes diff --git a/roles/oam_snmp/templates/application.properties b/roles/oam_snmp/templates/application.properties new file mode 100644 index 0000000..4a027d2 --- /dev/null +++ b/roles/oam_snmp/templates/application.properties @@ -0,0 +1,6 @@ +oam.influx.url=http://{{ mcn0_ip }}:58086 +# oam.influx.url=http://192.168.161.134:8086 +oam.influx.db=tsg_stat +oam.influx.user=admin +oam.influx.password=tsg2019 +oam.influx.recentminutes=5 diff --git a/roles/oam_snmp/templates/snmpd.conf b/roles/oam_snmp/templates/snmpd.conf new file mode 100644 index 0000000..c7c66b4 --- /dev/null +++ b/roles/oam_snmp/templates/snmpd.conf @@ -0,0 +1,468 @@ +############################################################################### +# +# snmpd.conf: +# An example configuration file for configuring the ucd-snmp snmpd agent. +# +############################################################################### +# +# This file is intended to only be as a starting point. Many more +# configuration directives exist than are mentioned in this file. For +# full details, see the snmpd.conf(5) manual page. +# +# All lines beginning with a '#' are comments and are intended for you +# to read. All other lines are configuration commands for the agent. + +############################################################################### +# Access Control +############################################################################### + +# As shipped, the snmpd demon will only respond to queries on the +# system mib group until this file is replaced or modified for +# security purposes. Examples are shown below about how to increase the +# level of access. + +# By far, the most common question I get about the agent is "why won't +# it work?", when really it should be "how do I configure the agent to +# allow me to access it?" +# +# By default, the agent responds to the "public" community for read +# only access, if run out of the box without any configuration file in +# place. The following examples show you other ways of configuring +# the agent so that you can change the community names, and give +# yourself write access to the mib tree as well. +# +# For more information, read the FAQ as well as the snmpd.conf(5) +# manual page. + +#### +# First, map the community name "public" into a "security name" + +# sec.name source community +com2sec notConfigUser default public + +#### +# Second, map the security name into a group name: + +# groupName securityModel securityName +group notConfigGroup v1 notConfigUser +group notConfigGroup v2c notConfigUser + +#### +# Third, create a view for us to let the group have rights to: + +# Make at least snmpwalk -v 1 localhost -c public system fast again. +# name incl/excl subtree mask(optional) +view systemview included .1.3.6.1.2.1.1 +view systemview included .1.3.6.1.2.1.25.1.1 + +#### +# Finally, grant the group read-only access to the systemview view. + +# group context sec.model sec.level prefix read write notif +access notConfigGroup "" any noauth exact systemview none none + +# ----------------------------------------------------------------------------- + +# Here is a commented out example configuration that allows less +# restrictive access. + +# YOU SHOULD CHANGE THE "COMMUNITY" TOKEN BELOW TO A NEW KEYWORD ONLY +# KNOWN AT YOUR SITE. YOU *MUST* CHANGE THE NETWORK TOKEN BELOW TO +# SOMETHING REFLECTING YOUR LOCAL NETWORK ADDRESS SPACE. + +## sec.name source community +#com2sec local localhost COMMUNITY +#com2sec mynetwork NETWORK/24 COMMUNITY + +## group.name sec.model sec.name +#group MyRWGroup any local +#group MyROGroup any mynetwork +# +#group MyRWGroup any otherv3user +#... + +## incl/excl subtree mask +#view all included .1 80 + +## -or just the mib2 tree- + +#view mib2 included .iso.org.dod.internet.mgmt.mib-2 fc + + +## context sec.model sec.level prefix read write notif +#access MyROGroup "" any noauth 0 all none none +#access MyRWGroup "" any noauth 0 all all all + + +############################################################################### +# Sample configuration to make net-snmpd RFC 1213. +# Unfortunately v1 and v2c don't allow any user based authentification, so +# opening up the default config is not an option from a security point. +# +# WARNING: If you uncomment the following lines you allow write access to your +# snmpd daemon from any source! To avoid this use different names for your +# community or split out the write access to a different community and +# restrict it to your local network. +# Also remember to comment the syslocation and syscontact parameters later as +# otherwise they are still read only (see FAQ for net-snmp). +# + +# First, map the community name "public" into a "security name" +# sec.name source community +#com2sec notConfigUser default public + +# Second, map the security name into a group name: +# groupName securityModel securityName +#group notConfigGroup v1 notConfigUser +#group notConfigGroup v2c notConfigUser + +# Third, create a view for us to let the group have rights to: +# Open up the whole tree for ro, make the RFC 1213 required ones rw. +# name incl/excl subtree mask(optional) +#view roview included .1 +#view rwview included system.sysContact +#view rwview included system.sysName +#view rwview included system.sysLocation +#view rwview included interfaces.ifTable.ifEntry.ifAdminStatus +#view rwview included at.atTable.atEntry.atPhysAddress +#view rwview included at.atTable.atEntry.atNetAddress +#view rwview included ip.ipForwarding +#view rwview included ip.ipDefaultTTL +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteDest +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteIfIndex +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric1 +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric2 +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric3 +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric4 +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteType +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteAge +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMask +#view rwview included ip.ipRouteTable.ipRouteEntry.ipRouteMetric5 +#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaIfIndex +#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaPhysAddress +#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaNetAddress +#view rwview included ip.ipNetToMediaTable.ipNetToMediaEntry.ipNetToMediaType +#view rwview included tcp.tcpConnTable.tcpConnEntry.tcpConnState +#view rwview included egp.egpNeighTable.egpNeighEntry.egpNeighEventTrigger +#view rwview included snmp.snmpEnableAuthenTraps + +# Finally, grant the group read-only access to the systemview view. +# group context sec.model sec.level prefix read write notif +#access notConfigGroup "" any noauth exact roview rwview none + + + +############################################################################### +# System contact information +# + +# It is also possible to set the sysContact and sysLocation system +# variables through the snmpd.conf file: + +syslocation Unknown (edit /etc/snmp/snmpd.conf) +syscontact Root (configure /etc/snmp/snmp.local.conf) + +# Example output of snmpwalk: +# % snmpwalk -v 1 localhost -c public system +# system.sysDescr.0 = "SunOS name sun4c" +# system.sysObjectID.0 = OID: enterprises.ucdavis.ucdSnmpAgent.sunos4 +# system.sysUpTime.0 = Timeticks: (595637548) 68 days, 22:32:55 +# system.sysContact.0 = "Me " +# system.sysName.0 = "name" +# system.sysLocation.0 = "Right here, right now." +# system.sysServices.0 = 72 + + +############################################################################### +# Logging +# + +# We do not want annoying "Connection from UDP: " messages in syslog. +# If the following option is commented out, snmpd will print each incoming +# connection, which can be useful for debugging. + +dontLogTCPWrappersConnects yes + +# ----------------------------------------------------------------------------- + + +############################################################################### +# Process checks. +# +# The following are examples of how to use the agent to check for +# processes running on the host. The syntax looks something like: +# +# proc NAME [MAX=0] [MIN=0] +# +# NAME: the name of the process to check for. It must match +# exactly (ie, http will not find httpd processes). +# MAX: the maximum number allowed to be running. Defaults to 0. +# MIN: the minimum number to be running. Defaults to 0. + +# +# Examples (commented out by default): +# + +# Make sure mountd is running +#proc mountd + +# Make sure there are no more than 4 ntalkds running, but 0 is ok too. +#proc ntalkd 4 + +# Make sure at least one sendmail, but less than or equal to 10 are running. +#proc sendmail 10 1 + +# A snmpwalk of the process mib tree would look something like this: +# +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.2 +# enterprises.ucdavis.procTable.prEntry.prIndex.1 = 1 +# enterprises.ucdavis.procTable.prEntry.prIndex.2 = 2 +# enterprises.ucdavis.procTable.prEntry.prIndex.3 = 3 +# enterprises.ucdavis.procTable.prEntry.prNames.1 = "mountd" +# enterprises.ucdavis.procTable.prEntry.prNames.2 = "ntalkd" +# enterprises.ucdavis.procTable.prEntry.prNames.3 = "sendmail" +# enterprises.ucdavis.procTable.prEntry.prMin.1 = 0 +# enterprises.ucdavis.procTable.prEntry.prMin.2 = 0 +# enterprises.ucdavis.procTable.prEntry.prMin.3 = 1 +# enterprises.ucdavis.procTable.prEntry.prMax.1 = 0 +# enterprises.ucdavis.procTable.prEntry.prMax.2 = 4 +# enterprises.ucdavis.procTable.prEntry.prMax.3 = 10 +# enterprises.ucdavis.procTable.prEntry.prCount.1 = 0 +# enterprises.ucdavis.procTable.prEntry.prCount.2 = 0 +# enterprises.ucdavis.procTable.prEntry.prCount.3 = 1 +# enterprises.ucdavis.procTable.prEntry.prErrorFlag.1 = 1 +# enterprises.ucdavis.procTable.prEntry.prErrorFlag.2 = 0 +# enterprises.ucdavis.procTable.prEntry.prErrorFlag.3 = 0 +# enterprises.ucdavis.procTable.prEntry.prErrMessage.1 = "No mountd process running." +# enterprises.ucdavis.procTable.prEntry.prErrMessage.2 = "" +# enterprises.ucdavis.procTable.prEntry.prErrMessage.3 = "" +# enterprises.ucdavis.procTable.prEntry.prErrFix.1 = 0 +# enterprises.ucdavis.procTable.prEntry.prErrFix.2 = 0 +# enterprises.ucdavis.procTable.prEntry.prErrFix.3 = 0 +# +# Note that the errorFlag for mountd is set to 1 because one is not +# running (in this case an rpc.mountd is, but thats not good enough), +# and the ErrMessage tells you what's wrong. The configuration +# imposed in the snmpd.conf file is also shown. +# +# Special Case: When the min and max numbers are both 0, it assumes +# you want a max of infinity and a min of 1. +# + + +# ----------------------------------------------------------------------------- + + +############################################################################### +# Executables/scripts +# + +# +# You can also have programs run by the agent that return a single +# line of output and an exit code. Here are two examples. +# +# exec NAME PROGRAM [ARGS ...] +# +# NAME: A generic name. The name must be unique for each exec statement. +# PROGRAM: The program to run. Include the path! +# ARGS: optional arguments to be passed to the program + +# a simple hello world + +#exec echotest /bin/echo hello world + +# Run a shell script containing: +# +# #!/bin/sh +# echo hello world +# echo hi there +# exit 35 +# +# Note: this has been specifically commented out to prevent +# accidental security holes due to someone else on your system writing +# a /tmp/shtest before you do. Uncomment to use it. +# +#exec shelltest /bin/sh /tmp/shtest + +# Then, +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.8 +# enterprises.ucdavis.extTable.extEntry.extIndex.1 = 1 +# enterprises.ucdavis.extTable.extEntry.extIndex.2 = 2 +# enterprises.ucdavis.extTable.extEntry.extNames.1 = "echotest" +# enterprises.ucdavis.extTable.extEntry.extNames.2 = "shelltest" +# enterprises.ucdavis.extTable.extEntry.extCommand.1 = "/bin/echo hello world" +# enterprises.ucdavis.extTable.extEntry.extCommand.2 = "/bin/sh /tmp/shtest" +# enterprises.ucdavis.extTable.extEntry.extResult.1 = 0 +# enterprises.ucdavis.extTable.extEntry.extResult.2 = 35 +# enterprises.ucdavis.extTable.extEntry.extOutput.1 = "hello world." +# enterprises.ucdavis.extTable.extEntry.extOutput.2 = "hello world." +# enterprises.ucdavis.extTable.extEntry.extErrFix.1 = 0 +# enterprises.ucdavis.extTable.extEntry.extErrFix.2 = 0 + +# Note that the second line of the /tmp/shtest shell script is cut +# off. Also note that the exit status of 35 was returned. + +# ----------------------------------------------------------------------------- + + +############################################################################### +# disk checks +# + +# The agent can check the amount of available disk space, and make +# sure it is above a set limit. + +# disk PATH [MIN=100000] +# +# PATH: mount path to the disk in question. +# MIN: Disks with space below this value will have the Mib's errorFlag set. +# Default value = 100000. + +# Check the / partition and make sure it contains at least 10 megs. + +#disk / 10000 + +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.9 +# enterprises.ucdavis.diskTable.dskEntry.diskIndex.1 = 0 +# enterprises.ucdavis.diskTable.dskEntry.diskPath.1 = "/" Hex: 2F +# enterprises.ucdavis.diskTable.dskEntry.diskDevice.1 = "/dev/dsk/c201d6s0" +# enterprises.ucdavis.diskTable.dskEntry.diskMinimum.1 = 10000 +# enterprises.ucdavis.diskTable.dskEntry.diskTotal.1 = 837130 +# enterprises.ucdavis.diskTable.dskEntry.diskAvail.1 = 316325 +# enterprises.ucdavis.diskTable.dskEntry.diskUsed.1 = 437092 +# enterprises.ucdavis.diskTable.dskEntry.diskPercent.1 = 58 +# enterprises.ucdavis.diskTable.dskEntry.diskErrorFlag.1 = 0 +# enterprises.ucdavis.diskTable.dskEntry.diskErrorMsg.1 = "" + +# ----------------------------------------------------------------------------- + + +############################################################################### +# load average checks +# + +# load [1MAX=12.0] [5MAX=12.0] [15MAX=12.0] +# +# 1MAX: If the 1 minute load average is above this limit at query +# time, the errorFlag will be set. +# 5MAX: Similar, but for 5 min average. +# 15MAX: Similar, but for 15 min average. + +# Check for loads: +#load 12 14 14 + +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.10 +# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.1 = 1 +# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.2 = 2 +# enterprises.ucdavis.loadTable.laEntry.loadaveIndex.3 = 3 +# enterprises.ucdavis.loadTable.laEntry.loadaveNames.1 = "Load-1" +# enterprises.ucdavis.loadTable.laEntry.loadaveNames.2 = "Load-5" +# enterprises.ucdavis.loadTable.laEntry.loadaveNames.3 = "Load-15" +# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.1 = "0.49" Hex: 30 2E 34 39 +# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.2 = "0.31" Hex: 30 2E 33 31 +# enterprises.ucdavis.loadTable.laEntry.loadaveLoad.3 = "0.26" Hex: 30 2E 32 36 +# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.1 = "12.00" +# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.2 = "14.00" +# enterprises.ucdavis.loadTable.laEntry.loadaveConfig.3 = "14.00" +# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.1 = 0 +# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.2 = 0 +# enterprises.ucdavis.loadTable.laEntry.loadaveErrorFlag.3 = 0 +# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.1 = "" +# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.2 = "" +# enterprises.ucdavis.loadTable.laEntry.loadaveErrMessage.3 = "" + +# ----------------------------------------------------------------------------- + + +############################################################################### +# Extensible sections. +# + +# This alleviates the multiple line output problem found in the +# previous executable mib by placing each mib in its own mib table: + +# Run a shell script containing: +# +# #!/bin/sh +# echo hello world +# echo hi there +# exit 35 +# +# Note: this has been specifically commented out to prevent +# accidental security holes due to someone else on your system writing +# a /tmp/shtest before you do. Uncomment to use it. +# +# exec .1.3.6.1.4.1.2021.50 shelltest /bin/sh /tmp/shtest + +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.50 +# enterprises.ucdavis.50.1.1 = 1 +# enterprises.ucdavis.50.2.1 = "shelltest" +# enterprises.ucdavis.50.3.1 = "/bin/sh /tmp/shtest" +# enterprises.ucdavis.50.100.1 = 35 +# enterprises.ucdavis.50.101.1 = "hello world." +# enterprises.ucdavis.50.101.2 = "hi there." +# enterprises.ucdavis.50.102.1 = 0 + +# Now the Output has grown to two lines, and we can see the 'hi +# there.' output as the second line from our shell script. +# +# Note that you must alter the mib.txt file to be correct if you want +# the .50.* outputs above to change to reasonable text descriptions. + +# Other ideas: +# +# exec .1.3.6.1.4.1.2021.51 ps /bin/ps +# exec .1.3.6.1.4.1.2021.52 top /usr/local/bin/top +# exec .1.3.6.1.4.1.2021.53 mailq /usr/bin/mailq + +# ----------------------------------------------------------------------------- + + +############################################################################### +# Pass through control. +# + +# Usage: +# pass MIBOID EXEC-COMMAND +# +# This will pass total control of the mib underneath the MIBOID +# portion of the mib to the EXEC-COMMAND. +# +# Note: You'll have to change the path of the passtest script to your +# source directory or install it in the given location. +# +# Example: (see the script for details) +# (commented out here since it requires that you place the +# script in the right location. (its not installed by default)) + +# pass .1.3.6.1.4.1.2021.255 /bin/sh /usr/local/local/passtest + +# % snmpwalk -v 1 localhost -c public .1.3.6.1.4.1.2021.255 +# enterprises.ucdavis.255.1 = "life the universe and everything" +# enterprises.ucdavis.255.2.1 = 42 +# enterprises.ucdavis.255.2.2 = OID: 42.42.42 +# enterprises.ucdavis.255.3 = Timeticks: (363136200) 42 days, 0:42:42 +# enterprises.ucdavis.255.4 = IpAddress: 127.0.0.1 +# enterprises.ucdavis.255.5 = 42 +# enterprises.ucdavis.255.6 = Gauge: 42 +# +# % snmpget -v 1 localhost public .1.3.6.1.4.1.2021.255.5 +# enterprises.ucdavis.255.5 = 42 +# +# % snmpset -v 1 localhost public .1.3.6.1.4.1.2021.255.1 s "New string" +# enterprises.ucdavis.255.1 = "New string" +# + +# For specific usage information, see the man/snmpd.conf.5 manual page +# as well as the local/passtest script used in the above example. + +############################################################################### +# Further Information +# +# See the snmpd.conf manual page, and the output of "snmpd -H". +view systemview included .1.3.6.1.4.1.2021.10.1.3 +view systemview included .1.3.6.1.4.1.2021.11 +view systemview included .1.3.6.1.4.1.2021.4 +view systemview included .1.3.6.1.4.1.2021.9.1 +disk / 10000 +includeAllDisks 10% diff --git a/roles/tsg-cli-mcn0/files/rsyslog.conf b/roles/tsg-cli-mcn0/files/rsyslog.conf new file mode 100644 index 0000000..9da82b0 --- /dev/null +++ b/roles/tsg-cli-mcn0/files/rsyslog.conf @@ -0,0 +1,93 @@ +# rsyslog configuration file + +# For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html +# If you experience problems, see http://www.rsyslog.com/doc/troubleshoot.html + +#### MODULES #### + +# The imjournal module bellow is now used as a message source instead of imuxsock. +$ModLoad imuxsock # provides support for local system logging (e.g. via logger command) +$ModLoad imjournal # provides access to the systemd journal +#$ModLoad imklog # reads kernel messages (the same are read from journald) +#$ModLoad immark # provides --MARK-- message capability + +# Provides UDP syslog reception +#$ModLoad imudp +#$UDPServerRun 514 + +# Provides TCP syslog reception +#$ModLoad imtcp +#$InputTCPServerRun 514 + + +#### GLOBAL DIRECTIVES #### + +# Where to place auxiliary files +$WorkDirectory /var/lib/rsyslog + +# Use default timestamp format +#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat +$template tsgformat,"%$NOW% %TIMESTAMP:8:15% %HOSTNAME:F,45:3%:<%PRI%> [%syslogseverity-text%] %msg%\n" +$ActionFileDefaultTemplate tsgformat + +# File syncing capability is disabled by default. This feature is usually not required, +# not useful and an extreme performance hit +#$ActionFileEnableSync on + +# Include all config files in /etc/rsyslog.d/ +$IncludeConfig /etc/rsyslog.d/*.conf + +# Turn off message reception via local log socket; +# local messages are retrieved through imjournal now. +$OmitLocalLogging on + +# File to store the position in the journal +$IMJournalStateFile imjournal.state + + +#### RULES #### + +# Log all kernel messages to the console. +# Logging much else clutters up the screen. +#kern.* /dev/console + +# Log anything (except mail) of level info or higher. +# Don't log private authentication messages! +*.notice;mail.none;authpriv.none;cron.none /var/log/messages + +# The authpriv file has restricted access. +authpriv.* /var/log/secure + +# Log all the mail messages in one place. +mail.* -/var/log/maillog + + +# Log cron stuff +cron.* /var/log/cron + +# Everybody gets emergency messages +*.emerg :omusrmsg:* + +# Save news errors of level crit and higher in a special file. +uucp,news.crit /var/log/spooler + +# Save boot messages also to boot.log +local7.* /var/log/boot.log + + +# ### begin forwarding rule ### +# The statement between the begin ... end define a SINGLE forwarding +# rule. They belong together, do NOT split them. If you create multiple +# forwarding rules, duplicate the whole block! +# Remote Logging (we use TCP for reliable delivery) +# +# An on-disk queue is created for this action. If the remote host is +# down, messages are spooled to disk and sent when it is up again. +#$ActionQueueFileName fwdRule1 # unique name prefix for spool files +#$ActionQueueMaxDiskSpace 1g # 1gb space limit (use as much as possible) +#$ActionQueueSaveOnShutdown on # save messages to disk on shutdown +#$ActionQueueType LinkedList # run asynchronously +#$ActionResumeRetryCount -1 # infinite retries if host is down +# remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional +*.warning @@192.168.100.5:514 +# ### end of the forwarding rule ### diff --git a/roles/tsg-cli-mcn0/files/tsg-monitor.service b/roles/tsg-cli-mcn0/files/tsg-monitor.service new file mode 100644 index 0000000..9e193df --- /dev/null +++ b/roles/tsg-cli-mcn0/files/tsg-monitor.service @@ -0,0 +1,16 @@ +[Unit] +Description=tsg monitor service +Requires=network.target +After=network.target + +[Service] +#WorkingDirectory=/opt/tsg/tsg-monitor/ +ExecStart=/opt/tsg/tsg-monitor/tsg-monitor.sh +#ExecStop=/home/tsg/kni/kni_service_scipt stop +#ExecStop=/bin/kill -9 $MAINPID +Type=simple +Restart=always +RestartSec=5s + +[Install] +WantedBy=multi-user.target diff --git a/roles/tsg-cli-mcn0/files/tsg-monitor.sh b/roles/tsg-cli-mcn0/files/tsg-monitor.sh new file mode 100644 index 0000000..c474424 --- /dev/null +++ b/roles/tsg-cli-mcn0/files/tsg-monitor.sh @@ -0,0 +1,87 @@ +#!/bin/sh + +#mcn0 + +#防止因上一次的命令阻塞或长时间未返回, +#导致10秒内还不结束, 强行杀掉, +#否则长时间运行后, 会有大量后台进程运行 +killall_uncompleted_cmd(){ + #killall -9 tsg_cluster_register + killall -9 -q tsg_diagnose_background + killall -9 -q tsg_update_tags + + 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 +} + +start_background_cmd(){ + #后台并发运行, 保证所有命令的开始运行时间基本一样, + #且不会因某个命令网络拥塞、执行时间长等问题,阻塞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 & +} + +#return value: current time in ms +get_current_time_in_ms(){ + time_sec=`date +"%s"` + time_nsec=`date +"%N"` + #echo $time_sec + #echo $time_nsec + + time_epoch_ms=`echo | awk -v a=$time_sec -v b=$time_nsec '{printf("%.f"), a*1000+b/1000/1000}'` + + echo $time_epoch_ms +} + +#args: +#begin from time, in ms +#wait for n ms +sleep_for_time_ms(){ + last_time=$1 + wait_sec=$2 + #break_time=`echo | awk -v a=$last_time -v b=$wait_sec '{printf("%.f"), a+b}'` + break_time=`expr $last_time + $wait_sec` + break_time_int=`expr $break_time` + #echo "start: last_time is:$last_time, expect break timeis:$break_time!" + + current_time=0 + break_time=0 + #break_time=`expr $last_time + 1000*$1` + while [ 1 ]; do + current_time=`get_current_time_in_ms` + current_time_int=`expr $current_time` + if [ $current_time_int -ge $break_time_int ]; then + #echo "current is: $current_time_int, break_time is:$break_time_int, break!" + break + else + #echo "break is: $current_time_int, last_time is:$break_time_int, continue!" + # usleep is us + usleep 1000 + fi + done + +} + +while [ 1 ]; do + start_time=`get_current_time_in_ms` + #echo tsg-monitor start at `date +"%Y/%m/%d, %H:%M:%S.%N"` >> /tmp/tsg-monitor.log + + start_background_cmd + sleep 10 + killall_uncompleted_cmd + + sleep_for_time_ms $start_time 15000 +done diff --git a/roles/tsg-cli-mcn0/files/tsg_chassis_interface.json b/roles/tsg-cli-mcn0/files/tsg_chassis_interface.json new file mode 100644 index 0000000..d557d9c --- /dev/null +++ b/roles/tsg-cli-mcn0/files/tsg_chassis_interface.json @@ -0,0 +1,10 @@ +{ + "local_chassis_node": "mcn0", + "interface_list": [ + { + "dev_name": "ens1f4", + "dev_type": "marsio", + "flow_type": "inline" + } + ] +} diff --git a/roles/tsg-cli-mcn0/tasks/main.yml b/roles/tsg-cli-mcn0/tasks/main.yml new file mode 100644 index 0000000..786395b --- /dev/null +++ b/roles/tsg-cli-mcn0/tasks/main.yml @@ -0,0 +1,62 @@ +--- +- name: "copy tsg-cli rmp to destination server" + synchronize: + src: "{{ role_path }}/../tsg-common-files/{{ rpm_file_name }}" + dest: "/tmp/tsg-cli-deploy/" + +- name: "install tsg-cli" + yum: + name: "{{ packages }}" + state: present + vars: + packages: + - /tmp/tsg-cli-deploy/{{ rpm_file_name }} + +- name: Template the main.conf + template: + src: "{{ role_path }}/templates/tsg_sn.json.j2" + dest: /opt/tsg/etc/tsg_sn.json + tags: template + when: not use_chassis_hardware_sn | bool + +- name: "copy tsg_sn.json to destination server" + synchronize: + src: "{{ role_path }}/../tsg-common-files/tsg_sn.json" + dest: "/opt/tsg/etc/tsg_sn.json" + when: use_chassis_hardware_sn | bool + + +- name: "copy tsg-monitor.service to destination server" + synchronize: + src: "{{ role_path }}/files/tsg-monitor.service" + dest: "/usr/lib/systemd/system" + +- name: "copy tsg_chassis_interface.json to destination server" + synchronize: + src: "{{ role_path }}/files/tsg_chassis_interface.json" + dest: "/opt/tsg/etc/" + +- name: "copy tsg-monitor.sh to destination server" + #synchronize: + copy: + src: "{{ role_path }}/files/tsg-monitor.sh" + dest: "/opt/tsg/tsg-monitor/" + mode: 0755 + +- name: "copy rsyslog.conf to destination server" + synchronize: + src: "{{ role_path }}/files/rsyslog.conf" + dest: "/etc/" + +- name: "restart rsyslog service" + systemd: + name: rsyslog + state: restarted + +- name: "enable tsg-monitor service" + systemd: + name: tsg-monitor + daemon_reload: yes + enabled: yes + state: restarted + \ No newline at end of file diff --git a/roles/tsg-cli-mcn0/templates/tsg_sn.json.j2 b/roles/tsg-cli-mcn0/templates/tsg_sn.json.j2 new file mode 100644 index 0000000..bceeb99 --- /dev/null +++ b/roles/tsg-cli-mcn0/templates/tsg_sn.json.j2 @@ -0,0 +1,3 @@ +{ + "sn": "{{ SN }}" +} \ No newline at end of file diff --git a/roles/tsg-cli-mcn1/files/rsyslog.conf b/roles/tsg-cli-mcn1/files/rsyslog.conf new file mode 100644 index 0000000..9da82b0 --- /dev/null +++ b/roles/tsg-cli-mcn1/files/rsyslog.conf @@ -0,0 +1,93 @@ +# rsyslog configuration file + +# For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html +# If you experience problems, see http://www.rsyslog.com/doc/troubleshoot.html + +#### MODULES #### + +# The imjournal module bellow is now used as a message source instead of imuxsock. +$ModLoad imuxsock # provides support for local system logging (e.g. via logger command) +$ModLoad imjournal # provides access to the systemd journal +#$ModLoad imklog # reads kernel messages (the same are read from journald) +#$ModLoad immark # provides --MARK-- message capability + +# Provides UDP syslog reception +#$ModLoad imudp +#$UDPServerRun 514 + +# Provides TCP syslog reception +#$ModLoad imtcp +#$InputTCPServerRun 514 + + +#### GLOBAL DIRECTIVES #### + +# Where to place auxiliary files +$WorkDirectory /var/lib/rsyslog + +# Use default timestamp format +#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat +$template tsgformat,"%$NOW% %TIMESTAMP:8:15% %HOSTNAME:F,45:3%:<%PRI%> [%syslogseverity-text%] %msg%\n" +$ActionFileDefaultTemplate tsgformat + +# File syncing capability is disabled by default. This feature is usually not required, +# not useful and an extreme performance hit +#$ActionFileEnableSync on + +# Include all config files in /etc/rsyslog.d/ +$IncludeConfig /etc/rsyslog.d/*.conf + +# Turn off message reception via local log socket; +# local messages are retrieved through imjournal now. +$OmitLocalLogging on + +# File to store the position in the journal +$IMJournalStateFile imjournal.state + + +#### RULES #### + +# Log all kernel messages to the console. +# Logging much else clutters up the screen. +#kern.* /dev/console + +# Log anything (except mail) of level info or higher. +# Don't log private authentication messages! +*.notice;mail.none;authpriv.none;cron.none /var/log/messages + +# The authpriv file has restricted access. +authpriv.* /var/log/secure + +# Log all the mail messages in one place. +mail.* -/var/log/maillog + + +# Log cron stuff +cron.* /var/log/cron + +# Everybody gets emergency messages +*.emerg :omusrmsg:* + +# Save news errors of level crit and higher in a special file. +uucp,news.crit /var/log/spooler + +# Save boot messages also to boot.log +local7.* /var/log/boot.log + + +# ### begin forwarding rule ### +# The statement between the begin ... end define a SINGLE forwarding +# rule. They belong together, do NOT split them. If you create multiple +# forwarding rules, duplicate the whole block! +# Remote Logging (we use TCP for reliable delivery) +# +# An on-disk queue is created for this action. If the remote host is +# down, messages are spooled to disk and sent when it is up again. +#$ActionQueueFileName fwdRule1 # unique name prefix for spool files +#$ActionQueueMaxDiskSpace 1g # 1gb space limit (use as much as possible) +#$ActionQueueSaveOnShutdown on # save messages to disk on shutdown +#$ActionQueueType LinkedList # run asynchronously +#$ActionResumeRetryCount -1 # infinite retries if host is down +# remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional +*.warning @@192.168.100.5:514 +# ### end of the forwarding rule ### diff --git a/roles/tsg-cli-mcn1/files/tsg-monitor.service b/roles/tsg-cli-mcn1/files/tsg-monitor.service new file mode 100644 index 0000000..f61aded --- /dev/null +++ b/roles/tsg-cli-mcn1/files/tsg-monitor.service @@ -0,0 +1,15 @@ +[Unit] +Description=tsg monitor service +Requires=network.target +After=network.target + +[Service] +#WorkingDirectory=/opt/tsg/tsg-monitor/ +ExecStart=/opt/tsg/tsg-monitor/tsg-monitor.sh +#ExecStop=/bin/kill -9 $MAINPID +Type=simple +Restart=always +RestartSec=5s + +[Install] +WantedBy=multi-user.target diff --git a/roles/tsg-cli-mcn1/files/tsg-monitor.sh b/roles/tsg-cli-mcn1/files/tsg-monitor.sh new file mode 100644 index 0000000..21fa970 --- /dev/null +++ b/roles/tsg-cli-mcn1/files/tsg-monitor.sh @@ -0,0 +1,75 @@ +#!/bin/sh + +#mcn1 + +#防止因上一次的命令阻塞或长时间未返回, +#导致10秒内还不结束, 强行杀掉, +#否则长时间运行后, 会有大量后台进程运行 +killall_uncompleted_cmd(){ + #killall -9 tsg_cluster_register + killall -9 -q tsg_diagnose_background + killall -9 -q tsg_update_tags + killall -9 -q tsg_monit_interface + killall -9 -q tsg_monit_intercept +} + +start_background_cmd(){ + #后台并发运行, 保证所有命令的开始运行时间基本一样, + #且不会因某个命令网络拥塞、执行时间长等问题,阻塞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_interface > /dev/null & + /opt/tsg/tsg-monitor/tsg_monit_intercept > /dev/null & +} + +#return value: current time in ms +get_current_time_in_ms(){ + time_sec=`date +"%s"` + time_nsec=`date +"%N"` + #echo $time_sec + #echo $time_nsec + + time_epoch_ms=`echo | awk -v a=$time_sec -v b=$time_nsec '{printf("%.f"), a*1000+b/1000/1000}'` + + echo $time_epoch_ms +} + +#args: +#begin from time, in ms +#wait for n ms +sleep_for_time_ms(){ + last_time=$1 + wait_sec=$2 + #break_time=`echo | awk -v a=$last_time -v b=$wait_sec '{printf("%.f"), a+b}'` + break_time=`expr $last_time + $wait_sec` + break_time_int=`expr $break_time` + #echo "start: last_time is:$last_time, expect break timeis:$break_time!" + + current_time=0 + break_time=0 + #break_time=`expr $last_time + 1000*$1` + while [ 1 ]; do + current_time=`get_current_time_in_ms` + current_time_int=`expr $current_time` + if [ $current_time_int -ge $break_time_int ]; then + #echo "current is: $current_time_int, break_time is:$break_time_int, break!" + break + else + #echo "break is: $current_time_int, last_time is:$break_time_int, continue!" + # usleep is us + usleep 1000 + fi + done + +} + +while [ 1 ]; do + start_time=`get_current_time_in_ms` + #echo tsg-monitor start at `date +"%Y/%m/%d, %H:%M:%S.%N"` >> /tmp/tsg-monitor.log + + start_background_cmd + sleep 10 + killall_uncompleted_cmd + + sleep_for_time_ms $start_time 15000 +done diff --git a/roles/tsg-cli-mcn1/files/tsg_chassis_interface.json b/roles/tsg-cli-mcn1/files/tsg_chassis_interface.json new file mode 100644 index 0000000..db4dd03 --- /dev/null +++ b/roles/tsg-cli-mcn1/files/tsg_chassis_interface.json @@ -0,0 +1,12 @@ +{ + "interface_list": [{ + "dev_name": "ens1f1", + "dev_type": "pcap", + "flow_type": "intercomm" + },{ + "dev_name": "ens1f2", + "dev_type": "marsio", + "flow_type": "mirror" + } + ] +} diff --git a/roles/tsg-cli-mcn1/tasks/main.yml b/roles/tsg-cli-mcn1/tasks/main.yml new file mode 100644 index 0000000..40581ce --- /dev/null +++ b/roles/tsg-cli-mcn1/tasks/main.yml @@ -0,0 +1,61 @@ +--- +- name: "copy tsg-cli rmp to destination server" + synchronize: + src: "{{ role_path }}/../tsg-common-files/{{ rpm_file_name }}" + dest: "/tmp/tsg-cli-deploy/" + +- name: "install tsg-cli" + yum: + name: "{{ packages }}" + state: present + vars: + packages: + - /tmp/tsg-cli-deploy/{{ rpm_file_name }} + +- name: Template the tsg_sn.json + template: + src: "{{ role_path }}/templates/tsg_sn.json.j2" + dest: /opt/tsg/etc/tsg_sn.json + tags: template + when: not use_chassis_hardware_sn | bool + +- name: "copy tsg_sn.json to destination server" + synchronize: + src: "{{ role_path }}/../tsg-common-files/tsg_sn.json" + dest: "/opt/tsg/etc/tsg_sn.json" + when: use_chassis_hardware_sn | bool + +- name: "copy tsg-monitor.service to destination server" + synchronize: + src: "{{ role_path }}/files/tsg-monitor.service" + dest: "/usr/lib/systemd/system" + +- name: "copy tsg_chassis_interface.json to destination server" + synchronize: + src: "{{ role_path }}/files/tsg_chassis_interface.json" + dest: "/opt/tsg/etc/" + +- name: "copy tsg-monitor.sh to destination server" + #synchronize: + copy: + src: "{{ role_path }}/files/tsg-monitor.sh" + dest: "/opt/tsg/tsg-monitor/" + mode: 0755 + +- name: "copy rsyslog.conf to destination server" + synchronize: + src: "{{ role_path }}/files/rsyslog.conf" + dest: "/etc/" + +- 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 + diff --git a/roles/tsg-cli-mcn1/templates/tsg_sn.json.j2 b/roles/tsg-cli-mcn1/templates/tsg_sn.json.j2 new file mode 100644 index 0000000..bceeb99 --- /dev/null +++ b/roles/tsg-cli-mcn1/templates/tsg_sn.json.j2 @@ -0,0 +1,3 @@ +{ + "sn": "{{ SN }}" +} \ No newline at end of file diff --git a/roles/tsg-cli-mcn2/files/rsyslog.conf b/roles/tsg-cli-mcn2/files/rsyslog.conf new file mode 100644 index 0000000..9da82b0 --- /dev/null +++ b/roles/tsg-cli-mcn2/files/rsyslog.conf @@ -0,0 +1,93 @@ +# rsyslog configuration file + +# For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html +# If you experience problems, see http://www.rsyslog.com/doc/troubleshoot.html + +#### MODULES #### + +# The imjournal module bellow is now used as a message source instead of imuxsock. +$ModLoad imuxsock # provides support for local system logging (e.g. via logger command) +$ModLoad imjournal # provides access to the systemd journal +#$ModLoad imklog # reads kernel messages (the same are read from journald) +#$ModLoad immark # provides --MARK-- message capability + +# Provides UDP syslog reception +#$ModLoad imudp +#$UDPServerRun 514 + +# Provides TCP syslog reception +#$ModLoad imtcp +#$InputTCPServerRun 514 + + +#### GLOBAL DIRECTIVES #### + +# Where to place auxiliary files +$WorkDirectory /var/lib/rsyslog + +# Use default timestamp format +#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat +$template tsgformat,"%$NOW% %TIMESTAMP:8:15% %HOSTNAME:F,45:3%:<%PRI%> [%syslogseverity-text%] %msg%\n" +$ActionFileDefaultTemplate tsgformat + +# File syncing capability is disabled by default. This feature is usually not required, +# not useful and an extreme performance hit +#$ActionFileEnableSync on + +# Include all config files in /etc/rsyslog.d/ +$IncludeConfig /etc/rsyslog.d/*.conf + +# Turn off message reception via local log socket; +# local messages are retrieved through imjournal now. +$OmitLocalLogging on + +# File to store the position in the journal +$IMJournalStateFile imjournal.state + + +#### RULES #### + +# Log all kernel messages to the console. +# Logging much else clutters up the screen. +#kern.* /dev/console + +# Log anything (except mail) of level info or higher. +# Don't log private authentication messages! +*.notice;mail.none;authpriv.none;cron.none /var/log/messages + +# The authpriv file has restricted access. +authpriv.* /var/log/secure + +# Log all the mail messages in one place. +mail.* -/var/log/maillog + + +# Log cron stuff +cron.* /var/log/cron + +# Everybody gets emergency messages +*.emerg :omusrmsg:* + +# Save news errors of level crit and higher in a special file. +uucp,news.crit /var/log/spooler + +# Save boot messages also to boot.log +local7.* /var/log/boot.log + + +# ### begin forwarding rule ### +# The statement between the begin ... end define a SINGLE forwarding +# rule. They belong together, do NOT split them. If you create multiple +# forwarding rules, duplicate the whole block! +# Remote Logging (we use TCP for reliable delivery) +# +# An on-disk queue is created for this action. If the remote host is +# down, messages are spooled to disk and sent when it is up again. +#$ActionQueueFileName fwdRule1 # unique name prefix for spool files +#$ActionQueueMaxDiskSpace 1g # 1gb space limit (use as much as possible) +#$ActionQueueSaveOnShutdown on # save messages to disk on shutdown +#$ActionQueueType LinkedList # run asynchronously +#$ActionResumeRetryCount -1 # infinite retries if host is down +# remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional +*.warning @@192.168.100.5:514 +# ### end of the forwarding rule ### diff --git a/roles/tsg-cli-mcn2/files/tsg-monitor.service b/roles/tsg-cli-mcn2/files/tsg-monitor.service new file mode 100644 index 0000000..f61aded --- /dev/null +++ b/roles/tsg-cli-mcn2/files/tsg-monitor.service @@ -0,0 +1,15 @@ +[Unit] +Description=tsg monitor service +Requires=network.target +After=network.target + +[Service] +#WorkingDirectory=/opt/tsg/tsg-monitor/ +ExecStart=/opt/tsg/tsg-monitor/tsg-monitor.sh +#ExecStop=/bin/kill -9 $MAINPID +Type=simple +Restart=always +RestartSec=5s + +[Install] +WantedBy=multi-user.target diff --git a/roles/tsg-cli-mcn2/files/tsg-monitor.sh b/roles/tsg-cli-mcn2/files/tsg-monitor.sh new file mode 100644 index 0000000..e702f0d --- /dev/null +++ b/roles/tsg-cli-mcn2/files/tsg-monitor.sh @@ -0,0 +1,75 @@ +#!/bin/sh + +#mcn2 + +#防止因上一次的命令阻塞或长时间未返回, +#导致10秒内还不结束, 强行杀掉, +#否则长时间运行后, 会有大量后台进程运行 +killall_uncompleted_cmd(){ + #killall -9 tsg_cluster_register + killall -9 -q tsg_diagnose_background + killall -9 -q tsg_update_tags + killall -9 -q tsg_monit_interface + killall -9 -q tsg_monit_intercept +} + +start_background_cmd(){ + #后台并发运行, 保证所有命令的开始运行时间基本一样, + #且不会因某个命令网络拥塞、执行时间长等问题,阻塞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_interface > /dev/null & + /opt/tsg/tsg-monitor/tsg_monit_intercept > /dev/null & +} + +#return value: current time in ms +get_current_time_in_ms(){ + time_sec=`date +"%s"` + time_nsec=`date +"%N"` + #echo $time_sec + #echo $time_nsec + + time_epoch_ms=`echo | awk -v a=$time_sec -v b=$time_nsec '{printf("%.f"), a*1000+b/1000/1000}'` + + echo $time_epoch_ms +} + +#args: +#begin from time, in ms +#wait for n ms +sleep_for_time_ms(){ + last_time=$1 + wait_sec=$2 + #break_time=`echo | awk -v a=$last_time -v b=$wait_sec '{printf("%.f"), a+b}'` + break_time=`expr $last_time + $wait_sec` + break_time_int=`expr $break_time` + #echo "start: last_time is:$last_time, expect break timeis:$break_time!" + + current_time=0 + break_time=0 + #break_time=`expr $last_time + 1000*$1` + while [ 1 ]; do + current_time=`get_current_time_in_ms` + current_time_int=`expr $current_time` + if [ $current_time_int -ge $break_time_int ]; then + #echo "current is: $current_time_int, break_time is:$break_time_int, break!" + break + else + #echo "break is: $current_time_int, last_time is:$break_time_int, continue!" + # usleep is us + usleep 1000 + fi + done + +} + +while [ 1 ]; do + start_time=`get_current_time_in_ms` + #echo tsg-monitor start at `date +"%Y/%m/%d, %H:%M:%S.%N"` >> /tmp/tsg-monitor.log + + start_background_cmd + sleep 10 + killall_uncompleted_cmd + + sleep_for_time_ms $start_time 15000 +done diff --git a/roles/tsg-cli-mcn2/files/tsg_chassis_interface.json b/roles/tsg-cli-mcn2/files/tsg_chassis_interface.json new file mode 100644 index 0000000..39c2d8f --- /dev/null +++ b/roles/tsg-cli-mcn2/files/tsg_chassis_interface.json @@ -0,0 +1,12 @@ +{ + "interface_list": [{ + "dev_name": "ens8f1", + "dev_type": "pcap", + "flow_type": "intercomm" + },{ + "dev_name": "ens8f2", + "dev_type": "marsio", + "flow_type": "mirror" + } + ] +} diff --git a/roles/tsg-cli-mcn2/tasks/main.yml b/roles/tsg-cli-mcn2/tasks/main.yml new file mode 100644 index 0000000..b4691f9 --- /dev/null +++ b/roles/tsg-cli-mcn2/tasks/main.yml @@ -0,0 +1,60 @@ +--- +- name: "copy tsg-cli rmp to destination server" + synchronize: + src: "{{ role_path }}/../tsg-common-files/{{ rpm_file_name }}" + dest: "/tmp/tsg-cli-deploy/" + +- name: "install tsg-cli" + yum: + name: "{{ packages }}" + state: present + vars: + packages: + - /tmp/tsg-cli-deploy/{{ rpm_file_name }} + +- name: Template the tsg_sn.json + template: + src: "{{ role_path }}/templates/tsg_sn.json.j2" + dest: /opt/tsg/etc/tsg_sn.json + tags: template + when: not use_chassis_hardware_sn | bool + +- name: "copy tsg_sn.json to destination server" + synchronize: + src: "{{ role_path }}/../tsg-common-files/tsg_sn.json" + dest: "/opt/tsg/etc/tsg_sn.json" + when: use_chassis_hardware_sn | bool + +- name: "copy tsg-monitor.service to destination server" + synchronize: + src: "{{ role_path }}/files/tsg-monitor.service" + dest: "/usr/lib/systemd/system" + +- name: "copy tsg_chassis_interface.json to destination server" + synchronize: + src: "{{ role_path }}/files/tsg_chassis_interface.json" + dest: "/opt/tsg/etc/" + +- name: "copy tsg-monitor.sh to destination server" + #synchronize: + copy: + src: "{{ role_path }}/files/tsg-monitor.sh" + dest: "/opt/tsg/tsg-monitor/" + mode: 0755 + +- name: "copy rsyslog.conf to destination server" + synchronize: + src: "{{ role_path }}/files/rsyslog.conf" + dest: "/etc/" + +- 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 \ No newline at end of file diff --git a/roles/tsg-cli-mcn2/templates/tsg_sn.json.j2 b/roles/tsg-cli-mcn2/templates/tsg_sn.json.j2 new file mode 100644 index 0000000..bceeb99 --- /dev/null +++ b/roles/tsg-cli-mcn2/templates/tsg_sn.json.j2 @@ -0,0 +1,3 @@ +{ + "sn": "{{ SN }}" +} \ No newline at end of file diff --git a/roles/tsg-cli-mcn3/files/rsyslog.conf b/roles/tsg-cli-mcn3/files/rsyslog.conf new file mode 100644 index 0000000..9da82b0 --- /dev/null +++ b/roles/tsg-cli-mcn3/files/rsyslog.conf @@ -0,0 +1,93 @@ +# rsyslog configuration file + +# For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html +# If you experience problems, see http://www.rsyslog.com/doc/troubleshoot.html + +#### MODULES #### + +# The imjournal module bellow is now used as a message source instead of imuxsock. +$ModLoad imuxsock # provides support for local system logging (e.g. via logger command) +$ModLoad imjournal # provides access to the systemd journal +#$ModLoad imklog # reads kernel messages (the same are read from journald) +#$ModLoad immark # provides --MARK-- message capability + +# Provides UDP syslog reception +#$ModLoad imudp +#$UDPServerRun 514 + +# Provides TCP syslog reception +#$ModLoad imtcp +#$InputTCPServerRun 514 + + +#### GLOBAL DIRECTIVES #### + +# Where to place auxiliary files +$WorkDirectory /var/lib/rsyslog + +# Use default timestamp format +#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat +$template tsgformat,"%$NOW% %TIMESTAMP:8:15% %HOSTNAME:F,45:3%:<%PRI%> [%syslogseverity-text%] %msg%\n" +$ActionFileDefaultTemplate tsgformat + +# File syncing capability is disabled by default. This feature is usually not required, +# not useful and an extreme performance hit +#$ActionFileEnableSync on + +# Include all config files in /etc/rsyslog.d/ +$IncludeConfig /etc/rsyslog.d/*.conf + +# Turn off message reception via local log socket; +# local messages are retrieved through imjournal now. +$OmitLocalLogging on + +# File to store the position in the journal +$IMJournalStateFile imjournal.state + + +#### RULES #### + +# Log all kernel messages to the console. +# Logging much else clutters up the screen. +#kern.* /dev/console + +# Log anything (except mail) of level info or higher. +# Don't log private authentication messages! +*.notice;mail.none;authpriv.none;cron.none /var/log/messages + +# The authpriv file has restricted access. +authpriv.* /var/log/secure + +# Log all the mail messages in one place. +mail.* -/var/log/maillog + + +# Log cron stuff +cron.* /var/log/cron + +# Everybody gets emergency messages +*.emerg :omusrmsg:* + +# Save news errors of level crit and higher in a special file. +uucp,news.crit /var/log/spooler + +# Save boot messages also to boot.log +local7.* /var/log/boot.log + + +# ### begin forwarding rule ### +# The statement between the begin ... end define a SINGLE forwarding +# rule. They belong together, do NOT split them. If you create multiple +# forwarding rules, duplicate the whole block! +# Remote Logging (we use TCP for reliable delivery) +# +# An on-disk queue is created for this action. If the remote host is +# down, messages are spooled to disk and sent when it is up again. +#$ActionQueueFileName fwdRule1 # unique name prefix for spool files +#$ActionQueueMaxDiskSpace 1g # 1gb space limit (use as much as possible) +#$ActionQueueSaveOnShutdown on # save messages to disk on shutdown +#$ActionQueueType LinkedList # run asynchronously +#$ActionResumeRetryCount -1 # infinite retries if host is down +# remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional +*.warning @@192.168.100.5:514 +# ### end of the forwarding rule ### diff --git a/roles/tsg-cli-mcn3/files/tsg-monitor.service b/roles/tsg-cli-mcn3/files/tsg-monitor.service new file mode 100644 index 0000000..f61aded --- /dev/null +++ b/roles/tsg-cli-mcn3/files/tsg-monitor.service @@ -0,0 +1,15 @@ +[Unit] +Description=tsg monitor service +Requires=network.target +After=network.target + +[Service] +#WorkingDirectory=/opt/tsg/tsg-monitor/ +ExecStart=/opt/tsg/tsg-monitor/tsg-monitor.sh +#ExecStop=/bin/kill -9 $MAINPID +Type=simple +Restart=always +RestartSec=5s + +[Install] +WantedBy=multi-user.target diff --git a/roles/tsg-cli-mcn3/files/tsg-monitor.sh b/roles/tsg-cli-mcn3/files/tsg-monitor.sh new file mode 100644 index 0000000..175be7b --- /dev/null +++ b/roles/tsg-cli-mcn3/files/tsg-monitor.sh @@ -0,0 +1,75 @@ +#!/bin/sh + +#mcn3 + +#防止因上一次的命令阻塞或长时间未返回, +#导致10秒内还不结束, 强行杀掉, +#否则长时间运行后, 会有大量后台进程运行 +killall_uncompleted_cmd(){ + #killall -9 -q tsg_cluster_register + killall -9 -q tsg_diagnose_background + killall -9 -q tsg_update_tags + killall -9 -q tsg_monit_interface + killall -9 -q tsg_monit_intercept +} + +start_background_cmd(){ + #后台并发运行, 保证所有命令的开始运行时间基本一样, + #且不会因某个命令网络拥塞、执行时间长等问题,阻塞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_interface > /dev/null & + /opt/tsg/tsg-monitor/tsg_monit_intercept > /dev/null & +} + +#return value: current time in ms +get_current_time_in_ms(){ + time_sec=`date +"%s"` + time_nsec=`date +"%N"` + #echo $time_sec + #echo $time_nsec + + time_epoch_ms=`echo | awk -v a=$time_sec -v b=$time_nsec '{printf("%.f"), a*1000+b/1000/1000}'` + + echo $time_epoch_ms +} + +#args: +#begin from time, in ms +#wait for n ms +sleep_for_time_ms(){ + last_time=$1 + wait_sec=$2 + #break_time=`echo | awk -v a=$last_time -v b=$wait_sec '{printf("%.f"), a+b}'` + break_time=`expr $last_time + $wait_sec` + break_time_int=`expr $break_time` + #echo "start: last_time is:$last_time, expect break timeis:$break_time!" + + current_time=0 + break_time=0 + #break_time=`expr $last_time + 1000*$1` + while [ 1 ]; do + current_time=`get_current_time_in_ms` + current_time_int=`expr $current_time` + if [ $current_time_int -ge $break_time_int ]; then + #echo "current is: $current_time_int, break_time is:$break_time_int, break!" + break + else + #echo "break is: $current_time_int, last_time is:$break_time_int, continue!" + # usleep is us + usleep 1000 + fi + done + +} + +while [ 1 ]; do + start_time=`get_current_time_in_ms` + #echo tsg-monitor start at `date +"%Y/%m/%d, %H:%M:%S.%N"` >> /tmp/tsg-monitor.log + + start_background_cmd + sleep 10 + killall_uncompleted_cmd + + sleep_for_time_ms $start_time 15000 +done diff --git a/roles/tsg-cli-mcn3/files/tsg_chassis_interface.json b/roles/tsg-cli-mcn3/files/tsg_chassis_interface.json new file mode 100644 index 0000000..b762b22 --- /dev/null +++ b/roles/tsg-cli-mcn3/files/tsg_chassis_interface.json @@ -0,0 +1,13 @@ +{ + "interface_list": [{ + "dev_name": "ens8f1", + "dev_type": "pcap", + "flow_type": "intercomm" + },{ + "dev_name": "ens8f2", + "dev_type": "marsio", + "flow_type": "mirror" + } + + ] +} diff --git a/roles/tsg-cli-mcn3/tasks/main.yml b/roles/tsg-cli-mcn3/tasks/main.yml new file mode 100644 index 0000000..a87e349 --- /dev/null +++ b/roles/tsg-cli-mcn3/tasks/main.yml @@ -0,0 +1,60 @@ +--- +- name: "copy tsg-cli rmp to destination server" + synchronize: + src: "{{ role_path }}/../tsg-common-files/{{ rpm_file_name }}" + dest: "/tmp/tsg-cli-deploy/" + +- name: "install tsg-cli" + yum: + name: "{{ packages }}" + state: present + vars: + packages: + - /tmp/tsg-cli-deploy/{{ rpm_file_name }} + +- name: Template the tsg_sn.json + template: + src: "{{ role_path }}/templates/tsg_sn.json.j2" + dest: /opt/tsg/etc/tsg_sn.json + tags: template + when: not use_chassis_hardware_sn | bool + +- name: "copy tsg_sn.json to destination server" + synchronize: + src: "{{ role_path }}/../tsg-common-files/tsg_sn.json" + dest: "/opt/tsg/etc/tsg_sn.json" + when: use_chassis_hardware_sn | bool + +- name: "copy tsg-monitor.service to destination server" + synchronize: + src: "{{ role_path }}/files/tsg-monitor.service" + dest: "/usr/lib/systemd/system" + +- name: "copy tsg_chassis_interface.json to destination server" + synchronize: + src: "{{ role_path }}/files/tsg_chassis_interface.json" + dest: "/opt/tsg/etc/" + +- name: "copy tsg-monitor.sh to destination server" + #synchronize: + copy: + src: "{{ role_path }}/files/tsg-monitor.sh" + dest: "/opt/tsg/tsg-monitor/" + mode: 0755 + +- name: "copy rsyslog.conf to destination server" + synchronize: + src: "{{ role_path }}/files/rsyslog.conf" + dest: "/etc/" + +- 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 \ No newline at end of file diff --git a/roles/tsg-cli-mcn3/templates/tsg_sn.json.j2 b/roles/tsg-cli-mcn3/templates/tsg_sn.json.j2 new file mode 100644 index 0000000..bceeb99 --- /dev/null +++ b/roles/tsg-cli-mcn3/templates/tsg_sn.json.j2 @@ -0,0 +1,3 @@ +{ + "sn": "{{ SN }}" +} \ No newline at end of file diff --git a/roles/tsg-cli-mxn/files/cmm_api_tst b/roles/tsg-cli-mxn/files/cmm_api_tst new file mode 100644 index 0000000..a228f12 Binary files /dev/null and b/roles/tsg-cli-mxn/files/cmm_api_tst differ diff --git a/roles/tsg-cli-mxn/files/rsyslog.conf b/roles/tsg-cli-mxn/files/rsyslog.conf new file mode 100644 index 0000000..a5127fe --- /dev/null +++ b/roles/tsg-cli-mxn/files/rsyslog.conf @@ -0,0 +1,93 @@ +# rsyslog configuration file + +# For more information see /usr/share/doc/rsyslog-*/rsyslog_conf.html +# If you experience problems, see http://www.rsyslog.com/doc/troubleshoot.html + +#### MODULES #### + +# The imjournal module bellow is now used as a message source instead of imuxsock. +$ModLoad imuxsock # provides support for local system logging (e.g. via logger command) +$ModLoad imjournal # provides access to the systemd journal +#$ModLoad imklog # reads kernel messages (the same are read from journald) +#$ModLoad immark # provides --MARK-- message capability + +# Provides UDP syslog reception +$ModLoad imudp +$UDPServerRun 514 + +# Provides TCP syslog reception +$ModLoad imtcp +$InputTCPServerRun 514 + + +#### GLOBAL DIRECTIVES #### + +# Where to place auxiliary files +$WorkDirectory /var/lib/rsyslog + +# Use default timestamp format +#$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat +$template tsgformat,"%$NOW% %TIMESTAMP:8:15% %HOSTNAME:F,45:3%:<%PRI%> [%syslogseverity-text%] %msg%\n" +$ActionFileDefaultTemplate tsgformat + +# File syncing capability is disabled by default. This feature is usually not required, +# not useful and an extreme performance hit +#$ActionFileEnableSync on + +# Include all config files in /etc/rsyslog.d/ +$IncludeConfig /etc/rsyslog.d/*.conf + +# Turn off message reception via local log socket; +# local messages are retrieved through imjournal now. +$OmitLocalLogging on + +# File to store the position in the journal +$IMJournalStateFile imjournal.state + + +#### RULES #### + +# Log all kernel messages to the console. +# Logging much else clutters up the screen. +#kern.* /dev/console + +# Log anything (except mail) of level info or higher. +# Don't log private authentication messages! +*.notice;mail.none;authpriv.none;cron.none /var/log/messages + +# The authpriv file has restricted access. +authpriv.* /var/log/secure + +# Log all the mail messages in one place. +mail.* -/var/log/maillog + + +# Log cron stuff +cron.* /var/log/cron + +# Everybody gets emergency messages +*.emerg :omusrmsg:* + +# Save news errors of level crit and higher in a special file. +uucp,news.crit /var/log/spooler + +# Save boot messages also to boot.log +local7.* /var/log/boot.log + + +# ### begin forwarding rule ### +# The statement between the begin ... end define a SINGLE forwarding +# rule. They belong together, do NOT split them. If you create multiple +# forwarding rules, duplicate the whole block! +# Remote Logging (we use TCP for reliable delivery) +# +# An on-disk queue is created for this action. If the remote host is +# down, messages are spooled to disk and sent when it is up again. +#$ActionQueueFileName fwdRule1 # unique name prefix for spool files +#$ActionQueueMaxDiskSpace 1g # 1gb space limit (use as much as possible) +#$ActionQueueSaveOnShutdown on # save messages to disk on shutdown +#$ActionQueueType LinkedList # run asynchronously +#$ActionResumeRetryCount -1 # infinite retries if host is down +# remote host is: name/ip:port, e.g. 192.168.0.1:514, port optional +#*.* @@192.168.40.165:514 +# ### end of the forwarding rule ### diff --git a/roles/tsg-cli-mxn/files/tsg-monitor.service b/roles/tsg-cli-mxn/files/tsg-monitor.service new file mode 100644 index 0000000..f7f29a5 --- /dev/null +++ b/roles/tsg-cli-mxn/files/tsg-monitor.service @@ -0,0 +1,15 @@ +[Unit] +Description=tsg monitor service +Requires=network.target +After=network.target + +[Service] +#WorkingDirectory=/opt/tsg/tsg-monitor/ +ExecStart=/opt/tsg/tsg-monitor/tsg-monitor.sh +#ExecStop=/bin/kill $MAINPID +Type=simple +Restart=always +RestartSec=5s + +[Install] +WantedBy=multi-user.target diff --git a/roles/tsg-cli-mxn/files/tsg-monitor.sh b/roles/tsg-cli-mxn/files/tsg-monitor.sh new file mode 100644 index 0000000..3943447 --- /dev/null +++ b/roles/tsg-cli-mxn/files/tsg-monitor.sh @@ -0,0 +1,75 @@ +#!/bin/sh + +#mxn + +#防止因上一次的命令阻塞或长时间未返回, +#导致10秒内还不结束, 要强行杀掉, +#否则长时间运行后, 会有大量后台进程运行! +killall_uncompleted_cmd(){ + killall -9 -q tsg_cluster_register + #killall -9 -q tsg_diagnose_background + killall -9 -q tsg_update_tags +} + +start_background_cmd(){ + #后台并发运行, 保证所有命令的开始运行时间基本一样, + #且不会因某个命令网络拥塞、执行时间长等问题,阻塞while(1)主循环 + /opt/tsg/tsg-monitor/tsg_cluster_register > /dev/null & + + #mxn板只检测cpu, mem, disk等, 前台cli命令启用diagnose, + #后台服务依靠oam snmp模块, 无需运行tsg_diagnose_background + #/opt/tsg/tsg-monitor/tsg_diagnose_background & + /opt/tsg/tsg-monitor/tsg_update_tags > /dev/null & +} + +#return value: current time in ms +get_current_time_in_ms(){ + time_sec=`date +"%s"` + time_nsec=`date +"%N"` + #echo $time_sec + #echo $time_nsec + + time_epoch_ms=`echo | awk -v a=$time_sec -v b=$time_nsec '{printf("%.f"), a*1000+b/1000/1000}'` + + echo $time_epoch_ms +} + +#args: +#begin from time, in ms +#wait for n ms +sleep_for_time_ms(){ + last_time=$1 + wait_sec=$2 + #break_time=`echo | awk -v a=$last_time -v b=$wait_sec '{printf("%.f"), a+b}'` + break_time=`expr $last_time + $wait_sec` + break_time_int=`expr $break_time` + #echo "start: last_time is:$last_time, expect break timeis:$break_time!" + + current_time=0 + break_time=0 + #break_time=`expr $last_time + 1000*$1` + while [ 1 ]; do + current_time=`get_current_time_in_ms` + current_time_int=`expr $current_time` + if [ $current_time_int -ge $break_time_int ]; then + #echo "current is: $current_time_int, break_time is:$break_time_int, break!" + break + else + #echo "break is: $current_time_int, last_time is:$break_time_int, continue!" + # usleep is us + usleep 1000 + fi + done + +} + +while [ 1 ]; do + start_time=`get_current_time_in_ms` + #echo tsg-monitor start at `date +"%Y/%m/%d, %H:%M:%S.%N"` >> /tmp/tsg-monitor.log + + start_background_cmd + sleep 10 + killall_uncompleted_cmd + + sleep_for_time_ms $start_time 15000 +done diff --git a/roles/tsg-cli-mxn/files/tsg_read_sn.sh b/roles/tsg-cli-mxn/files/tsg_read_sn.sh new file mode 100644 index 0000000..24e71bd --- /dev/null +++ b/roles/tsg-cli-mxn/files/tsg_read_sn.sh @@ -0,0 +1,110 @@ +#!/bin/bash +# ==================================================== +# Main Script Test for Check ZHK's CSA-7400 Chassis ID +# Edit:Edgar.Tang +# Release date: 2019.9.16 +# ==================================================== +a=`date` +Tstart=$(date +%s) +Stime=`date +%Y%m%d-%H%M%S` +open_intf.inst +patch=`pwd` +Version="A2" +#SPVer=`cat release_note.txt | grep VERSION | head -n 1 | awk -F ":" '{print $2}'` +i=0 +chmod 777 * +rm -f *.log +rm -f *.LOG +rm -rf *.bin +rm -rf tmp* +rm -rf *dat +rm -rf *PASS +rm -rf *id +rm -rf *ipmi +clear +function maintest(){ +#echo "##########################################################################" +#echo "=========================Check chassis id information===============" +#echo "-------------------------Check chassis id information---------------" + +if [ ! -f "cmm_api_tst" ];then + echo "not found cmm_api_tst!" + exit 1 +fi + +./cmm_api_tst 9 1 1 127.0.0.1 | tee chid.id +if [ $? != 0 ]; then + echo "cmm_api_tst failed!" + exit 1 +fi + +CHID=`cat chid.id | sed -n '1p' | awk -F ":" '{print $2}' | sed 's/ //g'` +CHIDL=`echo $CHID | awk '{print length($0)}'` + +if [ $CHIDL != 20 ];then + echo "CHID length is not 20!" + exit 1 +fi + +echo "{\"sn\": \"$CHID\"}" > ./tsg_sn.json +} + +#echo "#######################################################################" +#echo "==========================Check Main Switch information================ " +#echo "--------------------------Check Main Switch information----------------" + +ipmitool raw 0x2e 0x32 0x00 0x5f 0x13 | tee main.ipmi +ipmitool raw 0x2e 0x32 0x00 0x5f 0x13 | tail -n 1 | awk '{print $5}' | sed 's/ //g' | grep 01 +if [ $? == 0 ]; then + echo "ipmitool: Check DUT Switch for Main!.......................................PASS" + maintest $CHID $PSN $1 +else + sdrnum=`ipmitool sdr | grep -a ok | wc -l` + if [ $sdrnum == 23 ]; then + echo "sdrnum: Check DUT Switch for Main!.......................................PASS" + maintest $CHID $PSN $1 + else + echo "====================================================================================" + echo "====================FFFFFF======A========IIIIIIIII===LL=============================" + echo "====================F==========A=A===========I=======LL=============================" + echo "====================F=========A===A==========I=======LL=============================" + echo "====================FFFFF====AAAAAAA=========I=======LL=============================" + echo "====================F=======A=======A========I=======LL=============================" + echo "====================F======A=========A=======I=======LL=============================" + echo "====================F=====A===========A==IIIIIIIII===LLLLLLLLL======================" + echo "====================================================================================" + echo "FAIL FAIL FAIL FAIL FAIL FAIL FAIL FAIL FAIL FAIL FAIL FAIL FAIL FAIL FAIL" + echo "Check DUT Switch for Main!......................................FAIL" + echo "====================================================================================== " + echo "Please changed CMM for Main and please reboot another CMM via Serial Port;then retest" + echo "====================================================================================== " + read + i=1 + exit 1 + fi +fi + + +#end=$(date +%s) +#endt=$((end-Tstart)) +#echo "Test time: $endt seconds" +# +#clear +#echo "========================================================================" +#echo "Chassis Program Ver : $SPVer" +#echo "------------------------------------------------------------------------" +#echo "Chassis ID : $CHID" +#echo "Chassis ID length : $CHIDL" +#echo "------------------------------------------------------------------------" +#echo "Test Time : $endt seconds" +#echo "========================================================================" +#echo "=================PPPPP=======A=======SSSSSSSSS==SSSSSSSS================" +#echo "=================P====P=====A=A======S==========S=======================" +#echo "=================P====P====A===A=====S==========S=======================" +#echo "=================PPPPP====A=====A====SSSSSSSSS==SSSSSSSS================" +#echo "=================P=======AAAAAAAAA===========S=========S================" +#echo "=================P======A=========A==========S=========S================" +#echo "=================P=====A===========A=SSSSSSSSS==SSSSSSSS================" +#echo "========================================================================" + +#echo "Chassis ID : $CHID" diff --git a/roles/tsg-cli-mxn/tasks/main.yml b/roles/tsg-cli-mxn/tasks/main.yml new file mode 100644 index 0000000..4ab79ab --- /dev/null +++ b/roles/tsg-cli-mxn/tasks/main.yml @@ -0,0 +1,82 @@ +--- +- name: "copy tsg_read_sn.sh to destination server" + copy: + src: "{{ role_path }}/files/tsg_read_sn.sh" + dest: "/tmp/tsg-cli-deploy/" + mode: 0755 + when: use_chassis_hardware_sn | bool + +- name: "copy cmm_api_tst to destination server" + copy: + src: "{{ role_path }}/files/cmm_api_tst" + dest: "/tmp/tsg-cli-deploy/" + mode: 0755 + when: use_chassis_hardware_sn | bool + +- name: "run tsg_read_sn.sh on destination server" + shell: ./tsg_read_sn.sh + args: + chdir: /tmp/tsg-cli-deploy/ + when: use_chassis_hardware_sn | bool + +- name: "scp tsg_sn.json from destination server to local" + fetch: + src: "/tmp/tsg-cli-deploy/tsg_sn.json" + dest: "{{ role_path }}/../tsg-common-files/tsg_sn.json" + flat: yes + when: use_chassis_hardware_sn | bool + +- name: "copy tsg-cli rmp to destination server" + synchronize: + src: "{{ role_path }}/../tsg-common-files/{{ rpm_file_name }}" + dest: "/tmp/tsg-cli-deploy/" + +- name: "install tsg-cli" + yum: + name: "{{ packages }}" + state: present + vars: + packages: + - /tmp/tsg-cli-deploy/{{ rpm_file_name }} + +- name: Template the tsg_sn.json + template: + src: "{{ role_path }}/templates/tsg_sn.json.j2" + dest: "/opt/tsg/etc/tsg_sn.json" + tags: template + when: not use_chassis_hardware_sn | bool + +- name: "copy tsg_sn.json to destination server" + synchronize: + src: "{{ role_path }}/../tsg-common-files/tsg_sn.json" + dest: "/opt/tsg/etc/tsg_sn.json" + when: use_chassis_hardware_sn | bool + +- name: "copy tsg-monitor.service to destination server" + synchronize: + src: "{{ role_path }}/files/tsg-monitor.service" + dest: "/usr/lib/systemd/system" + +- name: "copy tsg-monitor.sh to destination server" + #synchronize: + copy: + src: "{{ role_path }}/files/tsg-monitor.sh" + dest: "/opt/tsg/tsg-monitor/" + mode: 0755 + +- name: "copy rsyslog.conf to destination server" + synchronize: + src: "{{ role_path }}/files/rsyslog.conf" + dest: "/etc/" + +- 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 \ No newline at end of file diff --git a/roles/tsg-cli-mxn/templates/tsg_sn.json.j2 b/roles/tsg-cli-mxn/templates/tsg_sn.json.j2 new file mode 100644 index 0000000..bceeb99 --- /dev/null +++ b/roles/tsg-cli-mxn/templates/tsg_sn.json.j2 @@ -0,0 +1,3 @@ +{ + "sn": "{{ SN }}" +} \ No newline at end of file diff --git a/roles/tsg-common-files/.gitignore b/roles/tsg-common-files/.gitignore new file mode 100644 index 0000000..ed8ebf5 --- /dev/null +++ b/roles/tsg-common-files/.gitignore @@ -0,0 +1 @@ +__pycache__ \ No newline at end of file diff --git a/roles/tsg-common-files/tsg-cli-1.0.13.c6d5037-1.el7.x86_64.rpm b/roles/tsg-common-files/tsg-cli-1.0.13.c6d5037-1.el7.x86_64.rpm new file mode 100644 index 0000000..b9156d2 Binary files /dev/null and b/roles/tsg-common-files/tsg-cli-1.0.13.c6d5037-1.el7.x86_64.rpm differ diff --git a/roles/tsg-common-files/tsg_sn.json b/roles/tsg-common-files/tsg_sn.json new file mode 100644 index 0000000..a72f17e --- /dev/null +++ b/roles/tsg-common-files/tsg_sn.json @@ -0,0 +1 @@ +{"sn": "GN191205CH1234567890"} diff --git a/test_host/hosts b/test_host/hosts index a04cff1..5e3cd0d 100644 --- a/test_host/hosts +++ b/test_host/hosts @@ -1,13 +1,50 @@ [all:vars] ansible_user=root +use_chassis_hardware_sn=true +rpm_file_name=tsg-cli-1.0.13.c6d5037-1.el7.x86_64.rpm [cluster_server] -172.16.124.133 +172.16.124.134 [blade-mxn] -172.16.124.132 -172.16.124.131 +172.16.124.133 [blade-00] -172.16.124.130 server_ip=172.16.124.132 -172.16.124.129 server_ip=172.16.124.131 +172.16.124.129 server_ip=172.16.124.133 + +[blade-01] +172.16.124.130 server_ip=172.16.124.133 + +[blade-02] +172.16.124.131 server_ip=172.16.124.133 + +[blade-03] +172.16.124.132 server_ip=172.16.124.133 + +[sled-mxn] +172.16.124.133 SN=CBT2201925000003 mcn0_ip=172.16.124.129 + +[sled-mcn0] +172.16.124.129 SN=CBT2201925000003 + +[sled-mcn1] +172.16.124.130 SN=CBT2201925000003 + +[sled-mcn2] +172.16.124.131 SN=CBT2201925000003 + +[sled-mcn3] +172.16.124.132 SN=CBT2201925000003 + +[Functional_Host:children] +sled-mcn0 +sled-mcn1 +sled-mcn2 +sled-mcn3 + +[tsg-all:children] +sled-mxn +sled-mcn0 +sled-mcn1 +sled-mcn2 +sled-mcn3