3 Commits

Author SHA1 Message Date
lijia
742162ef3f 修复/tmp/_MEIxxx大量临时文件占用空间BUG. 2020-04-17 14:23:04 +08:00
lijia
1740991877 read ADC hardware chassis id to SN. 2020-01-20 09:44:38 +08:00
lijia
b72efa677a 完善app告警信息;
增加基于ADC硬件机框ID作为设备sn功能.
2020-01-20 09:40:51 +08:00
25 changed files with 313 additions and 50 deletions

View File

@@ -1,6 +1,6 @@
[all:vars]
ansible_user=root
rpm_file_name=tsg-cli-1.0.11.d276da8-1.el7.x86_64.rpm
rpm_file_name=tsg-cli-1.0.13.c6d5037-1.el7.x86_64.rpm
[sled-mxn]
10.4.164.23 SN=CBT2201840103110

View File

@@ -1,6 +1,6 @@
[all:vars]
ansible_user=root
rpm_file_name=tsg-cli-1.0.11.d276da8-1.el7.x86_64.rpm
rpm_file_name=tsg-cli-1.0.13.c6d5037-1.el7.x86_64.rpm
[sled-mxn]
192.168.10.45 SN=CBT2201925000001

View File

@@ -1,6 +1,6 @@
[all:vars]
ansible_user=root
rpm_file_name=tsg-cli-1.0.11.d276da8-1.el7.x86_64.rpm
rpm_file_name=tsg-cli-1.0.13.c6d5037-1.el7.x86_64.rpm
[sled-mxn]
192.168.40.165 SN=CBT2201925000001

35
hosts.xxg.170.sn003 Normal file
View File

@@ -0,0 +1,35 @@
[all:vars]
ansible_user=root
use_chassis_hardware_sn=true
rpm_file_name=tsg-cli-1.0.13.c6d5037-1.el7.x86_64.rpm
[sled-mxn]
192.168.40.170 SN=CBT2201925000003
[sled-mcn0]
192.168.40.166 SN=CBT2201925000003
[sled-mcn1]
192.168.40.167 SN=CBT2201925000003
[sled-mcn2]
192.168.40.168 SN=CBT2201925000003
[sled-mcn3]
192.168.40.169 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

View File

@@ -1,6 +1,6 @@
[all:vars]
ansible_user=root
rpm_file_name=tsg-cli-1.0.11.d276da8-1.el7.x86_64.rpm
rpm_file_name=tsg-cli-1.0.13.c6d5037-1.el7.x86_64.rpm
[sled-mxn]
192.168.40.25 SN=CBT2201925000002

View File

@@ -89,5 +89,5 @@ local7.* /var/log/boot.log
#$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
.notice @@192.168.100.5:514
*.warning @@192.168.100.5:514
# ### end of the forwarding rule ###

View File

