Version 1.8.1, 1)修改BUG:ping_gw函数当PING失败时没有尝试对余下的GW进行PING操作; 2)增加环境变量SYS_NIC_DEBUG用于调试流量抖动问题。

git-svn-id: http://172.17.0.253/svn/soft_pkgs/sys_nicmonitor@1400 09c3743a-b0dd-45d3-b506-aa74c7a2a6ef
This commit is contained in:
rbqiu
2013-06-25 08:22:43 +00:00
parent b374395e85
commit af5b85babe
11 changed files with 92 additions and 13 deletions

View File

@@ -1,3 +1,31 @@
=========
编译说明:
在Rocky 4.2上编译
执行: sh build.sh
将在当前的目录下生成安装包:
sys_nicmonitor#1.8.1-x86_64-Linx-Rocky4.2.pkg.tar.gz
========
安装说明:
1)安装以root的用户执行安装命令
pkgadd sys_nicmonitor#1.8.1-x86_64-Linx-Rocky4.2.pkg.tar.gz
如果之前已经安装,则可先卸载旧的然后再安装,或者通过更新方式安装
卸载命令: pkgrm sys_nicmonitor
更新方式安装命令:
pkgadd u sys_nicmonitor#1.8.1-x86_64-Linx-Rocky4.2.pkg.tar.gz
2查看安装是否成功
pkginfo -i|grep sys_nicmonitor
或者
查看d5000用户的目录下lib/libnic_shm.so和bin/sys_nicmonitor的日期是否
=======
版本说明:
--V1.8.1--
2013-06-05
1)修改BUGping_gw函数当PING失败时没有尝试对余下的GW进行PING操作
2)增加环境变量SYS_NIC_DEBUG用于调试流量抖动问题。
--V1.8 --
20130527
对系统高磁盘IO情况下应用如果进行IO将可能会被阻塞。本版本为此作出调整。
@@ -19,6 +47,8 @@ cs-fes1上编译测试OK。
3) record_log函数为日志函数每次写一次都重新打开一次文件。
修改为线程模式当记录日志时不会被磁盘IO阻塞。
4) 安装目录为d5000用户的HOME目录下的lib和bin目录
----

View File

@@ -6,11 +6,11 @@ sh ./install.sh
或者采用如下步骤:
1)安装以root的用户执行安装命令
pkgadd sys_nicmonitor#1.8-x86_64-Linx-Rocky4.2.pkg.tar.gz
pkgadd sys_nicmonitor#1.8.1-x86_64-Linx-Rocky4.2.pkg.tar.gz
如果之前已经安装,则可先卸载旧的然后再安装,或者通过更新方式安装
卸载命令: pkgrm sys_nicmonitor
更新方式安装命令:
pkgadd u sys_nicmonitor#1.8-x86_64-Linx-Rocky4.2.pkg.tar.gz
pkgadd u sys_nicmonitor#1.8.1-x86_64-Linx-Rocky4.2.pkg.tar.gz
2查看安装是否成功
pkginfo -i|grep sys_nicmonitor

View File

@@ -1,4 +1,5 @@
#!/bin/bash
pkgrm sys_nicmonitor
pkgadd sys_nicmonitor#1.8-x86_64-Linx-Rocky4.2.pkg.tar.gz
pkgadd sys_nicmonitor#1.8.1-x86_64-Linx-Rocky4.2.pkg.tar.gz
pkginfo -i | grep nic

View File

