summaryrefslogtreecommitdiff
path: root/nmsclient
diff options
context:
space:
mode:
authorbsdbc <[email protected]>2019-04-02 09:52:52 +0800
committerbsdbc <[email protected]>2019-04-02 09:52:52 +0800
commit4f1a03aeb9329361e7e7c316a4baeaea2dd49518 (patch)
tree47fe65efc58dd9c299828b82380f6b2d7fbb038b /nmsclient
parent48f09fa63d5bfba5ab4d9b416e7f26cb5110c5f6 (diff)
init import
Diffstat (limited to 'nmsclient')
-rw-r--r--nmsclient/3Cerrorlog.sh83
-rw-r--r--nmsclient/NC_Batch/NC_install/ip1
-rw-r--r--nmsclient/NC_Batch/NC_install/nc_install.sh121
-rw-r--r--nmsclient/NC_Batch/NC_install/nmsclient.tar.gzbin0 -> 4406567 bytes
-rw-r--r--nmsclient/NC_Batch/nmsclient批量安装说明文档.docbin0 -> 24576 bytes
-rw-r--r--nmsclient/NC_Batch/pssh-2.3.tar.gzbin0 -> 22135 bytes
-rw-r--r--nmsclient/NC_install/autoinstall.sh170
-rw-r--r--nmsclient/NC_install/bin/fileComment.jarbin0 -> 997 bytes
-rw-r--r--nmsclient/NC_install/bin/nmsclient.jarbin0 -> 305752 bytes
-rw-r--r--nmsclient/NC_install/conf/clog.list29
-rw-r--r--nmsclient/NC_install/conf/jvm.conf2
-rw-r--r--nmsclient/NC_install/conf/log4j.properties36
-rw-r--r--nmsclient/NC_install/conf/myconfig.properties90
-rw-r--r--nmsclient/NC_install/conf/process.list114
-rw-r--r--nmsclient/NC_install/conf/version.properties4
-rw-r--r--nmsclient/NC_install/install.sh215
-rw-r--r--nmsclient/NC_install/lib/ant.jarbin0 -> 1289806 bytes
-rw-r--r--nmsclient/NC_install/lib/commons-beanutils-1.7.jarbin0 -> 188671 bytes
-rw-r--r--nmsclient/NC_install/lib/commons-collections.jarbin0 -> 571259 bytes
-rw-r--r--nmsclient/NC_install/lib/commons-io.jarbin0 -> 83613 bytes
-rw-r--r--nmsclient/NC_install/lib/commons-lang.jarbin0 -> 243016 bytes
-rw-r--r--nmsclient/NC_install/lib/commons-logging.jarbin0 -> 60841 bytes
-rw-r--r--nmsclient/NC_install/lib/ezmorph-1.0.4.jarbin0 -> 86381 bytes
-rw-r--r--nmsclient/NC_install/lib/fileComment.jarbin0 -> 997 bytes
-rw-r--r--nmsclient/NC_install/lib/java-unrar-0.3.jarbin0 -> 132819 bytes
-rw-r--r--nmsclient/NC_install/lib/javatar-2.5.jarbin0 -> 25176 bytes
-rw-r--r--nmsclient/NC_install/lib/json-lib-2.2.2-jdk15.jarbin0 -> 143977 bytes
-rw-r--r--nmsclient/NC_install/lib/junit.jarbin0 -> 121070 bytes
-rw-r--r--nmsclient/NC_install/lib/libsigar-amd64-linux.sobin0 -> 247235 bytes
-rw-r--r--nmsclient/NC_install/lib/libsigar-x86-linux.sobin0 -> 229559 bytes
-rw-r--r--nmsclient/NC_install/lib/log4j-1.2.15.jarbin0 -> 391834 bytes
-rw-r--r--nmsclient/NC_install/lib/ostermillerutils_1_07_00.jarbin0 -> 525947 bytes
-rw-r--r--nmsclient/NC_install/lib/sigar.jarbin0 -> 423169 bytes
-rw-r--r--nmsclient/NC_install/shell/bin/cer/client_ksbin0 -> 1306 bytes
-rw-r--r--nmsclient/NC_install/shell/bin/cer/client_tsbin0 -> 624 bytes
-rw-r--r--nmsclient/NC_install/shell/check_userpass.sh47
-rw-r--r--nmsclient/NC_install/shell/execCmdBySu.sh78
-rw-r--r--nmsclient/NC_install/shell/nmsagent.sh270
-rw-r--r--nmsclient/NC_install/shell/nmsclient_shouhu.sh55
-rw-r--r--nmsclient/NC_install/shell/restart.sh30
-rw-r--r--nmsclient/NC_install/shell/shutdown.sh30
-rw-r--r--nmsclient/NC_install/shell/startup.sh30
-rw-r--r--nmsclient/dklog.sh83
-rw-r--r--nmsclient/nmsclient批量安装说明文档.docbin0 -> 24576 bytes
-rw-r--r--nmsclient/process.sh267
45 files changed, 1755 insertions, 0 deletions
diff --git a/nmsclient/3Cerrorlog.sh b/nmsclient/3Cerrorlog.sh
new file mode 100644
index 0000000..e309219
--- /dev/null
+++ b/nmsclient/3Cerrorlog.sh
@@ -0,0 +1,83 @@
+#!/bin/bash
+base_dir="/home/ceiec/nms/nmsclient"
+conf=$base_dir"/conf/process.list"
+temp_dir=$base_dir"/temp"
+temp_filelist=$temp_dir"/findfile.list"
+myselfpid=$temp_dir"/cXlogrep.pid"
+
+diconf_dir="/home/ceiec/nms/nmsdata/nc_config"
+#diconf_file=$diconf_dir"/checktype100017_detection100103.cfg"
+diconf_file=`echo $0 | awk -F '/' '{print $NF}' | awk -F '.' '{print $1}' `
+diconf_file=$diconf_dir"/"$diconf_file".cfg"
+
+echo `date` $diconf_file >> /home/ceiec/nms/nmsclient/nc_logs/ttt.log
+
+cXlog_dir="/home/ceiec/nms/nmsclient/temp/pjr/20180828_1000_ccCli/bin/log_dir"
+findmaxdep=3
+
+monitorstart=`stat $diconf_file | grep Modify | awk '{print $2" "$3}'`
+mstimestamp=`date -d "$monitorstart" +%s%N`
+remstimestamp=$((mstimestamp/1000000))
+
+clogmaxsize=1024
+
+mypid=$$
+echo $$ > $myselfpid
+
+#echo $conf
+didata_dir=`cat $diconf_file | grep dataFileDir | cut -d = -f 2`
+ditemp_dir=`cat $diconf_file | grep tempDataFileDir | cut -d = -f 2`
+checkGap=`cat $diconf_file | grep checkGap | cut -d = -f 2`
+sleeptime=$((checkGap*60))
+dataFileDir=`cat $diconf_file | grep dataFileDir | cut -d = -f 2`
+pubInfo=`cat $diconf_file | grep pubInfo | cut -d = -f 2`
+
+pdate=`date +'%Y%m%d%H%M%S'`
+stat_file=$temp_dir"/$pdate"".rep"
+incoming_file=$temp_dir"/$pdate"".csv"
+temp_file=$temp_dir"/$pdate"".tmp"
+
+timeStamp=`date +%s%N`
+currentTimeStamp=$((timeStamp/1000000))
+later15mTimeStamp=$((currentTimeStamp+checkGap*60*1000))
+
+linenum=0
+
+ find $cXlog_dir -maxdepth $findmaxdep -mmin -$checkGap -name "*cc_send*" > $temp_filelist
+ #find $cXlog_dir -maxdepth $findmaxdep -mmin -$sleeptime -name "*cc_send*" > $temp_filelist
+
+ while read pline
+ do
+ if [ -n $pline ]; then
+ filesize=`ls -l $pline | awk '{ print $5 }'`
+ echo filesize=$filesize
+ if [ $filesize -gt $clogmaxsize ]; then
+ echo -e "$pline,,--,--,The log file is bigger than 1M. Please check it on server," >> $stat_file
+ linenum=$((linenum+1))
+ else
+ while read logline
+ do
+ retime=`echo $logline | awk -F '.' '{print $1}'`
+ c3ip=`echo $logline | awk '{print $3}'`
+ gdevip=`echo $logline | awk '{print $4}'`
+ repcontent=`echo $logline | awk '{for (i=5 ;i<=NF;i++) printf $i " | "; printf "\n" }'`
+
+ linenum=$((linenum+1))
+ echo -e "$pline,$retime,$c3ip,$gdevip,$repcontent," >> $stat_file
+ done < $pline
+ fi
+ fi
+ done < $temp_filelist
+
+ echo "$pubInfo,$remstimestamp,0,$currentTimeStamp,1,$later15mTimeStamp,1,OK,OK" > $temp_file
+ if [ -f $stat_file ]; then
+ linenum=`cat $stat_file | wc -l`
+ echo "details,$linenum" >> $temp_file
+ cat $stat_file >> $temp_file
+ else
+ echo "details,1" >> $temp_file
+ echo -e "$pline,,--,--,No cc_send log this $checkGap minites," >> $temp_file
+ fi
+ mv $temp_file $ditemp_dir
+# rm -rf $stat_file
+
diff --git a/nmsclient/NC_Batch/NC_install/ip b/nmsclient/NC_Batch/NC_install/ip
new file mode 100644
index 0000000..9d98583
--- /dev/null
+++ b/nmsclient/NC_Batch/NC_install/ip
@@ -0,0 +1 @@
+192.168.11.138
diff --git a/nmsclient/NC_Batch/NC_install/nc_install.sh b/nmsclient/NC_Batch/NC_install/nc_install.sh
new file mode 100644
index 0000000..24906b3
--- /dev/null
+++ b/nmsclient/NC_Batch/NC_install/nc_install.sh
@@ -0,0 +1,121 @@
+#!/bin/bash
+#带颜色输出内容
+#$1 颜色 red green yellow 警告 red 成功 green 提示/输入 yellow
+#$2 输出语句
+#$3 -n y/n 是否换行输出
+function pinfo(){
+ LINE=""
+ if [[ "$#" -gt 2 ]]; then
+ #statements
+ if [[ "$3" = "n" ]]; then
+ #statements
+ LINE="-n"
+ fi
+ fi
+ case $1 in
+ "red")
+ echo -e $LINE "\e[1;31m "${2}"\e[0m"
+ ;;
+ "green")
+ echo -e $LINE "\e[1;32m "${2}"\e[0m"
+ ;;
+ "yellow")
+ echo -e $LINE "\e[1;33m "${2}"\e[0m"
+ ;;
+ "blue")
+ echo -e $LINE "\e[1;34m "${2}"\e[0m"
+ ;;
+ *)
+ echo $LINE $2
+ ;;
+ esac
+}
+
+
+if [[ "$#" < 2 ]]; then
+ pinfo red "the script need parameters:dc host and node ip file ! "
+ exit
+fi
+
+#IP_RE="((25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))\.){3}(25[0-5]|2[0-4]\d|((1\d{2})|([1-9]?\d)))"
+
+IP_RE="^([0-9]{1,3}.){3}[0-9]{1,3}$"
+
+#dc的ip
+DC_HOST="$1"
+#保存需要安装nc机器ip的文件
+NODE_FILE="$2"
+#nc安装目录
+INSTALL_DIR="/home/ceiec/nms"
+
+if [[ "$DC_HOST" =~ $IP_RE ]]; then
+ echo -n ""
+else
+ pinfo red "the first parameter dc host is invalid!"
+ exit
+fi
+
+(head "$NODE_FILE" >/dev/null 2>&1)
+
+if [[ "$?" == 1 ]];then
+ pinfo red "the second parameter node ip file is invalid!"
+ exit
+fi
+
+#当前目录
+TEMP=`dirname "$0"`
+CUR_DIR=`cd "$TEMP";pwd`
+
+#nc压缩包
+NCNAME="nmsclient.tar.gz"
+#jre压缩包
+JRENAME="jre-7u80-linux-i586.tar.gz"
+
+if [ "`uname -i`" = "x86_64" ];then
+ JRENAME="jre-7u80-linux-x64.tar.gz"
+fi
+
+#绝对路径
+NCFILE=${CUR_DIR}"/"${NCNAME}
+JREFILE=${CUR_DIR}"/"${JRENAME}
+
+
+#jre安装目录
+JRE_DIR="jre1.7.0_80"
+
+if [[ ! -f "$NCFILE" ]];then
+ pinfo red "the nmsclient file is not exist!"
+ exit
+fi
+
+if [[ ! -f "$JREFILE" ]];then
+ pinfo red "the jre file is not exist!"
+ exit
+fi
+
+pinfo yellow "安装程序准备就绪···"
+echo "========================================================="
+pinfo yellow "开始拷贝jre文件···"
+pscp -h "$NODE_FILE" "$JREFILE" /home
+pinfo green "拷贝jre文件完成!"
+echo "========================================================="
+pinfo yellow "开始拷贝NC安装程序···"
+pscp -h "$NODE_FILE" "$NCFILE" /home
+pinfo green "NC安装程序拷贝完成!"
+echo "========================================================="
+
+function rand(){
+ min=$1
+ max=$(($2-$min+1))
+ num=$(date +%s%N)
+ echo $(($num%$max+$min))
+}
+
+pinfo yellow "开始安装NC···"
+echo "========================================================="
+prop_name="server_host"
+PROP_FILE=${INSTALL_DIR}"/nmsclient/conf/myconfig.properties"
+pssh -i -t 60 -h "$NODE_FILE" "mkdir -p ${INSTALL_DIR};mv /home/${NCNAME} ${INSTALL_DIR};tar -xzf ${INSTALL_DIR}/${NCNAME} -C ${INSTALL_DIR};mkdir -p ${INSTALL_DIR}/${JRE_DIR};mv /home/${JRENAME} ${INSTALL_DIR};tar -xzf ${INSTALL_DIR}/${JRENAME} -C ${INSTALL_DIR}/${JRE_DIR} --strip-components=1 ;ln -s ${INSTALL_DIR}/${JRE_DIR} ${INSTALL_DIR}/nmsjdk; sed -i 's|^$prop_name.*|$prop_name=$DC_HOST|' $PROP_FILE;echo '5-20 秒后启动nmsclient~';sleep $(rand 5 20);bash ${INSTALL_DIR}/nmsclient/shell/startup.sh;echo ${INSTALL_DIR}'/nmsclient/shell/startup.sh'>>/etc/rc.d/rc.local;chmod +x /etc/rc.d/rc.local;" 2>>error.log
+pinfo green "程序安装完成!"
+
+
diff --git a/nmsclient/NC_Batch/NC_install/nmsclient.tar.gz b/nmsclient/NC_Batch/NC_install/nmsclient.tar.gz
new file mode 100644
index 0000000..4eed311
--- /dev/null
+++ b/nmsclient/NC_Batch/NC_install/nmsclient.tar.gz
Binary files differ
diff --git a/nmsclient/NC_Batch/nmsclient批量安装说明文档.doc b/nmsclient/NC_Batch/nmsclient批量安装说明文档.doc
new file mode 100644
index 0000000..5d3ee5d
--- /dev/null
+++ b/nmsclient/NC_Batch/nmsclient批量安装说明文档.doc
Binary files differ
diff --git a/nmsclient/NC_Batch/pssh-2.3.tar.gz b/nmsclient/NC_Batch/pssh-2.3.tar.gz
new file mode 100644
index 0000000..8f55f77
--- /dev/null
+++ b/nmsclient/NC_Batch/pssh-2.3.tar.gz
Binary files differ
diff --git a/nmsclient/NC_install/autoinstall.sh b/nmsclient/NC_install/autoinstall.sh
new file mode 100644
index 0000000..bb09a31
--- /dev/null
+++ b/nmsclient/NC_install/autoinstall.sh
@@ -0,0 +1,170 @@
+#!/bin/bash
+
+# --- set default value
+DEFAULT_DATA_DIR="/home/ceiec/nms/nmsdata"
+DEFAULT_INSTALL_DIR="/home/ceiec/nms/nmsclient"
+
+# --- set install dir
+PRG="$0"
+PRGDIR=`dirname "$PRG"`
+CUR_PRGDIR=`cd "$PRGDIR"; pwd`
+
+INSTALL_DIR="$DEFAULT_INSTALL_DIR"
+
+if [ ! -d $INSTALL_DIR ]
+ then
+ mkdir -p $INSTALL_DIR
+fi
+
+INSTALL_DIR=`cd "$INSTALL_DIR"; pwd`
+
+# --- check jdk and jdk-version
+install_jdk=0
+javaversion=`java -version 2>&1|grep "java version"`
+if [ -n "$javaversion" ]
+ then
+ # javaversion=${javaversion:14:3}
+ javavmajor=`echo $javaversion | cut -c15`
+ javavminor=`echo $javaversion | cut -c17`
+# OS_TYPE=$( lsb_release -d| cut -d: -f2| cut -f2 )
+# if [ "`echo $OS_TYPE | cut -c1-6`" = "Ubuntu" ]
+# then
+# if [ 2 -gt $javavmajor ]; then
+# if [ 6 -gt $javavminor ]; then
+# install_jdk=1
+# fi
+# fi
+# else
+ if [[ 2 -gt $javavmajor && 6 -gt $javavminor ]]; then
+ install_jdk=1
+ fi
+# fi
+ else
+ install_jdk=1
+fi
+
+# --- install jdk
+cd "$INSTALL_DIR"/..
+NMS_JDK="$(pwd)/nmsjdk"
+JDK_DIR="$(pwd)/jre1.7.0_80"
+JDK_BIN_FILE=$CUR_PRGDIR"/jre_install/jre-7u80-linux-i586.tar.gz"
+if [ "`uname -i`" = "x86_64" ];then
+ JDK_BIN_FILE=$CUR_PRGDIR"/jre_install/jre-7u80-linux-x64.tar.gz"
+fi
+if [ $install_jdk = 1 ]
+ then
+ if [ ! -e "$NMS_JDK" ]
+ then
+ echo "JDK bin file: $JDK_BIN_FILE"
+ echo "now, install jdk: $NMS_JDK"
+ sleep 3
+
+ if [ ! -e "$JDK_DIR" ];then
+ mkdir -p $JDK_DIR
+ fi
+ tar -xzf $JDK_BIN_FILE -C $JDK_DIR --strip-components=1 || installJdk=1
+ if [ -n "$installJdk" ];then
+ echo "install jdk failure, exit program"
+ exit 1
+ fi
+ ln -s $JDK_DIR $NMS_JDK
+ echo "install jdk done"
+ fi
+elif [ -n "$JAVA_HOME" ];then
+ ln -s $JAVA_HOME $NMS_JDK
+else
+ echo "JDK bin file: $JDK_BIN_FILE"
+ echo "now, install jdk: $NMS_JDK"
+ sleep 3
+ if [ ! -e "$JDK_DIR" ];then
+ mkdir -p $JDK_DIR
+ fi
+ tar -xzf $JDK_BIN_FILE -C $JDK_DIR --strip-components=1 || installJdk=1
+ if [ -n "$installJdk" ];then
+ echo "install jdk failure, exit program"
+ exit 1
+ fi
+ ln -s $JDK_DIR $NMS_JDK
+ echo "install jdk done"
+fi
+cd "$CUR_PRGDIR"
+
+echo "==========================================="
+echo "NMS_JDK: $NMS_JDK"
+echo "INSTALL_DIR: $INSTALL_DIR"
+echo "==========================================="
+
+# --- copy file to install_dir
+if [ "$INSTALL_DIR" != "$CUR_PRGDIR" ];then
+ CP_DIR=(
+ bin
+ lib
+ conf
+ shell
+ )
+ #cp
+ for CP_NAME in ${CP_DIR[@]}
+ do
+ cp -a $CUR_PRGDIR"/$CP_NAME" $INSTALL_DIR
+ done
+fi
+
+
+function modify_file(){
+ if [ $# != 2 ]
+ then
+ echo "usage: modify_file [prop_name] [prop_value]"
+ exit 0
+ fi
+ prop_name="$1"
+ prop_value="$2"
+ #echo "modify_file $prop_name $prop_value"
+ if [ -z "$(cat $PROP_FILE |grep $prop_name)" ]
+ then
+ echo "" >> $PROP_FILE
+ echo "$prop_name=$prop_value" >> $PROP_FILE
+ else
+ sed -i "s@^$prop_name.*@$prop_name=$prop_value@" $PROP_FILE
+ fi
+}
+
+# --- modify property
+#-------------file path
+path="$DEFAULT_DATA_DIR"
+#-------------include path
+include_path="$INSTALL_DIR,$path"
+#-------------exclude path
+exclude_path="$INSTALL_DIR/bin,$INSTALL_DIR/lib,$INSTALL_DIR/shell,$INSTALL_DIR/conf"
+#-------------log4j dir
+logs_path="$path/nc_logs"
+
+PROP_FILE=$INSTALL_DIR"/conf/myconfig.properties"
+#echo "PROP_FILE: $PROP_FILE"
+modify_file "local.data.path" $path
+modify_file "common.del.path.include" $include_path
+modify_file "common.del.path.exclude" $exclude_path
+
+# modify log4j
+PROP_FILE=$INSTALL_DIR"/conf/log4j.properties"
+encoding=${LANG#*.}
+modify_file "log4j.appender.stdout.encoding" $encoding
+modify_file "log4j.appender.debugAppender.encoding" $encoding
+modify_file "log4j.appender.infoAppender.encoding" $encoding
+modify_file "log4j.appender.debugAppender.File" "$logs_path/nmsclient_debug.log"
+modify_file "log4j.appender.infoAppender.File" "$logs_path/nmsclient_info.log"
+
+#permit
+cd $INSTALL_DIR"/shell"
+chmod 755 *.sh
+cd $CUR_PRGDIR
+
+if [ -z "$(cat /etc/rc.local|grep $INSTALL_DIR"/shell/startup.sh")" ]
+then
+ echo $INSTALL_DIR"/shell/startup.sh" >> /etc/rc.local
+fi
+
+echo ""
+echo "install successed..."
+echo "please use [$INSTALL_DIR/shell/startup.sh] to run the program..."
+
+$INSTALL_DIR/shell/startup.sh
diff --git a/nmsclient/NC_install/bin/fileComment.jar b/nmsclient/NC_install/bin/fileComment.jar
new file mode 100644
index 0000000..8c251d9
--- /dev/null
+++ b/nmsclient/NC_install/bin/fileComment.jar
Binary files differ
diff --git a/nmsclient/NC_install/bin/nmsclient.jar b/nmsclient/NC_install/bin/nmsclient.jar
new file mode 100644
index 0000000..3b4688e
--- /dev/null
+++ b/nmsclient/NC_install/bin/nmsclient.jar
Binary files differ
diff --git a/nmsclient/NC_install/conf/clog.list b/nmsclient/NC_install/conf/clog.list
new file mode 100644
index 0000000..7c07900
--- /dev/null
+++ b/nmsclient/NC_install/conf/clog.list
@@ -0,0 +1,29 @@
+# This file list all NTCS processes
+# nms
+#nmsweb=/home/nms/apache-tomcat-7.0.59/logs
+#nmsdc=/home/nms/datacontroller/dc_logs
+#nmsclient=/home/nms/nmsclient/nc_logs
+# NTCS web
+# ntcsweb=apache-tomcat
+# NTCS Web-Service MariaDB
+mariadb=/var/lib/mysql,db_error.log
+# NTCS mid-Service
+#galaxy=galaxyTomcat
+# Config Line
+#tensor=tensor
+# AV analysis
+#avanalyser=rssb_maskey
+#pic=imagePlatform
+#voip=voipPlatform
+#audio=audio_platform
+#video=video_platform
+#fragcheck=frag_index_cluster
+#blacklist=castle_black
+#C2 critial log
+pzffff=/home/pjr/20180828_1000_ccCli/bin/log_dir,cc_recv
+#this pzffffres must under pzffff
+pzffc2res=/home/pjr/20180828_1000_ccCli/bin,RESTART
+#C3 critial log
+pzffhj=/home/pjr/20180828_1000_cccServer,RESTART
+
+
diff --git a/nmsclient/NC_install/conf/jvm.conf b/nmsclient/NC_install/conf/jvm.conf
new file mode 100644
index 0000000..f4edf37
--- /dev/null
+++ b/nmsclient/NC_install/conf/jvm.conf
@@ -0,0 +1,2 @@
+-Xms64m
+-Xmx128m \ No newline at end of file
diff --git a/nmsclient/NC_install/conf/log4j.properties b/nmsclient/NC_install/conf/log4j.properties
new file mode 100644
index 0000000..09b45c3
--- /dev/null
+++ b/nmsclient/NC_install/conf/log4j.properties
@@ -0,0 +1,36 @@
+log4j.rootLogger = debug,stdout,logfile,errorLog
+
+log4j.appender.stdout = org.apache.log4j.ConsoleAppender
+log4j.appender.stdout.layout.ConversionPattern = %d %p [%l] [%t] - <%m>%n
+log4j.appender.stdout.layout = org.apache.log4j.PatternLayout
+
+#----------------------debug---------------------
+
+log4j.appender.logfile = org.apache.log4j.RollingFileAppender
+log4j.appender.logfile.MaxFileSize = 50MB
+log4j.appender.logfile.MaxBackupIndex = 20
+
+log4j.appender.logfile.File = ../nc_logs/nmsclient.log
+log4j.appender.logfile.layout.ConversionPattern = %d %p [%l] [%t] - <%m>%n
+log4j.appender.logfile.layout = org.apache.log4j.PatternLayout
+
+#----------------------error---------------------
+log4j.logger.errorLog = warn,errorLog
+log4j.appender.errorLog = org.apache.log4j.RollingFileAppender
+log4j.appender.errorLog.MaxFileSize = 50MB
+log4j.appender.errorLog.Append = true
+log4j.appender.errorLog.Threshold = warn
+log4j.appender.errorLog.MaxBackupIndex = 10
+log4j.appender.errorLog.File = ../nc_logs/error.log
+log4j.appender.errorLog.layout.ConversionPattern = %d %p [%l] [%t] - <%m>%n
+log4j.appender.errorLog.layout = org.apache.log4j.PatternLayout
+
+log4j.appender.stdout.encoding=UTF-8
+
+log4j.appender.debugAppender.encoding=UTF-8
+
+log4j.appender.infoAppender.encoding=UTF-8
+
+log4j.appender.debugAppender.File=/home/nms/nmsclient/nc_logs/nmsclient_debug.log
+
+log4j.appender.infoAppender.File=/home/nms/nmsclient/nc_logs/nmsclient_info.log
diff --git a/nmsclient/NC_install/conf/myconfig.properties b/nmsclient/NC_install/conf/myconfig.properties
new file mode 100644
index 0000000..7f9db1f
--- /dev/null
+++ b/nmsclient/NC_install/conf/myconfig.properties
@@ -0,0 +1,90 @@
+#-------------------需要修改配置(Local Path)-----------------
+# 文件存放总路径,不要放于NmsClient部署目录下,根据盘符相应修改
+local.data.path=
+# 可删范围,只有在此路径下的文件Agent才可以删除,多个路径逗号隔开
+common.del.path.include=
+# 禁删范围,Agent可删路径下不能删除的路径,多个路径逗号隔开(注:若是禁删配置有单个文件,需相应修改代码)
+common.del.path.exclude=
+#------------------------SSLSocket----------------------
+# DataController部署的主机IP,需对应修改
+server_host=
+# DataController端的监听端口,用来与Server通信
+server_port = 60702
+# NMSClient自己的监听端口,用来接收Server发送的信息
+agent_port = 60701
+# SSL通信,此值不能更改
+local.ssl.keys=./bin/cer/client_ks
+local.ssl.trust=./bin/cer/client_ts
+local.ssl.path=./bin/cer
+# socket通信超时时间
+socket.timeout.minutes=30
+#------------------------Common------------------------
+# 写文件与通信流默认编码
+charset =UTF-8
+# 删除日志文件,单位天,默认保存七天,可根据情况修改
+common.del.log.days=7
+# 删除数据文件(包括监测数据和任务相关文件),单位小时,默认保存24小时,可根据情况修改
+common.del.data.hours=24
+# 删除升级时推送过来的文件,单位天,默认保存90天,可根据情况修改
+common.del.upgradefile.days=90
+# 删除临时文件,单位天,默认保存2天,可根据情况修改
+common.del.temp.days=2
+# 上传数据循环间隔,默认5分钟上传一次,可根据情况修改【数据由Server主动收集,该属性 废弃】
+common.upload.data.minutes=5
+# 定时清理内存中已完成的任务时间间隔,单位小时,默认2小时
+common.task.clear.hours=2
+#------------------------ThreadPool------------------------
+# Socket通讯线程池最大个数
+common.thread.socket.size=10
+# 定时执行线程池最大个数
+common.thread.schedule.size=15
+#------------------------Compress--------------------------
+# 文件累积达到一定数量压缩打包上传,默认1000个,可修改
+common.zip.min.size=1000
+# 压缩打包最多包含文件个数,默认2000个,可修改
+common.zip.max.size=2000
+# 回传文件累积达到一定数量压缩打包上传,默认10个,可修改
+common.max.return.size=10
+#-------------------------Local Path-------------------------
+# 自己写的脚本存放路径,不需修改
+local.script.path = ./shell
+# 监测配置基本信息文件后缀
+local.config.file.suffix = .cfg
+# NmsClient启动后PID存放文件,需与启动脚本中一致,建议不修改
+local.agent.pidfile = ./temp/agentPid.temp
+#-----------------系统预定义的监测类型(不需修改)----------------
+sys.check.type.cpu=cpu
+sys.check.type.disk=disk
+sys.check.type.memory=memory
+sys.check.type.net=net
+sys.check.type.systemdate=systemdate
+sys.check.type.process=process
+sys.check.type.process.nmsagent=nmsclient
+sys.check.type.systeminfo=systeminfo
+#------------------Debug调试使用(不需修改)---------------------
+debug.init.task.flag = 0
+debug.plugin.flag = 0
+debug.sysdetect.flag = 0
+#--【数据由Server主动收集,该属性 废弃】
+debug.uploaddata.flag = 0
+debug.alarm.flag = 0
+debug.delfile.flag = 0
+#--【数据由Server主动收集,该属性 废弃】
+debug.taskresult.flag = 0
+#--【数据由Server主动收集,该属性 废弃】
+debug.taskreturn.flag =0
+active.alarm.start=true
+#监测数据设置告警时,对于指定多个标识符(如多个盘符、多个CPU、多个网卡)的分隔符
+alarm.set.marker.separator=|
+config.update.flag = 5
+
+
+
+#监测数据主动上报,0:启用,1:不启用
+data.send.thread.flag=0
+#主动数据上报 ip,不填默认为 server_host 的值
+#data.send.thread.host=
+#主动数据上报 port,默认:9527
+data.send.thread.port=9527
+#主动数据上报间隔 interval,单位 s,默认为 10s
+data.send.thread.interval=10
diff --git a/nmsclient/NC_install/conf/process.list b/nmsclient/NC_install/conf/process.list
new file mode 100644
index 0000000..9230131
--- /dev/null
+++ b/nmsclient/NC_install/conf/process.list
@@ -0,0 +1,114 @@
+# This file list all NTCS processes
+# process stat check
+processcheck=pidcheck
+
+#NTC Interface
+ntcsweb=apache-tomcat
+mariadb=mysqld
+
+#NTC Mid
+galaxyService=galaxy-service
+galaxyFsync=galaxy-fsync-service
+galaxyTraffic=galaxy-traffic-service
+galaxyPush=galaxy-push-service
+galaxyStat=galaxy-stat-service
+galaxyTest=galaxyTomcat
+#logComplete=log-stream-completion
+#logStat=log-stream-stat
+#logTopIP=log-stream-top-ip
+#logTopN=log-stream-top
+#logUV=log-stream-uv
+
+
+#NTC config distribute
+Tensor=Tensor
+Redis=Redis
+panguValve=pangu_valve
+
+#NTC dynamic config
+Redis=Redis
+
+#NTC ASEM
+mrzcpd=mrzcpd
+Sapp=Sapp
+Oam=Oam
+
+#NTC document
+maskey2.0=maskey2.0
+
+#NTC multimedia
+rssbMaskey=rssb_maskey
+fragIndexCluster=frag_index_cluster
+castleBlack=castle_black
+eastwatch=eastwatch
+platformvideo=platformvideo
+platformaudio=platformaudio
+platformimage=platformimage
+platformvoip=platformvoip
+
+# AV analysis
+#avanalyser=rssb_maskey
+#pic=imagePlatform
+#voip=voipPlatform
+#audio=audio_platform
+#video=video_platform
+#fragcheck=frag_index_cluster
+#blacklist=castle_black
+
+#NTC protocol
+dkLdp=dk_ldp
+dkZeusLogclct=dk_zeus_logclct
+dkSappClean=dk_sapp_clean
+dkZeusNtbapre=dk_zeus_ntbapre
+dkSappNtba=dk_sapp_ntba
+
+#NTC log
+zookeeper=zookeeper
+Kafka=Kafka
+Strom=Strom
+clickhouse=clickhouse
+Hades=Hades
+
+#NTC operations
+nmsweb=tomcat
+nmsdc=DataController
+nmsclient=nmsclient
+consul=consul
+telegraf=telegraf
+infludb=infludb
+Grafana=Grafana
+
+#AntiDDOS
+mrzcpd=mrzcpd
+Sapp=Sapp
+Torches=Torches
+
+#IP reuse
+irAccess=ir_access
+irFoward=sapp
+
+#IP discovery
+IPDiscovery=IP_discovery
+Redis=Redis
+
+#National agency
+Tfe=Tfe
+kni=kni
+Oam=Oam
+
+#Proxy cache
+Minio=Minio
+minioEventsPretreat=minio_events_pretreat
+minioDeteteClient=minio_detete_client
+
+#proxy cert
+certStore=cert_store
+redis=redis
+
+#other
+# C2 and C3
+pzffff=cc_cli
+#the following line is just for RESTART log check of C2
+pzffc2res=pzffc2res
+pzffhj=ccc_ser
+pzffkeep=pzff_keep
diff --git a/nmsclient/NC_install/conf/version.properties b/nmsclient/NC_install/conf/version.properties
new file mode 100644
index 0000000..c6e699a
--- /dev/null
+++ b/nmsclient/NC_install/conf/version.properties
@@ -0,0 +1,4 @@
+#
+#Thu Oct 18 17:31:38 CST 2018
+NS_version=100041
+NA_version=100034
diff --git a/nmsclient/NC_install/install.sh b/nmsclient/NC_install/install.sh
new file mode 100644
index 0000000..a4eb9b7
--- /dev/null
+++ b/nmsclient/NC_install/install.sh
@@ -0,0 +1,215 @@
+#!/bin/bash
+
+# --- set default value
+DEFAULT_DATA_DIR="/home/ceiec/nms/nmsdata"
+DEFAULT_INSTALL_DIR="/home/ceiec/nms/nmsclient"
+
+# --- set install dir
+PRG="$0"
+PRGDIR=`dirname "$PRG"`
+CUR_PRGDIR=`cd "$PRGDIR"; pwd`
+
+if [ $# = 0 ]
+ then
+ echo -n "enter intall dir [default: $DEFAULT_INSTALL_DIR]:"
+ read INSTALL_DIR
+ if [ -z "$INSTALL_DIR" ]; then
+ INSTALL_DIR="$DEFAULT_INSTALL_DIR"
+ fi
+else
+ INSTALL_DIR="$1"
+fi
+
+if [ ! -d $INSTALL_DIR ]
+ then
+ mkdir -p $INSTALL_DIR
+fi
+
+INSTALL_DIR=`cd "$INSTALL_DIR"; pwd`
+
+# --- check jdk and jdk-version
+install_jdk=0
+javaversion=`java -version 2>&1|grep "java version"`
+if [ -n "$javaversion" ]
+ then
+ # javaversion=${javaversion:14:3}
+ javavmajor=`echo $javaversion | cut -c15`
+ javavminor=`echo $javaversion | cut -c17`
+# OS_TYPE=$( lsb_release -d| cut -d: -f2| cut -f2 )
+# if [ "`echo $OS_TYPE | cut -c1-6`" = "Ubuntu" ]
+# then
+# if [ 2 -gt $javavmajor ]; then
+# if [ 6 -gt $javavminor ]; then
+# install_jdk=1
+# fi
+# fi
+# else
+ if [[ 2 -gt $javavmajor && 6 -gt $javavminor ]]; then
+ install_jdk=1
+ fi
+# fi
+ else
+ install_jdk=1
+fi
+
+# --- install jdk
+cd "$INSTALL_DIR"/..
+NMS_JDK="$(pwd)/nmsjdk"
+JDK_DIR="$(pwd)/jre1.7.0_80"
+JDK_BIN_FILE=$CUR_PRGDIR"/jre_install/jre-7u80-linux-i586.tar.gz"
+if [ "`uname -i`" = "x86_64" ];then
+ JDK_BIN_FILE=$CUR_PRGDIR"/jre_install/jre-7u80-linux-x64.tar.gz"
+fi
+if [ $install_jdk = 1 ]
+ then
+ if [ ! -e "$NMS_JDK" ]
+ then
+ echo "JDK bin file: $JDK_BIN_FILE"
+ echo "now, install jdk: $JDK_DIR"
+ sleep 3
+ if [ ! -e "$JDK_DIR" ];then
+ mkdir -p $JDK_DIR
+ fi
+ tar -xzf $JDK_BIN_FILE -C $JDK_DIR --strip-components=1 || installJdk=1
+ if [ -n "$installJdk" ];then
+ echo "install jdk failure, exit program"
+ exit 1
+ fi
+ ln -s $JDK_DIR $NMS_JDK
+ echo "install jdk done"
+ fi
+elif [ -n "$JAVA_HOME" ];then
+ ln -s $JAVA_HOME $NMS_JDK
+else
+ echo "JDK bin file: $JDK_BIN_FILE"
+ echo "now, install jdk: $JDK_DIR"
+ sleep 3
+ if [ ! -e "$JDK_DIR" ];then
+ mkdir -p $JDK_DIR
+ fi
+ tar -xzf $JDK_BIN_FILE -C $JDK_DIR --strip-components=1 || installJdk=1
+ if [ -n "$installJdk" ];then
+ echo "install jdk failure, exit program"
+ exit 1
+ fi
+ ln -s $JDK_DIR $NMS_JDK
+ echo "install jdk done"
+fi
+cd "$CUR_PRGDIR"
+
+echo "==========================================="
+echo "NMS_JDK: $NMS_JDK"
+echo "INSTALL_DIR: $INSTALL_DIR"
+echo "==========================================="
+
+# --- copy file to install_dir
+if [ "$INSTALL_DIR" == "$CUR_PRGDIR" ]
+ then
+ echo "install directory is current program directory..."
+else
+ echo "install program, it may take a few time..."
+ CP_DIR=(
+ bin
+ lib
+ conf
+ shell
+ )
+ #cp
+ for CP_NAME in ${CP_DIR[@]}
+ do
+ cp -a $CUR_PRGDIR"/$CP_NAME" $INSTALL_DIR
+ done
+fi
+
+
+function modify_file(){
+ if [ $# != 2 ]
+ then
+ echo "usage: modify_file [prop_name] [prop_value]"
+ exit 0
+ fi
+ prop_name="$1"
+ prop_value="$2"
+ #echo "modify_file $prop_name $prop_value"
+ if [ -z "$(cat $PROP_FILE |grep $prop_name)" ]
+ then
+ echo "" >> $PROP_FILE
+ echo "$prop_name=$prop_value" >> $PROP_FILE
+ else
+ sed -i "s@^$prop_name.*@$prop_name=$prop_value@" $PROP_FILE
+ fi
+}
+
+# --- modify property
+#-------------file path
+echo -n "please enter data path, notice: this path not within $INSTALL_DIR, [default $DEFAULT_DATA_DIR]: "
+read path
+if [ -z "$path" ]
+ then
+ path="$DEFAULT_DATA_DIR"
+fi
+#-------------include path
+echo -n "delete include path [default $INSTALL_DIR,$path ]: "
+read include_path
+if [ -z "$include_path" ]
+ then
+ include_path="$INSTALL_DIR,$path"
+else
+ include_path="$INSTALL_DIR,$path,$include_path"
+fi
+#-------------exclude path
+echo -n "delete exclude path [default $INSTALL_DIR/bin,$INSTALL_DIR/lib,$INSTALL_DIR/shell,$INSTALL_DIR/conf ]: "
+read exclude_path
+if [ -z "$exclude_path" ]
+ then
+ exclude_path="$INSTALL_DIR/bin,$INSTALL_DIR/lib,$INSTALL_DIR/shell"
+else
+ exclude_path="$$INSTALL_DIR/bin,$INSTALL_DIR/lib,$INSTALL_DIR/shell,$exclude_path"
+fi
+#-------------nmsserver ip
+echo -n "enter DataController ip: "
+read server_ip
+while [ -z "$server_ip" ]
+ do
+ echo -n "DataController ip cannot null, please enter ip: "
+ read server_ip
+done
+#-------------log4j dir
+echo -n "enter logs path [default $path/nc_logs]: "
+read logs_path
+if [ -z "$logs_path" ]
+ then
+ logs_path="$path/nc_logs"
+fi
+
+#path=${path//\//\\/}
+
+PROP_FILE=$INSTALL_DIR"/conf/myconfig.properties"
+#echo "PROP_FILE: $PROP_FILE"
+modify_file "local.data.path" $path
+modify_file "common.del.path.include" $include_path
+modify_file "common.del.path.exclude" $exclude_path
+modify_file "server_host" $server_ip
+
+# modify log4j
+PROP_FILE=$INSTALL_DIR"/conf/log4j.properties"
+encoding=${LANG#*.}
+modify_file "log4j.appender.stdout.encoding" $encoding
+modify_file "log4j.appender.debugAppender.encoding" $encoding
+modify_file "log4j.appender.infoAppender.encoding" $encoding
+modify_file "log4j.appender.debugAppender.File" "$logs_path/nmsclient_debug.log"
+modify_file "log4j.appender.infoAppender.File" "$logs_path/nmsclient_info.log"
+
+#permit
+cd $INSTALL_DIR"/shell"
+chmod 755 *.sh
+cd $CUR_PRGDIR
+
+if [ -z "$(cat /etc/rc.local|grep $INSTALL_DIR"/shell/startup.sh")" ]
+then
+ echo $INSTALL_DIR"/shell/startup.sh" >> /etc/rc.local
+fi
+
+echo ""
+echo "install successed..."
+echo "please use [$INSTALL_DIR/shell/startup.sh] to run the program..."
diff --git a/nmsclient/NC_install/lib/ant.jar b/nmsclient/NC_install/lib/ant.jar
new file mode 100644
index 0000000..0a56a58
--- /dev/null
+++ b/nmsclient/NC_install/lib/ant.jar
Binary files differ
diff --git a/nmsclient/NC_install/lib/commons-beanutils-1.7.jar b/nmsclient/NC_install/lib/commons-beanutils-1.7.jar
new file mode 100644
index 0000000..b1b89c9
--- /dev/null
+++ b/nmsclient/NC_install/lib/commons-beanutils-1.7.jar
Binary files differ
diff --git a/nmsclient/NC_install/lib/commons-collections.jar b/nmsclient/NC_install/lib/commons-collections.jar
new file mode 100644
index 0000000..75580be
--- /dev/null
+++ b/nmsclient/NC_install/lib/commons-collections.jar
Binary files differ
diff --git a/nmsclient/NC_install/lib/commons-io.jar b/nmsclient/NC_install/lib/commons-io.jar
new file mode 100644
index 0000000..7affdef
--- /dev/null
+++ b/nmsclient/NC_install/lib/commons-io.jar
Binary files differ
diff --git a/nmsclient/NC_install/lib/commons-lang.jar b/nmsclient/NC_install/lib/commons-lang.jar
new file mode 100644
index 0000000..b910561
--- /dev/null
+++ b/nmsclient/NC_install/lib/commons-lang.jar
Binary files differ
diff --git a/nmsclient/NC_install/lib/commons-logging.jar b/nmsclient/NC_install/lib/commons-logging.jar
new file mode 100644
index 0000000..8758a96
--- /dev/null
+++ b/nmsclient/NC_install/lib/commons-logging.jar
Binary files differ
diff --git a/nmsclient/NC_install/lib/ezmorph-1.0.4.jar b/nmsclient/NC_install/lib/ezmorph-1.0.4.jar
new file mode 100644
index 0000000..7625af6
--- /dev/null
+++ b/nmsclient/NC_install/lib/ezmorph-1.0.4.jar
Binary files differ
diff --git a/nmsclient/NC_install/lib/fileComment.jar b/nmsclient/NC_install/lib/fileComment.jar
new file mode 100644
index 0000000..8c251d9
--- /dev/null
+++ b/nmsclient/NC_install/lib/fileComment.jar
Binary files differ
diff --git a/nmsclient/NC_install/lib/java-unrar-0.3.jar b/nmsclient/NC_install/lib/java-unrar-0.3.jar
new file mode 100644
index 0000000..48bebc9
--- /dev/null
+++ b/nmsclient/NC_install/lib/java-unrar-0.3.jar
Binary files differ
diff --git a/nmsclient/NC_install/lib/javatar-2.5.jar b/nmsclient/NC_install/lib/javatar-2.5.jar
new file mode 100644
index 0000000..0d4def6
--- /dev/null
+++ b/nmsclient/NC_install/lib/javatar-2.5.jar
Binary files differ
diff --git a/nmsclient/NC_install/lib/json-lib-2.2.2-jdk15.jar b/nmsclient/NC_install/lib/json-lib-2.2.2-jdk15.jar
new file mode 100644
index 0000000..27e7c7c
--- /dev/null
+++ b/nmsclient/NC_install/lib/json-lib-2.2.2-jdk15.jar
Binary files differ
diff --git a/nmsclient/NC_install/lib/junit.jar b/nmsclient/NC_install/lib/junit.jar
new file mode 100644
index 0000000..674d71e
--- /dev/null
+++ b/nmsclient/NC_install/lib/junit.jar
Binary files differ
diff --git a/nmsclient/NC_install/lib/libsigar-amd64-linux.so b/nmsclient/NC_install/lib/libsigar-amd64-linux.so
new file mode 100644
index 0000000..913f325
--- /dev/null
+++ b/nmsclient/NC_install/lib/libsigar-amd64-linux.so
Binary files differ
diff --git a/nmsclient/NC_install/lib/libsigar-x86-linux.so b/nmsclient/NC_install/lib/libsigar-x86-linux.so
new file mode 100644
index 0000000..46df73a
--- /dev/null
+++ b/nmsclient/NC_install/lib/libsigar-x86-linux.so
Binary files differ
diff --git a/nmsclient/NC_install/lib/log4j-1.2.15.jar b/nmsclient/NC_install/lib/log4j-1.2.15.jar
new file mode 100644
index 0000000..c930a6a
--- /dev/null
+++ b/nmsclient/NC_install/lib/log4j-1.2.15.jar
Binary files differ
diff --git a/nmsclient/NC_install/lib/ostermillerutils_1_07_00.jar b/nmsclient/NC_install/lib/ostermillerutils_1_07_00.jar
new file mode 100644
index 0000000..a993150
--- /dev/null
+++ b/nmsclient/NC_install/lib/ostermillerutils_1_07_00.jar
Binary files differ
diff --git a/nmsclient/NC_install/lib/sigar.jar b/nmsclient/NC_install/lib/sigar.jar
new file mode 100644
index 0000000..8fe8400
--- /dev/null
+++ b/nmsclient/NC_install/lib/sigar.jar
Binary files differ
diff --git a/nmsclient/NC_install/shell/bin/cer/client_ks b/nmsclient/NC_install/shell/bin/cer/client_ks
new file mode 100644
index 0000000..79459cc
--- /dev/null
+++ b/nmsclient/NC_install/shell/bin/cer/client_ks
Binary files differ
diff --git a/nmsclient/NC_install/shell/bin/cer/client_ts b/nmsclient/NC_install/shell/bin/cer/client_ts
new file mode 100644
index 0000000..312ecd6
--- /dev/null
+++ b/nmsclient/NC_install/shell/bin/cer/client_ts
Binary files differ
diff --git a/nmsclient/NC_install/shell/check_userpass.sh b/nmsclient/NC_install/shell/check_userpass.sh
new file mode 100644
index 0000000..6e6dc7d
--- /dev/null
+++ b/nmsclient/NC_install/shell/check_userpass.sh
@@ -0,0 +1,47 @@
+#!/usr/bin/expect
+
+if {$argc!=3} {
+ send_user "usage: check_userpass.sh ip name password\n"
+ exit 1
+}
+
+set host [lindex $argv 0]
+set user [lindex $argv 1]
+set pass [lindex $argv 2]
+
+set isSend 0
+spawn ssh -t "${user}@${host}"
+
+while 1 {
+ expect {
+ "* (yes/no)*" {send "yes\r"}
+ "* ����*" {
+ send "${pass}\r"
+ set isSend 1
+ }
+ "* password:*" {
+ send "${pass}\r"
+ set isSend 1
+ }
+ "Permission denied" {
+ send_user "Not allowed\n"
+ exit 1
+ }
+ "*~]" {
+ send_user "OK\n"
+ send "exit\r"
+ exit 0
+ }
+ "Last login:*" {
+ send_user "OK\n"
+ send "exit\r"
+ exit 0
+ }
+ default {
+ send_user "error\n"
+ exit 2
+ }
+ }
+}
+
+
diff --git a/nmsclient/NC_install/shell/execCmdBySu.sh b/nmsclient/NC_install/shell/execCmdBySu.sh
new file mode 100644
index 0000000..4a94436
--- /dev/null
+++ b/nmsclient/NC_install/shell/execCmdBySu.sh
@@ -0,0 +1,78 @@
+#!/usr/bin/expect
+
+if {$argc!=4&&$argc!=3} {
+ send_user "usage: execCmdBySu.sh resultFlag command name \[password\]\n"
+ exit 1
+}
+# 0��ִ�����ȡ�ý����1��ִ��&��̨����
+set resultFlag [lindex $argv 0]
+set cmd [lindex $argv 1]
+set user [lindex $argv 2]
+set pass [lindex $argv 3]
+
+set timeout 30
+set flag 0
+
+#�رտ���̨�����Ϣ
+log_user 0
+
+spawn whoami
+expect "root" {set flag 1}
+
+# ��ִ������${cmd}��׷��"echo $?",Ϊ��ȡcmd�������е�ʵ�ʽ��, �����ε���������ص������Ϣ
+if {$resultFlag==0} {
+ spawn su - -c "${cmd};echo $?" ${user}
+
+ #��ǰ��¼�û�����root����������
+ if {$flag==0} {
+ expect {
+ "����*" {send ${pass}\r}
+ "password*" {send ${pass}\r}
+ default {
+ send_error "error\n"
+ exit 2
+ }
+ }
+ }
+
+ #�򿪿���̨�����Ϣ
+ log_user 1
+
+ expect {
+ "* ���벻��ȷ*" {exit 1}
+ #----�˴���Ŀ����Ϊ���ܶ�ȡ������������
+ eof {exit 0}
+ }
+
+} else {
+ spawn su - -c "${cmd}" ${user}
+
+ #��ǰ��¼�û�����root����������
+ if {$flag==0} {
+ expect {
+ "����*" {send ${pass}\r}
+ "password*" {send ${pass}\r}
+ default {
+ send_error "error\n"
+ exit 2
+ }
+ }
+ }
+ expect {
+ "* ���벻��ȷ*" {exit 1}
+ #----Ϊ��&��̨������������������
+ eof {
+ send_user "ok\n"
+ exit 0
+ }
+ }
+}
+interact
+exit 0
+
+
+#overlay chess
+#overlay program args
+#disconnect
+#close -onexec 0 -i ${spawn_id}
+#remove_nulls 1 \ No newline at end of file
diff --git a/nmsclient/NC_install/shell/nmsagent.sh b/nmsclient/NC_install/shell/nmsagent.sh
new file mode 100644
index 0000000..5223fe2
--- /dev/null
+++ b/nmsclient/NC_install/shell/nmsagent.sh
@@ -0,0 +1,270 @@
+#!/bin/sh
+
+# -----------------------------------------------------------------------------
+# Start/Stop Script for the NMS Client
+#
+# Environment Variable Prequisites
+#
+# NMSCLEINT_HOME May point at your Catalina "build" directory.
+#
+# NMSCLIENT_TASKDIR (Optional) Directory path location of taskresult directory
+# Defaults to %NMSCLIENT_HOME%/task.
+#
+# NMSCLIENT_TMPDIR (Optional) Directory path location of temporary directory
+# the JVM should use (java.io.tmpdir). Defaults to
+# $NMSCLIENT_HOME/temp.
+#
+# JAVA_HOME Must point at your Java Development Kit installation.
+# Required to run the with the "debug" argument.
+#
+# -----------------------------------------------------------------------------
+# resolve links - $0 may be a softlink
+PRG="$0"
+
+if [ -f /etc/redhat-release ]; then
+ OS_TYPE=`cat /etc/redhat-release`
+else
+ islsb=`which lsb_release | wc -l`
+ if [ "$islsb" != "0" ]; then
+ OS_TYPE=$( lsb_release -d| cut -d: -f2| cut -f2 )
+ else
+ OS_TYPE=`uname -a | awk '{print $1" "$2" "$3}'`
+ fi
+fi
+echo $OS_TYPE
+
+while [ -h "$PRG" ]; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`/"$link"
+ fi
+done
+
+# Get standard environment variables
+PRGDIR=`dirname "$PRG"`
+
+# Only set NMSCLEINT_HOME if not already set
+[ -z "$NMSCLEINT_HOME" ] && NMSCLEINT_HOME=`cd "$PRGDIR/.." ; pwd`
+cd "$NMSCLEINT_HOME"/shell
+
+if [ -z "$NMSCLIENT_TMPDIR" ] ; then
+ NMSCLIENT_TMPDIR="$NMSCLEINT_HOME"/temp
+fi
+if [ ! -d $NMSCLIENT_TMPDIR ]
+ then
+ mkdir $NMSCLIENT_TMPDIR
+fi
+
+if [ -n "$4" ]; then
+ NMSCLIENT_TASKDIR=`dirname "$4"`
+fi
+if [ -z "$NMSCLIENT_TASKDIR" ] ; then
+ NMSCLIENT_TASKDIR="$NMSCLEINT_HOME"/task
+fi
+
+
+# -------- check jdk
+# check nmsjdk
+NMS_HOME=`cd "$NMSCLEINT_HOME/.." ; pwd`
+cd "$NMSCLEINT_HOME"/shell
+NMS_JDK="$NMS_HOME"/nmsjdk
+if [ ! -e "$NMS_JDK" ]
+ then
+ echo "$NMS_JDK not exist"
+ exit 0
+fi
+# check java -version
+javaversion=`$NMS_JDK/bin/java -version 2>&1|grep "java version"`
+if [ ! -n "$javaversion" ]
+ then
+ echo "$NMS_JDK cannot use, please install"
+ exit 0
+fi
+
+# -------- set jdk path
+export JAVA_HOME=$NMS_JDK
+export CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
+export PATH=$JAVA_HOME/bin:$PATH
+
+temp=$CLASSPATH
+#setting libs path
+libs="$NMSCLEINT_HOME"/lib/*
+append(){
+ temp=$temp":"$1
+}
+for file in $libs; do
+ append $file
+done
+jars="$NMSCLEINT_HOME"/bin/*
+for file in $jars; do
+ append $file
+done
+export NC_CLASSPATH=$temp:.:$NMSCLEINT_HOME/conf
+export LD_LIBRARY_PATH=$NMSCLEINT_HOME/lib
+export LANG=zh_CN.UTF-8
+
+# Bugzilla 37848: When no TTY is available, don't output to console
+have_tty=0
+if [ "`tty`" != "not a tty" ]; then
+ have_tty=1
+fi
+
+# ----- Execute The Requested Command -----------------------------------------
+
+# Bugzilla 37848: only output this if we have a TTY
+if [ $have_tty -eq 1 ]; then
+ echo "Using NMSCLEINT_HOME: $NMSCLEINT_HOME"
+ echo "Using NMSCLIENT_TMPDIR: $NMSCLIENT_TMPDIR"
+ echo "Using JAVA_HOME: $JAVA_HOME"
+ echo "Using CLASSPATH: $NC_CLASSPATH"
+fi
+
+# ---- get jvm param
+jvmconf_file=$NMSCLEINT_HOME"/conf/jvm.conf"
+if [ -f $jvmconf_file ]
+ then
+ #sed -n '/Xmx=/p' $jvmconf_file | sed 's/Xmx=//g'
+ XmsOpt=`sed -n '/-Xms/p' $jvmconf_file`
+ XmxOpt=`sed -n '/-Xmx/p' $jvmconf_file`
+ JAVA_OPTS="$XmsOpt $XmxOpt -XX:+UseParNewGC"
+else
+ JAVA_OPTS="-Xms64m -Xmx128m -XX:+UseParNewGC"
+fi
+
+program="com.nis.nmsclient.NmsClient a"
+name="NmsClient-nc"
+
+proc_id=
+
+# handler agent upgrade result
+handleTask()
+{
+ if [ -d "$NMSCLIENT_TASKDIR" ]
+ then
+ cd $NMSCLIENT_TASKDIR
+ for i in *.upgrade;do mv "$i" "${i%.upgrade}.result";done >/dev/null 2>&1
+ cd "$NMSCLEINT_HOME"/shell
+ fi
+}
+writePid()
+{
+ ps aux|grep java|grep "$program"|grep -v grep|awk '{print $2}' > $NMSCLIENT_TMPDIR/agentPid.temp
+}
+getPid()
+{
+ unset proc_id
+ proc_id=`ps aux|grep java|grep "$program"|grep -v grep|awk '{print $2}'`
+}
+shouhu_proc="$NMSCLEINT_HOME"/shell/nmsclient_shouhu.sh
+stopShouhuProc()
+{
+ shouhu_proc_id=`ps aux|grep $shouhu_proc|grep -v grep|awk '{print $2}'`
+ if [ -n "$shouhu_proc_id" ]
+ then
+ echo "kill shouhu process ....."
+ kill -9 $shouhu_proc_id
+ fi
+}
+startShouhuProc()
+{
+ shouhu_proc_id=`ps aux|grep $shouhu_proc|grep -v grep|awk '{print $2}'`
+ if [ ! -n "$shouhu_proc_id" ]
+ then
+ echo "start shouhu process ....."
+ nohup $shouhu_proc $NMSCLIENT_TASKDIR >/dev/null &
+ fi
+}
+if [ "$1" = "start" ] ; then
+ getPid
+ if [ -n "$proc_id" ]
+ then
+ echo "$name already running......"
+ else
+ nohup java $JAVA_OPTS -classpath $NC_CLASSPATH $program >/dev/null &
+ sleep 3
+ getPid
+ if [ -n "$proc_id" ]
+ then
+ echo "$name start success!!!!!"
+ writePid
+ else
+ echo "$name start error!!!!!"
+ fi
+ handleTask
+ fi
+elif [ "$1" = "stop" ]; then
+ getPid
+ if [ -n "$proc_id" ]
+ then
+ stopShouhuProc
+ sleep 1
+ echo "$name is start, now kill......"
+ kill -9 $proc_id
+ writePid
+ echo "$name kill ok !!!!!!!!!!!!!"
+ else
+ echo "$name is not start!!!!!!!!!!!"
+ fi
+elif [ "$1" = "restart" ] ; then
+ getPid
+ if [ -n "$proc_id" ]
+ then
+ echo "$name is start, now restart......"
+ stopShouhuProc
+ sleep 1
+ startShouhuProc
+ kill -9 $proc_id
+ getPid
+ if [ -n "$proc_id" ]
+ then
+ echo "$name stop error!!!!!!!!!!"
+ handleTask
+ exit 1
+ fi
+ else
+ echo "$name is not start, now start......"
+ fi
+ copyError=
+ if [ -n "$2" ] ; then
+ srcFile=$2
+ updateFile=/dev/null
+ if [ -d "$2" ]; then
+ srcFile="$2"/*
+ fi
+ if [ -n "$4" ]; then
+ updateFile=$4
+ fi
+ if [ -n "$3" ]; then
+ unalias cp >/dev/null 2>&1
+ cp -rvf $srcFile $3 >>$updateFile 2>&1 ||copyError=1
+ fi
+ rm -rf $2 >/dev/null 2>&1
+ fi
+ if [ -n "$copyError" ]
+ then
+ #----copy error
+ handleTask
+ else
+ #--------copy right, start proc
+ nohup java $JAVA_OPTS -classpath $NC_CLASSPATH $program >/dev/null &
+ sleep 3
+ getPid
+ if [ -n "$proc_id" ]
+ then
+ writePid
+ else
+ echo "$name restart error!!!!!!!!!!"
+ handleTask
+ fi
+ fi
+
+else
+ echo "Usage: nmsagent.sh ( commands ... )"
+ echo "commands:"
+ echo " start Start $name in a separate window"
+ echo " restart ReStart $name in a separate window"
+ echo " stop Stop $name"
+fi
diff --git a/nmsclient/NC_install/shell/nmsclient_shouhu.sh b/nmsclient/NC_install/shell/nmsclient_shouhu.sh
new file mode 100644
index 0000000..821884f
--- /dev/null
+++ b/nmsclient/NC_install/shell/nmsclient_shouhu.sh
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+# resolve links - $0 may be a softlink
+PRG="$0"
+
+while [ -h "$PRG" ]; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`/"$link"
+ fi
+done
+
+# Get standard environment variables
+PRGDIR=`dirname "$PRG"`
+
+# Only set NMSCLEINT_HOME if not already set
+[ -z "$NMSCLEINT_HOME" ] && NMSCLEINT_HOME=`cd "$PRGDIR/.." ; pwd`
+cd "$NMSCLEINT_HOME"/shell
+
+NC_TASKDIR="$1"
+log_file="$NMSCLEINT_HOME"/temp/job.log
+echo "NC_TASKDIR:$NC_TASKDIR" >> $log_file
+
+#count=1
+while [ 1 -eq 1 ]
+do
+ sleep 50
+ if [ `ps -ef | grep NmsClient | grep -v grep | wc -l` -lt 1 ]
+ then
+ echo -n "Down at:" >> $log_file
+ date >> $log_file
+ # ---------- handler agent upgrade result
+ if [ -d "$NC_TASKDIR" ]
+ then
+ cd $NC_TASKDIR
+ for i in *.upgrade;do mv "$i" "${i%.upgrade}.result";done >>$log_file 2>&1
+ cd "$NMSCLEINT_HOME"/shell
+ fi
+ # --------- start NC
+ "$NMSCLEINT_HOME"/shell/startup.sh
+ echo "NmsClient start...." >>$log_file
+ fi
+ sleep 1
+ #count=$count+1
+
+ #if [ count -eq 900 ]
+ #then
+ # jpid=`ps -ef | grep java | grep -v grep | cut -c0-5`
+ # kill -9 $jpid
+ # count=1
+ #fi
+done \ No newline at end of file
diff --git a/nmsclient/NC_install/shell/restart.sh b/nmsclient/NC_install/shell/restart.sh
new file mode 100644
index 0000000..f3c288d
--- /dev/null
+++ b/nmsclient/NC_install/shell/restart.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# -----------------------------------------------------------------------------
+# Retart Script for the NMS Client
+#
+# -----------------------------------------------------------------------------
+
+# resolve links - $0 may be a softlink
+PRG="$0"
+
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`/"$link"
+ fi
+done
+
+PRGDIR=`dirname "$PRG"`
+EXECUTABLE=nmsagent.sh
+
+if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
+ echo "Cannot find $PRGDIR/$EXECUTABLE"
+ echo "This file is needed to run this program"
+ exit 1
+fi
+
+exec "$PRGDIR"/"$EXECUTABLE" restart $1 $2 $3 "$@" \ No newline at end of file
diff --git a/nmsclient/NC_install/shell/shutdown.sh b/nmsclient/NC_install/shell/shutdown.sh
new file mode 100644
index 0000000..bc5ecc9
--- /dev/null
+++ b/nmsclient/NC_install/shell/shutdown.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# -----------------------------------------------------------------------------
+# Stop Script for the NMS Client
+#
+# -----------------------------------------------------------------------------
+
+# resolve links - $0 may be a softlink
+PRG="$0"
+
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`/"$link"
+ fi
+done
+
+PRGDIR=`dirname "$PRG"`
+EXECUTABLE=nmsagent.sh
+
+if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
+ echo "Cannot find $PRGDIR/$EXECUTABLE"
+ echo "This file is needed to run this program"
+ exit 1
+fi
+
+exec "$PRGDIR"/"$EXECUTABLE" stop "$@" \ No newline at end of file
diff --git a/nmsclient/NC_install/shell/startup.sh b/nmsclient/NC_install/shell/startup.sh
new file mode 100644
index 0000000..a28c64a
--- /dev/null
+++ b/nmsclient/NC_install/shell/startup.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+# -----------------------------------------------------------------------------
+# Start Script for the NMS Client
+#
+# -----------------------------------------------------------------------------
+
+# resolve links - $0 may be a softlink
+PRG="$0"
+
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`/"$link"
+ fi
+done
+
+PRGDIR=`dirname "$PRG"`
+EXECUTABLE=nmsagent.sh
+
+if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then
+ echo "Cannot find $PRGDIR/$EXECUTABLE"
+ echo "This file is needed to run this program"
+ exit 1
+fi
+
+exec "$PRGDIR"/"$EXECUTABLE" start "$@" \ No newline at end of file
diff --git a/nmsclient/dklog.sh b/nmsclient/dklog.sh
new file mode 100644
index 0000000..ceb5cea
--- /dev/null
+++ b/nmsclient/dklog.sh
@@ -0,0 +1,83 @@
+#!/bin/bash
+base_dir="/home/ceiec/nms/nmsclient"
+conf=$base_dir"/conf/process.list"
+temp_dir=$base_dir"/temp"
+temp_filelist=$temp_dir"/dkfindfile.list"
+myselfpid=$temp_dir"/dklogrep.pid"
+
+diconf_dir="/home/ceiec/nms/nmsdata/nc_config"
+#diconf_file=$diconf_dir"/checktype100017_detection100103.cfg"
+diconf_file=`echo $0 | awk -F '/' '{print $NF}' | awk -F '.' '{print $1}' `
+diconf_file=$diconf_dir"/"$diconf_file".cfg"
+
+echo `date` $diconf_file >> /home/ceiec/nms/nmsclient/nc_logs/ttt.log
+
+cXlog_dir="/home/ict/log_dir/dpkt"
+findmaxdep=2
+
+monitorstart=`stat $diconf_file | grep Modify | awk '{print $2" "$3}'`
+mstimestamp=`date -d "$monitorstart" +%s%N`
+remstimestamp=$((mstimestamp/1000000))
+
+clogmaxsize=1024
+
+mypid=$$
+echo $$ > $myselfpid
+
+#echo $conf
+didata_dir=`cat $diconf_file | grep dataFileDir | cut -d = -f 2`
+ditemp_dir=`cat $diconf_file | grep tempDataFileDir | cut -d = -f 2`
+checkGap=`cat $diconf_file | grep checkGap | cut -d = -f 2`
+sleeptime=$((checkGap*60))
+dataFileDir=`cat $diconf_file | grep dataFileDir | cut -d = -f 2`
+pubInfo=`cat $diconf_file | grep pubInfo | cut -d = -f 2`
+
+pdate=`date +'%Y%m%d%H%M%S'`
+stat_file=$temp_dir"/$pdate"".rep"
+incoming_file=$temp_dir"/$pdate"".csv"
+temp_file=$temp_dir"/$pdate"".tmp"
+
+timeStamp=`date +%s%N`
+currentTimeStamp=$((timeStamp/1000000))
+later15mTimeStamp=$((currentTimeStamp+checkGap*60*1000))
+
+linenum=0
+
+ find $cXlog_dir -maxdepth $findmaxdep -mmin -$checkGap -name "*info_log*" > $temp_filelist
+ #find $cXlog_dir -maxdepth $findmaxdep -mmin -$sleeptime -name "*cc_send*" > $temp_filelist
+
+ while read pline
+ do
+ if [ -n $pline ]; then
+ filesize=`ls -l $pline | awk '{ print $5 }'`
+ echo filesize=$filesize
+ if [ $filesize -gt $clogmaxsize ]; then
+ echo -e "$pline,,The log file is bigger than 1M. Please check it on server," >> $stat_file
+ linenum=$((linenum+1))
+ else
+ while read logline
+ do
+ retime=`echo $logline | awk '{print $1" "$2}'`
+ #c3ip=`echo $logline | awk '{print $3}'`
+ #gdevip=`echo $logline | awk '{print $4}'`
+ repcontent=`echo $logline | awk '{for (i=3 ;i<=NF;i++) printf $i " | "; printf "\n" }'`
+
+ linenum=$((linenum+1))
+ echo -e "$pline,$retime,$repcontent," >> $stat_file
+ done < $pline
+ fi
+ fi
+ done < $temp_filelist
+
+ echo "$pubInfo,$remstimestamp,0,$currentTimeStamp,1,$later15mTimeStamp,1,OK,OK" > $temp_file
+ if [ -f $stat_file ]; then
+ linenum=`cat $stat_file | wc -l`
+ echo "details,$linenum" >> $temp_file
+ cat $stat_file >> $temp_file
+ else
+ echo "details,1" >> $temp_file
+ echo -e "$pline,,No info log this $checkGap minites," >> $temp_file
+ fi
+ mv $temp_file $ditemp_dir
+# rm -rf $stat_file
+
diff --git a/nmsclient/nmsclient批量安装说明文档.doc b/nmsclient/nmsclient批量安装说明文档.doc
new file mode 100644
index 0000000..5d3ee5d
--- /dev/null
+++ b/nmsclient/nmsclient批量安装说明文档.doc
Binary files differ
diff --git a/nmsclient/process.sh b/nmsclient/process.sh
new file mode 100644
index 0000000..80ebe96
--- /dev/null
+++ b/nmsclient/process.sh
@@ -0,0 +1,267 @@
+#!/bin/bash
+#if [ $# -eq 1 ]; then
+# diconf_file=$1
+#else
+# echo "Missing monitor-config-file info!"
+# exit 1
+#fi
+
+
+echo `date` >> /home/ceiec/nms/nmsclient/nc_logs/ttt.log
+
+
+base_dir="/home/ceiec/nms/nmsclient"
+conf=$base_dir"/conf/process.list"
+pid_dir=$base_dir"/temp"
+myselfpid=$pid_dir"/pidcheck.pid"
+
+
+diconf_dir="/home/ceiec/nms/nmsdata/nc_config"
+diconf_file=`echo $0 | awk -F '/' '{print $NF}' | awk -F '.' '{print $1}' `
+file_name=$diconf_file
+diconf_file=$diconf_dir"/"$diconf_file".cfg"
+
+clog_conf=$base_dir"/conf/clog.list"
+
+monitorstart=`stat $diconf_file | grep Modify | awk '{print $2" "$3}'`
+mstimestamp=`date -d "$monitorstart" +%s%N`
+remstimestamp=$((mstimestamp/1000000))
+pubInfo=`cat $diconf_file | grep pubInfo | cut -d = -f 2`
+
+mypid=$$
+echo $$ > $myselfpid
+
+#echo $conf
+pdate=`date +'%Y%m%d%H%M%S'`
+stat_file=$pid_dir"/$pdate"".rep"
+incoming_file=$pid_dir"/$pdate"".csv"
+temp_file=$pid_dir"/$pdate"".tmp"
+
+timeStamp=`date +%s%N`
+currentTimeStamp=$((timeStamp/1000000))
+later15mTimeStamp=$((currentTimeStamp+checkGap*60*1000))
+
+didata_dir=`cat $diconf_file | grep dataFileDir | cut -d = -f 2`
+ditemp_dir=`cat $diconf_file | grep tempDataFileDir | cut -d = -f 2`
+checkGap=`cat $diconf_file | grep checkGap | cut -d = -f 2`
+dataFileDir=`cat $diconf_file | grep dataFileDir | cut -d = -f 2`
+
+interstatus=""
+perstatus=""
+
+linenum=0
+ while read pline
+ do
+ if [ -n "$pline" ]; then
+# echo line=$pline
+ num=0
+ isclog=0
+ firstc=`echo $pline | cut -c 1`
+ if [ "$firstc" != "#" ]; then
+ module=`echo $pline | cut -d = -f 1`
+ keyword=`echo $pline | cut -d = -f 2`
+# echo $module $keyword
+ clog_dir=`cat $clog_conf | grep -v "#" | grep $module | cut -d = -f 2 | cut -d , -f 1`
+ clog_name=`cat $clog_conf | grep -v "#" | grep $module | cut -d = -f 2 | cut -d , -f 2`
+# echo $module : $clog_dir , $clog_name
+
+ case $module in
+ "processcheck")
+ prostatus=`ps u -P "$mypid" | grep -v grep | grep -v vim | grep -v USER`;
+ num=`ps u -P "$mypid" | grep -v grep | grep -v vim | grep -v USER | wc -l`;
+ ;;
+ "nmsweb")
+ prostatus=`ps aux | grep -E "$keyword" | grep "nms" | grep -v grep | grep -v galaxy`;
+ num=`ps aux | grep -E "$keyword" | grep "nms" | grep -v grep | grep -v galaxy | wc -l`;
+ ;;
+ "nmsdc")
+ prostatus=`ps aux | grep -E "$keyword" | grep -v grep`;
+ num=`ps aux | grep -E "$keyword" | grep -v grep | wc -l`;
+ ;;
+ "nmsclient")
+ prostatus=`ps aux | grep -E "$keyword" | grep -v shouhu | grep -v grep`;
+ num=`ps aux | grep -E "$keyword" | grep -v shouhu | grep -v grep | wc -l`;
+ ;;
+ "ntcsweb")
+ prostatus=`ps aux | grep -E "$keyword" | grep -v grep | grep -v galaxy | grep -v nms`;
+ num=`ps aux | grep -E "$keyword" | grep -v grep | grep -v galaxy | grep -v nms | wc -l`;
+ ;;
+ "mariadb")
+ prostatus=`ps aux | grep -E "$keyword" | grep -v grep | grep -v safe`;
+ num=`ps aux | grep -E "$keyword" | grep -v grep | grep -v safe | wc -l`;
+ ;;
+ "galaxyService"|"galaxyFsync"|"galaxyPush"|"galaxyStat"|"galaxyTest"|"logComplete"|"logStat"|"logTopIP"|"logTopN"|"logUV")
+ prostatus=`ps aux | grep -E "$keyword" | grep -v grep | grep -v Daemon`;
+ num=`ps aux | grep -E "$keyword" | grep -v grep | grep -v Daemon | wc -l`;
+ ;;
+ "pzffff"|"pzffhj"|"paffkeep")
+ prostatus=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh`;
+ num=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh | wc -l`;
+ ;;
+ "dkAppBehavior"|"dkAppSSL"|"dkHdLdp"|"dkHdNtba"|"dkHdStrategy"|"dkQx"|"dkLogProcess")
+ prostatus=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh`;
+ num=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh | wc -l`;
+ ;;
+ "Tensor"|"Redis"|"panguValve")
+ prostatus=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh`;
+ num=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh | wc -l`;
+ ;;
+ "redis")
+ prostatus=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh`;
+ num=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh | wc -l`;
+ ;;
+ "mrzcpd"|"Sapp"|"Oam")
+ prostatus=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh`;
+ num=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh | wc -l`;
+ ;;
+ "maskey2.0")
+ prostatus=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh`;
+ num=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh | wc -l`;
+ ;;
+ "rssbMaskey"|"fragIndexCluster"|"castleBlack"|"eastwatch"|"platformvideo"|"platformaudio"|"platformimage"|"platformvoip")
+ prostatus=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh`;
+ num=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh | wc -l`;
+ ;;
+ "avanalyser"|"pic"|"voip"|"audio"|"video"|"fragcheck"|"blacklist")
+ prostatus=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh`;
+ num=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh | wc -l`;
+ ;;
+ "dkLdp"|"dkZeusLogclct"|"dkSappClean"|"dkZeusNtbapre"|"dkSappNtba")
+ prostatus=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh`;
+ num=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh | wc -l`;
+ ;;
+ "zookeeper"|"Kafka"|"Strom"|"clickhouse"|"Hades")
+ prostatus=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh`;
+ num=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh | wc -l`;
+ ;;
+ "consul"|"telegraf"|"infludb"|"Grafana")
+ prostatus=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh`;
+ num=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh | wc -l`;
+ ;;
+ "mrzcpd"|"Sapp"|"Torches")
+ prostatus=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh`;
+ num=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh | wc -l`;
+ ;;
+ "irAccess"|"irFoward")
+ prostatus=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh`;
+ num=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh | wc -l`;
+ ;;
+ "IPDiscovery")
+ prostatus=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh`;
+ num=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh | wc -l`;
+ ;;
+ "Tfe"|"kni")
+ prostatus=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh`;
+ num=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh | wc -l`;
+ ;;
+ "Minio"|"minioEventsPretreat"|"minioDeteteClient")
+ prostatus=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh`;
+ num=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh | wc -l`;
+ ;;
+ "certStore")
+ prostatus=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh`;
+ num=`ps aux | grep -E "$keyword" | grep -v grep | grep -v sh | wc -l`;
+ ;;
+ *)
+ ;;
+ esac
+ pidfile=$pid_dir"/"$module".pid";
+# echo HERE num=$num
+# echo $prostatus
+# echo "HERE? "
+ if [ $num = 1 ]; then
+ pid=`echo $prostatus | awk '{print $2}'` ;
+ echo $pid > $pidfile
+ pstatistics=`ps -eo pid,stat,priority,pcpu,pmem,lstart | grep $pid`
+ #pcpu=`echo $pstatistics | awk '{print $4}'`
+ pcpu=`top -c -b -p $pid -n 1 | tail -1 | grep $pid | awk '{print $9}'`
+ pmem=`echo $pstatistics | awk '{print $5}'`
+ prostatus=`echo $pstatistics | awk '{print $2}'`
+ propri=`echo $pstatistics | awk '{print $3}'`
+ lstart=`echo $pstatistics | awk '{for (i=6 ;i<=NF;i++) printf $i " "; printf "\n" }'`
+ linenum=$((linenum+1))
+# echo $module $clog_dir $clog_name
+ if [ -n "$clog_dir" ]; then
+ if [ -n "$clog_name" ]; then
+ if [ -d $clog_dir ]; then
+# echo have filename $clog_dir $clog_name
+ case $module in
+ "pzffff")
+ if [ "$clog_name" = "cc_recv" ]; then
+ isclog=`find $clog_dir -maxdepth 3 -mmin -$checkGap -name "$clog_name*" | wc -l`
+ if [ "$isclog" = "0" ]; then
+ isclog="--!!! $clog_name LOG FILES MISSED IN $checkGap MINUTE ! PLEASE CHECK ON SERVER!!!--"
+ interstatus=$interstatus"Bad finding on $module $clog_name behavior. | "
+ else
+ isclog="OK"
+ fi
+ fi
+ ;;
+ "pzffhj")
+ isclog=`find $clog_dir -maxdepth 3 -mmin -$checkGap -name "$clog_name*" | wc -l`
+ if [ "$isclog" = "0" ]; then
+ isclog="OK"
+ else
+ isclog="--!!! $module $clog_name IN $checkGap MINUTE ! PLEASE CHECK ON SERVER!!!--"
+ interstatus=$interstatus"Bad finding on $module $clog_name behavior. | "
+ fi
+ ;;
+ "pzffkeep")
+ isclog="null"
+ ;;
+ *)
+ isclog=`find $clog_dir -mmin -$checkGap -name "$clog_name*" | wc -l`
+ if [ $isclog -gt 0 ]; then
+ interstatus=$interstatus"Bad finding on $module $clog_name behavior. | "
+ fi
+ isclog="$isclog critical log files are modified in $checkGap minutes."
+ ;;
+ esac
+ else
+# echo $module log not found
+ isclog="Log path not found: $clog_dir"
+ interstatus=$interstatus"Log path wrong. | "
+ fi
+ else
+ if [ -d $clog_dir ]; then
+# echo no filename $clog_dir
+ isclog=`find $clog_dir -maxdepth 1 -mmin -$checkGap | wc -l`
+ isclog="$isclog critical log files are modified in $checkGap minutes."
+ fi
+ fi
+ else
+ isclog="null"
+ fi
+ echo -e "$module,$pid,$pcpu,$pmem,$prostatus,$propri,$lstart,$isclog," >> $stat_file
+ else
+ if [ "$module" = "pzffc2res" ]; then
+ isclog=`find $clog_dir -mmin -$checkGap -name "$clog_name*" | wc -l`
+ if [ $isclog -gt 0 ]; then
+ pzffffline=`grep pzffff $stat_file`
+ if [ -n "$pzffffline" ]; then
+ sed -i '/pzffff/d' $stat_file
+ echo $pzffffline" | RESTART log is modified in $checkGap minites." >> $stat_file
+ fi
+ fi
+ else
+ pid=""; pstatistics="--"; pcpu=""; pmem=""; prostatus="NotFound"; propri=""; lstart=""; linenum=$((linenum+1));
+ isclog="null"
+ interstatus=$interstatus"$module miss something this interval. | "
+ echo -e "$module,$pid,$pcpu,$pmem,$prostatus,$propri,$lstart,$isclog," >> $stat_file
+ if [ -f $pidfile ]; then
+ rm $pidfile
+ fi
+ fi
+ fi
+ fi
+ fi
+ done < $conf
+# echo "$pubInfo,$remstimestamp,0,$currentTimeStamp,1,$later15mTimeStamp,1,\"$interstatus\",\"$perstatus\"" > $incoming_file
+# echo "details,$linenum" >> $incoming_file
+# cat $stat_file >> $incoming_file
+
+ echo "0,1,\"$interstatus\"" > $temp_file
+ echo "details,$linenum" >> $temp_file
+ cat $stat_file >> $temp_file
+ mv $temp_file $ditemp_dir
+ rm -rf $stat_file