Browse Source

变更

main
Reaper 2 years ago
parent
commit
10f3a8e03a
  1. BIN
      agent/GeoLite2-Country.mmdb
  2. 250
      agent/agent.sh
  3. BIN
      agent/cdnfly-agent-v5.1.15-Ubuntu-16.04.tar.gz
  4. BIN
      agent/cdnfly-agent-v5.1.15-centos-7.tar.gz
  5. BIN
      agent/cdnfly-agent-v5.1.16-Ubuntu-16.04.tar.gz
  6. BIN
      agent/cdnfly-agent-v5.1.16-centos-7.tar.gz
  7. 26
      agent/epel.repo
  8. BIN
      agent/openresty-Ubuntu-16.04-20220305.tar.gz
  9. BIN
      agent/openresty-centos-7-20220305.tar.gz
  10. BIN
      agent/pymodule-agent-20211114.tar.gz
  11. BIN
      agent/redis-Ubuntu-16.04-20200714.tar.gz
  12. BIN
      agent/redis-centos-7-20200714.tar.gz
  13. 1
      agent/spider_ip.json

BIN
agent/GeoLite2-Country.mmdb

Binary file not shown.

250
agent/agent.sh

@ -0,0 +1,250 @@ @@ -0,0 +1,250 @@
#!/bin/bash -x
set -o errexit
#判断系统版本
check_sys(){
local checkType=$1
local value=$2
local release=''
local systemPackage=''
local packageSupport=''
if [[ "$release" == "" ]] || [[ "$systemPackage" == "" ]] || [[ "$packageSupport" == "" ]];then
if [[ -f /etc/redhat-release ]];then
release="centos"
systemPackage="yum"
packageSupport=true
elif cat /etc/issue | grep -q -E -i "debian";then
release="debian"
systemPackage="apt"
packageSupport=true
elif cat /etc/issue | grep -q -E -i "ubuntu";then
release="ubuntu"
systemPackage="apt"
packageSupport=true
elif cat /etc/issue | grep -q -E -i "centos|red hat|redhat";then
release="centos"
systemPackage="yum"
packageSupport=true
elif cat /proc/version | grep -q -E -i "debian";then
release="debian"
systemPackage="apt"
packageSupport=true
elif cat /proc/version | grep -q -E -i "ubuntu";then
release="ubuntu"
systemPackage="apt"
packageSupport=true
elif cat /proc/version | grep -q -E -i "centos|red hat|redhat";then
release="centos"
systemPackage="yum"
packageSupport=true
else
release="other"
systemPackage="other"
packageSupport=false
fi
fi
echo -e "release=$release\nsystemPackage=$systemPackage\npackageSupport=$packageSupport\n" > /tmp/ezhttp_sys_check_result
if [[ $checkType == "sysRelease" ]]; then
if [ "$value" == "$release" ];then
return 0
else
return 1
fi
elif [[ $checkType == "packageManager" ]]; then
if [ "$value" == "$systemPackage" ];then
return 0
else
return 1
fi
elif [[ $checkType == "packageSupport" ]]; then
if $packageSupport;then
return 0
else
return 1
fi
fi
}
# 安装依赖
install_depend() {
if check_sys sysRelease ubuntu;then
apt-get update
apt-get -y install wget python-minimal
elif check_sys sysRelease centos;then
yum install -y wget python
fi
}
download(){
local url1=$1
local url2=$2
local filename=$3
# 检查文件是否存在
# if [[ -f $filename ]]; then
# echo "$filename 文件已经存在,忽略"
# return
# fi
speed1=`curl -m 5 -L -s -w '%{speed_download}' "$url1" -o /dev/null || true`
speed1=${speed1%%.*}
speed2=`curl -m 5 -L -s -w '%{speed_download}' "$url2" -o /dev/null || true`
speed2=${speed2%%.*}
echo "speed1:"$speed1
echo "speed2:"$speed2
url="$url1\n$url2"
if [[ $speed2 -gt $speed1 ]]; then
url="$url2\n$url1"
fi
echo -e $url | while read l;do
echo "using url:"$l
wget --dns-timeout=5 --connect-timeout=5 --read-timeout=10 --tries=2 "$l" -O $filename && break
done
}
get_sys_ver() {
cat > /tmp/sys_ver.py <<EOF
import platform
import re
sys_ver = platform.platform()
sys_ver = re.sub(r'.*-with-(.*)-.*',"\g<1>",sys_ver)
if sys_ver.startswith("centos-7"):
sys_ver = "centos-7"
if sys_ver.startswith("centos-6"):
sys_ver = "centos-6"
print sys_ver
EOF
echo `python /tmp/sys_ver.py`
}
sync_time(){
echo "start to sync time and add sync command to cronjob..."
if check_sys sysRelease ubuntu || check_sys sysRelease debian;then
apt-get -y update
apt-get -y install ntpdate wget
/usr/sbin/ntpdate -u pool.ntp.org || true
! grep -q "/usr/sbin/ntpdate -u pool.ntp.org" /var/spool/cron/crontabs/root > /dev/null 2>&1 && echo '*/10 * * * * /usr/sbin/ntpdate -u pool.ntp.org > /dev/null 2>&1 || (date_str=`curl update.cdnfly.cn/common/datetime` && timedatectl set-ntp false && echo $date_str && timedatectl set-time "$date_str" )' >> /var/spool/cron/crontabs/root
service cron restart
elif check_sys sysRelease centos; then
yum -y install ntpdate wget
/usr/sbin/ntpdate -u pool.ntp.org || true
! grep -q "/usr/sbin/ntpdate -u pool.ntp.org" /var/spool/cron/root > /dev/null 2>&1 && echo '*/10 * * * * /usr/sbin/ntpdate -u pool.ntp.org > /dev/null 2>&1 || (date_str=`curl update.cdnfly.cn/common/datetime` && timedatectl set-ntp false && echo $date_str && timedatectl set-time "$date_str" )' >> /var/spool/cron/root
service crond restart
fi
# 时区
rm -f /etc/localtime
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
if /sbin/hwclock -w;then
return
fi
}
need_sys() {
SYS_VER=`python -c "import platform;import re;sys_ver = platform.platform();sys_ver = re.sub(r'.*-with-(.*)-.*','\g<1>',sys_ver);print sys_ver;"`
if [[ $SYS_VER =~ "Ubuntu-16.04" ]];then
echo "$sys_ver"
elif [[ $SYS_VER =~ "centos-7" ]]; then
SYS_VER="centos-7"
echo $SYS_VER
else
echo "目前只支持ubuntu-16.04和Centos-7"
exit 1
fi
}
install_depend
need_sys
sync_time
# 解析命令行参数
TEMP=`getopt -o h --long help,master-ver:,agent-ver:,master-ip:,es-ip:,es-pwd:,ignore-ntp -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
eval set -- "$TEMP"
while true ; do
case "$1" in
-h|--help) help ; exit 1 ;;
--master-ver) MASTER_VER=$2 ; shift 2 ;;
--agent-ver) AGENT_VER=$2 ; shift 2 ;;
--) shift ; break ;;
*) break ;;
esac
done
if [[ $MASTER_VER == "" ]]; then
if [[ $AGENT_VER == "" ]]; then
echo "--master-ver或--agent-ver至少提供一个"
exit 1
fi
# 指定了agent版本
if [[ ! `echo "$AGENT_VER" | grep -P "^v\d+\.\d+\.\d+$"` ]]; then
echo "指定的版本格式不正确,应该类似为v3.0.1"
exit 1
fi
#dir_name="cdnfly-agent-$AGENT_VER"
dir_name="cdnfly-agent-v5.1.15"
tar_gz_name="$dir_name-$(get_sys_ver).tar.gz"
else
# 指定了主控版本
# 根据master安装指定agent
# 由version_name转换成version_num
first_part=${MASTER_VER:1:1}
second_part=$(printf "%02d\n" `echo $MASTER_VER | awk -F'.' '{print $2}'`)
third_part=$(printf "%02d\n" `echo $MASTER_VER | awk -F'.' '{print $3}'`)
version_num="$first_part$second_part$third_part"
agent_ver=`(curl -s -m 5 "http://auth.fikkey.com/master/upgrades?version_num=$version_num" || curl -s -m 5 "https://github.com/LoveesYe/cdnflydadao/raw/main/web/upgrades?version_num=$version_num") | grep -Po '"agent_ver":"\d+"' | grep -Po "\d+" || true`
if [[ "$agent_ver" == "" ]]; then
echo "无法获取agent版本"
exit 1
fi
first_part=${agent_ver:0:1}
let second_part=10#${agent_ver:1:2} || true
let third_part=10#${agent_ver:3:2} || true
agent_version_name="v$first_part.$second_part.$third_part"
echo "根据主控版本$MASTER_VER得到agent需要安装的版本为$agent_version_name"
dir_name="cdnfly-agent-$agent_version_name"
tar_gz_name="$dir_name-$(get_sys_ver).tar.gz"
fi
cd /opt
download "https://github.com/LoveesYe/cdnflydadao/raw/main/agent/$tar_gz_name" "https://github.com/LoveesYe/cdnflydadao/raw/main/agent/$tar_gz_name" "$tar_gz_name"
rm -rf $dir_name
tar xf $tar_gz_name
rm -rf cdnfly
mv $dir_name cdnfly
# 开始安装
cd /opt/cdnfly/agent
chmod +x install.sh
./install.sh $@

BIN
agent/cdnfly-agent-v5.1.15-Ubuntu-16.04.tar.gz

Binary file not shown.

BIN
agent/cdnfly-agent-v5.1.15-centos-7.tar.gz

Binary file not shown.

BIN
agent/cdnfly-agent-v5.1.16-Ubuntu-16.04.tar.gz

Binary file not shown.

BIN
agent/cdnfly-agent-v5.1.16-centos-7.tar.gz

Binary file not shown.

26
agent/epel.repo

@ -0,0 +1,26 @@ @@ -0,0 +1,26 @@
[epel]
name=Extra Packages for Enterprise Linux 7 - $basearch
baseurl=http://mirrors.aliyun.com/epel/7/$basearch
#metalink=http://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch&infra=$infra&content=$contentdir
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
[epel-debuginfo]
name=Extra Packages for Enterprise Linux 7 - $basearch - Debug
baseurl=http://mirrors.aliyun.com/epel/7/$basearch/debug
#metalink=http://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch&infra=$infra&content=$contentdir
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=0
[epel-source]
name=Extra Packages for Enterprise Linux 7 - $basearch - Source
baseurl=http://mirrors.aliyun.com/epel/7/SRPMS
#metalink=http://mirrors.fedoraproject.org/metalink?repo=epel-source-7&arch=$basearch&infra=$infra&content=$contentdir
failovermethod=priority
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
gpgcheck=0

BIN
agent/openresty-Ubuntu-16.04-20220305.tar.gz

Binary file not shown.

BIN
agent/openresty-centos-7-20220305.tar.gz

Binary file not shown.

BIN
agent/pymodule-agent-20211114.tar.gz

Binary file not shown.

BIN
agent/redis-Ubuntu-16.04-20200714.tar.gz

Binary file not shown.

BIN
agent/redis-centos-7-20200714.tar.gz

Binary file not shown.

1
agent/spider_ip.json

@ -0,0 +1 @@ @@ -0,0 +1 @@
{"360spider":["180.153.232","180.153.234","180.153.236","180.163.220","42.236.101","42.236.102","42.236.103","42.236.10","42.236.12","42.236.13","42.236.14","42.236.15","42.236.16","42.236.17","42.236.46","42.236.48","42.236.49","42.236.50","42.236.51","42.236.52","42.236.53","42.236.54","42.236.55","42.236.99"], "baidu":["124.166.232","116.179.32","180.76.15","180.76.5","220.181.108","123.125.71","123.125.66","111.206.198","111.206.221","180.149.133","61.135.186","220.181.32","61.135.168","23.88.208","61.135.165","61.135.169","104.245.36","149.28.84","158.247.209","23.89.152","45.66.156","65.49.194","8.9.8"],"google":["103.28.15","109.228.12","109.238.6","129.143.3","142.147.250","144.76.92","162.221.189","173.212.206","173.212.237","173.249.20","173.249.22","173.249.31","174.34.149","175.45.118","178.20.236","194.48.168","194.67.218","195.201.22","202.222.13","202.222.14","203.208.60","209.141.43","209.141.60","212.162.12","213.136.87","213.136.91","217.156.87","217.20.115","23.105.51","45.77.110","45.77.142","45.77.69","5.189.166","64.68.88","64.68.90","64.68.91","64.68.92","66.249.64","66.249.65","66.249.66","66.249.68","66.249.69","66.249.70","66.249.71","66.249.72","66.249.73","66.249.74","66.249.75","66.249.76","66.249.79","79.143.185","79.174.79","89.46.100","91.144.154","93.104.213","95.211.225","108.177.64","108.177.65","108.177.66","108.177.67","108.177.68","108.177.69","108.177.70","108.177.71","108.177.72","108.177.73","108.177.74","108.177.75","108.177.76","108.177.77","108.177.78","203.208.38","209.85.238","66.249.87","66.249.89","66.249.90","66.249.91","66.249.92","72.14.199","74.125.148","74.125.149","74.125.150","74.125.151","74.125.216","74.125.217"],"sm":["106.11.152","106.11.153","106.11.154","106.11.155","106.11.156","106.11.157","106.11.158","106.11.159","42.120.160","42.120.161","42.120.234","42.120.235","42.120.236","42.156.136","42.156.137","42.156.138","42.156.139","42.156.254","42.156.255"],"bing":["103.25.156","103.255.141","104.44.253","104.44.91","104.44.92","104.44.93","104.47.224","111.221.28","111.221.31","131.253.24","131.253.25","131.253.26","131.253.27","131.253.35","131.253.36","131.253.38","131.253.46","131.253.47","13.66.139","13.66.144","157.245.205","157.55.10","157.55.103","157.55.106","157.55.107","157.55.12","157.55.13","157.55.154","157.55.2","157.55.21","157.55.22","157.55.23","157.55.34","157.55.39","157.55.50","157.55.7","157.56.0","157.56.1","157.56.2","157.56.3","157.56.71","157.56.92","157.56.93","185.209.30","191.232.136","199.30.17","199.30.18","199.30.19","199.30.20","199.30.21","199.30.22","199.30.23","199.30.24","199.30.25","199.30.26","199.30.27","199.30.28","199.30.29","199.30.30","199.30.31","202.222.14","202.89.235","207.46.12","207.46.126","207.46.13","207.46.199","207.68.155","23.103.64","40.66.1","40.66.4","40.73.148","40.77.160","40.77.161","40.77.162","40.77.163","40.77.164","40.77.165","40.77.166","40.77.167","40.77.168","40.77.169","40.77.170","40.77.171","40.77.172","40.77.173","40.77.174","40.77.175","40.77.176","40.77.177","40.77.178","40.77.179","40.77.180","40.77.181","40.77.182","40.77.183","40.77.184","40.77.185","40.77.186","40.77.187","40.77.188","40.77.189","40.77.190","40.77.191","40.77.192","40.77.193","40.77.194","40.77.195","40.77.208","40.77.209","40.77.210","40.77.211","40.77.212","40.77.213","40.77.214","40.77.215","40.77.216","40.77.217","40.77.218","40.77.219","40.77.220","40.77.221","40.77.222","40.77.223","40.77.248","40.77.250","40.77.251","40.77.252","40.77.253","40.77.254","40.77.255","40.90.11","40.90.144","40.90.145","40.90.146","40.90.147","40.90.148","40.90.149","40.90.150","40.90.151","40.90.152","40.90.153","40.90.154","40.90.155","40.90.156","40.90.157","40.90.158","40.90.159","40.90.8","42.159.176","42.159.48","51.4.84","51.5.84","52.167.144","62.109.1","64.4.22","65.52.109","65.52.110","65.54.164","65.54.247","65.55.107","65.55.146","65.55.189","65.55.208","65.55.209","65.55.210","65.55.211","65.55.212","65.55.213","65.55.214","65.55.215","65.55.216","65.55.217","65.55.218","65.55.219","65.55.25","65.55.54"],"sogou":["106.120.173","106.120.188","106.38.241","111.202.100","111.202.101","111.202.103","123.125.125","123.126.113","123.126.68","123.183.224","173.82.95","218.30.103","220.181.124","220.181.125","36.110.147","43.231.99","49.7.116","49.7.117","49.7.20","49.7.21","58.250.125","61.135.189"],"toutiao":["110.249.201","110.249.202","111.225.148","111.225.149","220.243.135","220.243.136","220.243.188","220.243.189","60.8.123","60.8.151"]}
Loading…
Cancel
Save