@@ -5,9 +5,13 @@
# Depends on: libart_lgpl libcgi libgd pango python tcl intltool
name=sys_nicmonitor
version=1.8
version=1.8.1
release=x86_64-Linx-Rocky4.2
source=/home/d5000/d5000/linx/1.8/$name-$version.tar.gz
workdir=`pwd`
#source=/home/d5000/d5000/linx/1.8/$name-$version.tar.gz
#source=/mnt/rbqiu/nanri/sys_nicmonitor/0605/1.8/src/$name-$version.tar.gz
echo $workdir
source=$workdir/$name-$version.tar.gz
build() {
cd $name-$version

View File

@@ -20,7 +20,7 @@
#define IPLEN 16
#define CONF_FILE "/conf/nic/sys_netcard_conf.txt"
#define MNIC_VERSION "1.8"
#define MNIC_VERSION "1.8.1"
#define NIC_UNKNOWN 0
#define NIC_DOWN 1
@@ -153,6 +153,10 @@ static const configoption_t options[] = {
{myconf[15], ARG_INT, cb_int, NULL, CTX_ALL},
LAST_OPTION
};
/* 1 for output more debug information, from getenv(SYS_NIC_DEBUG) */
static int sys_nic_debug = 0;
/****dotconf****/
void create_dir(char *create_path);
@@ -674,9 +678,15 @@ static void *cacu_flow(void *p)
count_t = 1;
}
summit = (unsigned int)(curr->info.average_flow*8*100/1024/1024/ptr->mem.conf->flow_peak/count_t);
#if 0
printf("%s:\tcount=%d\tsummit=%d\tflow_limit:%d\taverage_flow:%d\n", curr->info.charname, count_t, summit, conf.flow_limit, curr->info.average_flow);
if( sys_nic_debug ) {
#if 1
printf("%s:\tcount=%d\tsummit=%d\tflow_limit:%d\taverage_flow:%lld\n", curr->info.charname, count_t, summit, conf.flow_limit, curr->info.average_flow);
#endif
snprintf(error_str, sizeof(error_str), "%s:\tcount=%d\tsummit=%d\tflow_limit:%d\taverage_flow:%lld\n", curr->info.charname, count_t, summit, conf.flow_limit, curr->info.average_flow);
record_log(error_str);
}
if(summit >= ptr->mem.conf->flow_limit){
memset(ptr->env.Malarm.tSysNetcardAlarm.fault_devname, 0, NIC_NAME_LEN);
strncpy(ptr->env.Malarm.tSysNetcardAlarm.fault_devname, ptr->env.host_name, ptr->env.host_name_size);
@@ -695,8 +705,13 @@ static void *cacu_flow(void *p)
count_no[i]--;
if(count_no[i] == 0){
send_inc_info_one(&curr->info, ptr->mem.semid, ptr->mem.shm_ptr);
//snprintf(error_str, sizeof(error_str), "NOTICE: %s flow is abnormal, summit is %d, average flow is %lld !\n", curr->info.charname, summit, curr->info.average_flow);
snprintf(error_str, sizeof(error_str), "NOTICE: %s flow is abnormal !\n", curr->info.charname);
if( sys_nic_debug ) {
snprintf(error_str, sizeof(error_str),
"NOTICE: %s flow is abnormal, summit is %d, average flow is %lld !\n",
curr->info.charname, summit, curr->info.average_flow);
} else {
snprintf(error_str, sizeof(error_str), "NOTICE: %s flow is abnormal !\n", curr->info.charname);
}
record_log(error_str);
}
}
@@ -767,8 +782,9 @@ int ping_gw(char *devname)
snprintf(buf,sizeof(buf),"ping -c 1 -w %d %s|grep received|awk -F, '{print $2}'|awk '{print $1}'", conf.pinglap,conf.nic[i].ping_ip[j]);
if((fp = popen(buf,"r")) == NULL)
{
perror("popen");
return 0;
//perror("popen");
//return 0;
continue;
}else{
fgets(getbuf,sizeof(getbuf),fp);
if(strncmp(getbuf,"0",1) != 0)
@@ -777,7 +793,8 @@ int ping_gw(char *devname)
return 0;
}else{
pclose(fp);
return -1;
//return -1;
continue;
}
}
pclose(fp);
@@ -1443,6 +1460,10 @@ int main(int argc, char ** argv)
char log_record[125]={0};
if( getenv("SYS_NIC_DEBUG") ) {
sys_nic_debug = 1;
}
memset(&conf, 0, sizeof(CONFIG_FILE_ST));
if(isrun(argv[0]) == 1){
printf("the program is already started!\n");

18
packages/1.8.1/bin/README vendored Normal file
View File

@@ -0,0 +1,18 @@
========
安装说明:
直接运行命令:
sh ./install.sh
或者采用如下步骤:
1)安装以root的用户执行安装命令
pkgadd sys_nicmonitor#1.8.1-x86_64-Linx-Rocky4.2.pkg.tar.gz
如果之前已经安装,则可先卸载旧的然后再安装,或者通过更新方式安装
卸载命令: pkgrm sys_nicmonitor
更新方式安装命令:
pkgadd u sys_nicmonitor#1.8.1-x86_64-Linx-Rocky4.2.pkg.tar.gz
2查看安装是否成功
pkginfo -i|grep sys_nicmonitor
或者
查看d5000用户的目录下lib/libnic_shm.so和bin/sys_nicmonitor的日期是否

5
packages/1.8.1/bin/install.sh vendored Executable file
View File

@@ -0,0 +1,5 @@
#!/bin/bash
pkgrm sys_nicmonitor
pkgadd sys_nicmonitor#1.8.1-x86_64-Linx-Rocky4.2.pkg.tar.gz
pkginfo -i | grep nic

Binary file not shown.