@@ -17,6 +17,8 @@ killall_uncompleted_cmd(){
killall -9 -q tsg_monit_protocol_v4
#killall -9 -q tsg_monit_stream_v3
killall -9 -q tsg_monit_stream_v4
rm -rf /tmp/_MEI*
}
start_background_cmd(){
@@ -77,10 +79,10 @@ sleep_for_time_ms(){
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
#echo tsg-monitor start at `date +"%Y/%m/%d, %H:%M:%S.%N"` >> /tmp/tsg-monitor.log
start_background_cmd
sleep 10
sleep 13
killall_uncompleted_cmd
sleep_for_time_ms $start_time 15000

View File

@@ -17,6 +17,14 @@
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:
@@ -35,13 +43,20 @@
dest: "/opt/tsg/tsg-monitor/"
mode: 0755
- name: "enable tsg-monitor service"
systemd:
name: tsg-monitor
enabled: yes
daemon_reload: yes
- name: "copy rsyslog.conf to destination server"
synchronize:
src: "{{ role_path }}/files/rsyslog.conf"
dest: "/etc/"
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

View File

@@ -89,5 +89,5 @@ local7.* /var/log/boot.log
#$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
.notice @@192.168.100.5:514
*.warning @@192.168.100.5:514
# ### end of the forwarding rule ###

View File

@@ -11,6 +11,8 @@ killall_uncompleted_cmd(){
killall -9 -q tsg_update_tags
killall -9 -q tsg_monit_interface
killall -9 -q tsg_monit_intercept
rm -rf /tmp/_MEI*
}
start_background_cmd(){
@@ -65,10 +67,10 @@ sleep_for_time_ms(){
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
#echo tsg-monitor start at `date +"%Y/%m/%d, %H:%M:%S.%N"` >> /tmp/tsg-monitor.log
start_background_cmd
sleep 10
sleep 13
killall_uncompleted_cmd
sleep_for_time_ms $start_time 15000

View File

@@ -17,6 +17,13 @@
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:
@@ -34,14 +41,21 @@
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
- name: "copy rsyslog.conf to destination server"
synchronize:
src: "{{ role_path }}/files/rsyslog.conf"
dest: "/etc/"

View File

@@ -89,5 +89,5 @@ local7.* /var/log/boot.log
#$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
.notice @@192.168.100.5:514
*.warning @@192.168.100.5:514
# ### end of the forwarding rule ###

View File

@@ -11,6 +11,8 @@ killall_uncompleted_cmd(){
killall -9 -q tsg_update_tags
killall -9 -q tsg_monit_interface
killall -9 -q tsg_monit_intercept
rm -rf /tmp/_MEI*
}
start_background_cmd(){
@@ -65,10 +67,10 @@ sleep_for_time_ms(){
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
#echo tsg-monitor start at `date +"%Y/%m/%d, %H:%M:%S.%N"` >> /tmp/tsg-monitor.log
start_background_cmd
sleep 10
sleep 13
killall_uncompleted_cmd
sleep_for_time_ms $start_time 15000

View File

@@ -17,6 +17,13 @@
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:
@@ -34,14 +41,20 @@
src: "{{ role_path }}/files/tsg-monitor.sh"
dest: "/opt/tsg/tsg-monitor/"
mode: 0755
- name: "enable tsg-monitor service"
systemd:
name: tsg-monitor
enabled: yes
daemon_reload: yes
- name: "copy rsyslog.conf to destination server"
synchronize:
src: "{{ role_path }}/files/rsyslog.conf"
dest: "/etc/"
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

View File

@@ -89,5 +89,5 @@ local7.* /var/log/boot.log
#$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
.notice @@192.168.100.5:514
*.warning @@192.168.100.5:514
# ### end of the forwarding rule ###

View File

@@ -11,6 +11,8 @@ killall_uncompleted_cmd(){
killall -9 -q tsg_update_tags
killall -9 -q tsg_monit_interface
killall -9 -q tsg_monit_intercept
rm -rf /tmp/_MEI*
}
start_background_cmd(){
@@ -65,10 +67,10 @@ sleep_for_time_ms(){
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
#echo tsg-monitor start at `date +"%Y/%m/%d, %H:%M:%S.%N"` >> /tmp/tsg-monitor.log
start_background_cmd
sleep 10
sleep 13
killall_uncompleted_cmd
sleep_for_time_ms $start_time 15000

View File

@@ -17,6 +17,13 @@
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:
@@ -34,14 +41,20 @@
src: "{{ role_path }}/files/tsg-monitor.sh"
dest: "/opt/tsg/tsg-monitor/"
mode: 0755
- name: "enable tsg-monitor service"
systemd:
name: tsg-monitor
enabled: yes
daemon_reload: yes
- name: "copy rsyslog.conf to destination server"
synchronize:
src: "{{ role_path }}/files/rsyslog.conf"
dest: "/etc/"
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

Binary file not shown.

View File

@@ -9,6 +9,8 @@ killall_uncompleted_cmd(){
killall -9 -q tsg_cluster_register
#killall -9 -q tsg_diagnose_background
killall -9 -q tsg_update_tags
rm -rf /tmp/_MEI*
}
start_background_cmd(){
@@ -65,10 +67,10 @@ sleep_for_time_ms(){
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
#echo tsg-monitor start at `date +"%Y/%m/%d, %H:%M:%S.%N"` >> /tmp/tsg-monitor.log
start_background_cmd
sleep 10
sleep 13
killall_uncompleted_cmd
sleep_for_time_ms $start_time 15000

View File

@@ -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"

View File

@@ -1,4 +1,31 @@
---
- 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 }}"
@@ -15,8 +42,15 @@
- name: Template the tsg_sn.json
template:
src: "{{ role_path }}/templates/tsg_sn.json.j2"
dest: /opt/tsg/etc/tsg_sn.json
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:
@@ -30,13 +64,19 @@
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
- name: "copy rsyslog.conf to destination server"
synchronize:
src: "{{ role_path }}/files/rsyslog.conf"
dest: "/etc/"
state: restarted

View File

@@ -0,0 +1 @@
{"sn": "GN191205CH1234567890"}

12
tsg-cli-uninstall.yml Normal file
View File

@@ -0,0 +1,12 @@
---
- hosts: sled-mcn0 sled-mcn1 sled-mcn2 sled-mcn3 sled-mxn
tasks:
- name: "stop tsg-monitor service"
service:
name: tsg-monitor
state: stopped
- name: "uninstall tsg-cli"
yum:
name: "tsg-cli"
state: absent