分类:运维技术日期:2018-05-16 - 15:13:15评论:0条作者:老谢
zabbix_proxy编译安装
groupadd zabbix
useradd -g zabbix -s /sbin/nologin zabbix
yum -y install net-snmp net-snmp-devel curl curl-devel perl-DBI net-snmp-utils
wget https://netix.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.2.11/zabbix-3.2.11.tar.gz
tar -zxf zabbix-3.2.11.tar.gz
mysql -uroot -proot -e "create database zabbix_proxy character set utf8"
cd zabbix-3.2.11
./configure --prefix=/usr/local/zabbix \
--enable-proxy \
--enable-agent \
--with-mysql=/usr/bin/mysql_config \
--with-net-snmp \
--with-libcurl \
--with-libxml2 \
--with-openssl
make install
mysql -uroot -proot zabbix_proxy < database/mysql/schema.sql |
groupadd zabbix
useradd -g zabbix -s /sbin/nologin zabbix
yum -y install net-snmp net-snmp-devel curl curl-devel perl-DBI net-snmp-utils
wget https://netix.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.2.11/zabbix-3.2.11.tar.gz
tar -zxf zabbix-3.2.11.tar.gz
mysql -uroot -proot -e "create database zabbix_proxy character set utf8"
cd zabbix-3.2.11
./configure --prefix=/usr/local/zabbix \
--enable-proxy \
--enable-agent \
--with-mysql=/usr/bin/mysql_config \
--with-net-snmp \
--with-libcurl \
--with-libxml2 \
--with-openssl
make install
mysql -uroot -proot zabbix_proxy < database/mysql/schema.sql
修改/usr/local/zabbix/etc/zabbix_proxy.conf配置文件
Server=IP # zabbix服务端IP
Hostname=wyy_proxy # 必须和WEB页面添加代理时设置的名称一致
LogFile=/tmp/zabbix_proxy.log # 日志文件
DBHost=IP # 数据库IP
DBName=zabbix_proxy # 数据库名
DBUser=user # 数据库用户名
DBPassword=password # 数据库密码 |
Server=IP # zabbix服务端IP
Hostname=wyy_proxy # 必须和WEB页面添加代理时设置的名称一致
LogFile=/tmp/zabbix_proxy.log # 日志文件
DBHost=IP # 数据库IP
DBName=zabbix_proxy # 数据库名
DBUser=user # 数据库用户名
DBPassword=password # 数据库密码
启动proxy服务
/usr/local/zabbix/sbin/zabbix_proxy |
/usr/local/zabbix/sbin/zabbix_proxy
iptables开放端口
iptables -A INPUT -p tcp --dport 10050 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 10050 -j ACCEPT
iptables -A INPUT -p tcp --dport 10051 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 10051 -j ACCEPT
/etc/init.d/iptables save |
iptables -A INPUT -p tcp --dport 10050 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 10050 -j ACCEPT
iptables -A INPUT -p tcp --dport 10051 -j ACCEPT
iptables -A OUTPUT -p tcp --sport 10051 -j ACCEPT
/etc/init.d/iptables save
修改/usr/local/zabbix/etc/zabbix_agentd.conf配置文件
Server=proxyIP #proxyIP为proxy服务器IP
#重启agent端,使配置生效
service zabbix_agentd start |
Server=proxyIP #proxyIP为proxy服务器IP
#重启agent端,使配置生效
service zabbix_agentd start
zabbix_agentd及zabbix_proxy的主机名要与zabbix_server中添加的主机名一致,zabbix_agent的server地址填proxy的地址。
下面是重点
ConfigFrequency=60 #zabbix proxy从zabbix server取得配置数据的频率(秒),默认1小时同步一次!
分类:linux日期:2018-05-08 - 19:39:15评论:0条作者:老谢
在配置zabbix主机的时候,有个items抓snmp的oid输出的是字符串,zabbix3.4可以直接通过正则处理snmp抓到的数据,但是为了oneoaas已经降级到了zabbix 3.2,经过一番搜索可以通过外部脚本来处理抓到的字符串,首先编辑vim /usr/local/zabbix/etc/zabbix_server.conf,关掉externalscripts的注释,然后修改为正确路即可。
snmpwalk -v 2c -c public 192.168.1.1 1.3.6.1.4.1.35047.2.10.7.0抓取到的值为SNMPv2-SMI::enterprises.35047.2.10.7.0 = STRING: “35 loginned users in all”,处理脚本如下:
#!/bin/bash
test=$(snmpwalk -v 2c -c public 192.168.1.1 1.3.6.1.4.1.35047.2.10.7.0)
#test1=`$test | grep '"\d+'`
echo $test | awk '
{
string=$0
len=length(string)
for(i=50; i<=len; i++)
{
tmp=substr(string,i,1)
if(tmp ~ /[0-9]/)
{
str=tmp
str1=(str1 str)
}
}
print str1
}' |
#!/bin/bash
test=$(snmpwalk -v 2c -c public 192.168.1.1 1.3.6.1.4.1.35047.2.10.7.0)
#test1=`$test | grep '"\d+'`
echo $test | awk '
{
string=$0
len=length(string)
for(i=50; i<=len; i++)
{
tmp=substr(string,i,1)
if(tmp ~ /[0-9]/)
{
str=tmp
str1=(str1 str)
}
}
print str1
}'
分类:网络技术日期:2018-05-05 - 11:37:31评论:1条作者:老谢
测试3.2和3.4均可用,通知媒介里面,给三个参数,顺序为:{ALERT.SENDTO} {ALERT.SUBJECT} {ALERT.MESSAGE}
#!/usr/bin/python
#coding:utf-8
import smtplib
from email.mime.text import MIMEText
import sys
defaultencoding = 'utf-8'
if sys.getdefaultencoding() != defaultencoding:
reload(sys)
sys.setdefaultencoding(defaultencoding)
mail_host = 'smtp.xxx.cn'
mail_user = 'xxx'
mail_pass = 'xxx'
mail_postfix = 'xxx.cn'
def send_mail(to_list,subject,content):
me = mail_user+"@"+mail_postfix
msg = MIMEText(content, 'plain', 'utf-8')
msg["Accept-Language"]="zh-CN"
msg["Accept-Charset"]="ISO-8859-1,utf-8"
if not isinstance(subject,unicode):
subject = unicode(subject)
msg['Subject'] = subject
msg['From'] = me
msg['to'] = to_list
try:
s = smtplib.SMTP()
s.connect(mail_host)
s.login(mail_user,mail_pass)
s.sendmail(me,to_list,msg.as_string())
s.close()
return True
except Exception,e:
print str(e)
return False
if __name__ == "__main__":
send_mail(sys.argv[1], sys.argv[2], sys.argv[3]) |
#!/usr/bin/python
#coding:utf-8
import smtplib
from email.mime.text import MIMEText
import sys
defaultencoding = 'utf-8'
if sys.getdefaultencoding() != defaultencoding:
reload(sys)
sys.setdefaultencoding(defaultencoding)
mail_host = 'smtp.xxx.cn'
mail_user = 'xxx'
mail_pass = 'xxx'
mail_postfix = 'xxx.cn'
def send_mail(to_list,subject,content):
me = mail_user+"@"+mail_postfix
msg = MIMEText(content, 'plain', 'utf-8')
msg["Accept-Language"]="zh-CN"
msg["Accept-Charset"]="ISO-8859-1,utf-8"
if not isinstance(subject,unicode):
subject = unicode(subject)
msg['Subject'] = subject
msg['From'] = me
msg['to'] = to_list
try:
s = smtplib.SMTP()
s.connect(mail_host)
s.login(mail_user,mail_pass)
s.sendmail(me,to_list,msg.as_string())
s.close()
return True
except Exception,e:
print str(e)
return False
if __name__ == "__main__":
send_mail(sys.argv[1], sys.argv[2], sys.argv[3])
分类:linux日期:2018-04-10 - 10:45:17评论:0条作者:老谢
请优先参考:LNMP安装配置Zabbix搭建企业级监控平台
安装zabbix(CentOS 6.9 X64)
groupadd zabbix
useradd -g zabbix -s /sbin/nologin zabbix
yum -y install net-snmp net-snmp-devel curl curl-devel perl-DBI net-snmp-utils
wget https://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.4.8/zabbix-3.4.8.tar.gz
tar -zxf zabbix-3.4.8.tar.gz
mysql -uroot -proot -e "create database zabbix character set utf8"
cd zabbix-3.4.8
mysql -uroot -proot zabbix < database/mysql/schema.sql
mysql -uroot -proot zabbix < database/mysql/images.sql
mysql -uroot -proot zabbix < database/mysql/data.sql
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --enable-ipv6 --with-net-snmp --with-libcurl --with-openssl
make install
vim /etc/services
#添加下面的字段
zabbix-agent 10050/tcp #Zabbix Agent
zabbix-agent 10050/udp #Zabbix Agent
zabbix-trapper 10051/tcp #Zabbix Trapper
zabbix-trapper 10051/udp #Zabbix Trapper
#修改 zabbix server 配置文件
#注意:DBUser和DBPassword请自行根据实际情况填写数据库用户名及密码
vim /usr/local/zabbix/etc/zabbix_server.conf
DBUser=zabbix
DBPassword=zabbix
cp misc/init.d/fedora/core/zabbix_* /etc/init.d/
sed -i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_server
sed -i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_agentd
chmod +x /etc/init.d/zabbix_server
chmod +x /etc/init.d/zabbix_agentd
#添加mysql client库到系统默认库中:
vim /etc/ld.so.conf
#添加:
/usr/local/mysql/lib
#启动
/etc/init.d/zabbix_server start
mkdir /home/wwwroot/zabbix
cp -r -a frontends/php/* /home/wwwroot/zabbix |
groupadd zabbix
useradd -g zabbix -s /sbin/nologin zabbix
yum -y install net-snmp net-snmp-devel curl curl-devel perl-DBI net-snmp-utils
wget https://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.4.8/zabbix-3.4.8.tar.gz
tar -zxf zabbix-3.4.8.tar.gz
mysql -uroot -proot -e "create database zabbix character set utf8"
cd zabbix-3.4.8
mysql -uroot -proot zabbix < database/mysql/schema.sql
mysql -uroot -proot zabbix < database/mysql/images.sql
mysql -uroot -proot zabbix < database/mysql/data.sql
./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --enable-ipv6 --with-net-snmp --with-libcurl --with-openssl
make install
vim /etc/services
#添加下面的字段
zabbix-agent 10050/tcp #Zabbix Agent
zabbix-agent 10050/udp #Zabbix Agent
zabbix-trapper 10051/tcp #Zabbix Trapper
zabbix-trapper 10051/udp #Zabbix Trapper
#修改 zabbix server 配置文件
#注意:DBUser和DBPassword请自行根据实际情况填写数据库用户名及密码
vim /usr/local/zabbix/etc/zabbix_server.conf
DBUser=zabbix
DBPassword=zabbix
cp misc/init.d/fedora/core/zabbix_* /etc/init.d/
sed -i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_server
sed -i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_agentd
chmod +x /etc/init.d/zabbix_server
chmod +x /etc/init.d/zabbix_agentd
#添加mysql client库到系统默认库中:
vim /etc/ld.so.conf
#添加:
/usr/local/mysql/lib
#启动
/etc/init.d/zabbix_server start
mkdir /home/wwwroot/zabbix
cp -r -a frontends/php/* /home/wwwroot/zabbix
配置fping
yum install epel-release.noarch
yum update
yum install fping
chown root:zabbix /usr/sbin/fping
chmod 710 /usr/sbin/fping
chmod ug+s /usr/sbin/fping
#修改/usr/local/zabbix/etc/zabbix_server.conf,删除FpingLocation=/usr/sbin/fping前的注释。 |
yum install epel-release.noarch
yum update
yum install fping
chown root:zabbix /usr/sbin/fping
chmod 710 /usr/sbin/fping
chmod ug+s /usr/sbin/fping
#修改/usr/local/zabbix/etc/zabbix_server.conf,删除FpingLocation=/usr/sbin/fping前的注释。
分类:网络技术日期:2018-04-09 - 19:23:01评论:6条作者:老谢
需求说明
由于设备量较大,如何有效的备份交换机设备配置文件就成了问题,经过一番搜索和对比,最终决定使用上传配置文件到tftp的方式进行备份,下面的脚本使用telnetlib库进行操作,感谢大D牛倾情技术支持,再次谢过大D神犇。
修改说明
Guge上传的V3.0源码仅支持Cisco的交换机,在大D牛的技术支持下,增加了H3C的支持(部分老版本的H3C可能会备份失败),同时也会按照时间自动分目录进行备份,下一步的想法会加入json的支持以及GUI。
main.py V4.0(测试环境Python 2.7.14)
#!/usr/bin/python
#by Kuhn 2014-03-29
#Updata by Derek.s && Jason 2018-04-09
import sys
import os
import telnetlib
import getpass
import datetime
import pexpect
import re
host = ""
user = "123"
password = "123"
#password = "123"
enpw = "123"
h3cpw = "123"
tftpserver = "8.8.8.8"
now = datetime.datetime.now()
def main():
for host in open("sw.txt", "r").readlines():
dsthost = host.strip('\n')
try:
tn = telnetlib.Telnet(dsthost,port=23,timeout=10)
except:
print "Can't connection %s"%dsthost
continue
#tn.read_until("Username:")
#tn.write(user+"\n")
try:
tn.read_until("Password:")
tn.write(password+"\n")
result = tn.read_some()
rex_h3c_bin_1 = r'%Wrong password'
login_Failed_H3C_1 = re.search(rex_h3c_bin_1, result)
rex_h3c_bin_2 = r'%Username or password is invalid.'
login_Failed_H3C_2 = re.search(rex_h3c_bin_2, result)
except:
print "Connection error %s"%dsthost
continue
#print(login_Failed_H3C_1, login_Failed_H3C_2)
if((login_Failed_H3C_1 is None) and (login_Failed_H3C_2 is None)):
#print("cisco")
try:
tn.write("en\n")
tn.read_until("Password:")
tn.write(enpw+"\n")
tn.read_until("#")
tn.write("copy running-config tftp:\n")
tn.write(tftpserver+"\n")
tn.write(now.strftime("%Y/%m/%d")+"/"+host+"\n")
tn.read_until("#")
tn.close
print now.strftime("%Y/%m/%d") + " " + dsthost + " Backup successful."
except:
print "Connection error %s"%dsthost
continue
else:
#print("H3c")
try:
tn.write(h3cpw+"\n")
tn.read_until(">")
tn.write("tftp "+tftpserver+" put flash:/startup.cfg"+" "+now.strftime("%Y/%m/%d")+"/"+host+"\n")
tn.read_until(">")
tn.close
print now.strftime("%Y/%m/%d") + " " + dsthost + " Backup successful(h3c)."
except:
print "Connection error %s"%dsthost
continue
if __name__=="__main__":
main() |
#!/usr/bin/python
#by Kuhn 2014-03-29
#Updata by Derek.s && Jason 2018-04-09
import sys
import os
import telnetlib
import getpass
import datetime
import pexpect
import re
host = ""
user = "123"
password = "123"
#password = "123"
enpw = "123"
h3cpw = "123"
tftpserver = "8.8.8.8"
now = datetime.datetime.now()
def main():
for host in open("sw.txt", "r").readlines():
dsthost = host.strip('\n')
try:
tn = telnetlib.Telnet(dsthost,port=23,timeout=10)
except:
print "Can't connection %s"%dsthost
continue
#tn.read_until("Username:")
#tn.write(user+"\n")
try:
tn.read_until("Password:")
tn.write(password+"\n")
result = tn.read_some()
rex_h3c_bin_1 = r'%Wrong password'
login_Failed_H3C_1 = re.search(rex_h3c_bin_1, result)
rex_h3c_bin_2 = r'%Username or password is invalid.'
login_Failed_H3C_2 = re.search(rex_h3c_bin_2, result)
except:
print "Connection error %s"%dsthost
continue
#print(login_Failed_H3C_1, login_Failed_H3C_2)
if((login_Failed_H3C_1 is None) and (login_Failed_H3C_2 is None)):
#print("cisco")
try:
tn.write("en\n")
tn.read_until("Password:")
tn.write(enpw+"\n")
tn.read_until("#")
tn.write("copy running-config tftp:\n")
tn.write(tftpserver+"\n")
tn.write(now.strftime("%Y/%m/%d")+"/"+host+"\n")
tn.read_until("#")
tn.close
print now.strftime("%Y/%m/%d") + " " + dsthost + " Backup successful."
except:
print "Connection error %s"%dsthost
continue
else:
#print("H3c")
try:
tn.write(h3cpw+"\n")
tn.read_until(">")
tn.write("tftp "+tftpserver+" put flash:/startup.cfg"+" "+now.strftime("%Y/%m/%d")+"/"+host+"\n")
tn.read_until(">")
tn.close
print now.strftime("%Y/%m/%d") + " " + dsthost + " Backup successful(h3c)."
except:
print "Connection error %s"%dsthost
continue
if __name__=="__main__":
main()
参考:http://mybeibei.net/157.html
分类:网络技术日期:2018-04-02 - 21:03:59评论:0条作者:老谢
EVE-NG(全称Emulated Virtual Environment – NextGeneration),继Unetlab 1.0后的Unetlab的2.0新版本,改了名字,原名是UnifiedNetworking Lab统一网络实验室。笔者觉得名字改的非常合理,这款模拟器已经不仅可以模拟网络设备,也可以运行一切虚拟机。理论上,只要能将虚拟机的虚拟磁盘格式转换为qcow2都可以在EVE-NG上运行。所以,EVE-NG可以算得上是仿真虚拟环境。EVE-NG是国外大神们开发的,融合了dynamips,IOL,KVM。它是深度定制的Ubuntu操作系统,可以直接把它安装在x86架构的物理主机上。它也有ova版本,可以导入到VMware等虚拟机软件中运行。EVE-NG在交互模式上更加具有优势,与GNS3截然不同。GNS3更像是用户使用的软件,只有GNS3支持的 OS才能使用;而EVE-NG更像是CS模型,EVE-NG是服务端,用户端可以是支持http/https的任意OS。
EVE-NG模拟器的安装配置
可以在EVE-NG官网下载到ova格式的虚拟机文件,在VMware Workstation Pro或VSPHERE等虚拟机中导入即可,root的默认密码是eve,老版本可能是unl,第一次进入系统会进入初始化配置界面,按照向导进行设置即可,之后会自动进行重启,再次进入系统可以使用apt-get update获取更新列表,然后使用apt-get install eve-ng安装eve-ng的更新版本。
使用vim将下面的python脚本写到文件,然后使用命令pydoc3 文件名执行后即可进行破解并自动写入序列号。
CiscoIOUKeygen.py
#! /usr/bin/python
print("*********************************************************************")
print("Cisco IOU License Generator - Kal 2011, python port of 2006 C version")
print("Modified to work with python3 by c_d 2014")
import os
import socket
import hashlib
import struct
# get the host id and host name to calculate the hostkey
hostid=os.popen("hostid").read().strip()
hostname = socket.gethostname()
ioukey=int(hostid,16)
for x in hostname:
ioukey = ioukey + ord(x)
print("hostid=" + hostid +", hostname="+ hostname + ", ioukey=" + hex(ioukey)[2:])
# create the license using md5sum
iouPad1 = b'\x4B\x58\x21\x81\x56\x7B\x0D\xF3\x21\x43\x9B\x7E\xAC\x1D\xE6\x8A'
iouPad2 = b'\x80' + 39*b'\0'
md5input=iouPad1 + iouPad2 + struct.pack('!I', ioukey) + iouPad1
iouLicense=hashlib.md5(md5input).hexdigest()[:16]
print("\nAdd the following text to ~/.iourc:")
print("[license]\n" + hostname + " = " + iouLicense + ";\n")
print("You can disable the phone home feature with something like:")
print(" echo '127.0.0.127 xml.cisco.com' >> /etc/hosts\n")
lic = ["[license]\n" + hostname + " = " + iouLicense + ";" + "\n"]
f = open('/opt/unetlab/addons/iol/bin/iourc','w')
f.writelines(lic)
f.close() |
#! /usr/bin/python
print("*********************************************************************")
print("Cisco IOU License Generator - Kal 2011, python port of 2006 C version")
print("Modified to work with python3 by c_d 2014")
import os
import socket
import hashlib
import struct
# get the host id and host name to calculate the hostkey
hostid=os.popen("hostid").read().strip()
hostname = socket.gethostname()
ioukey=int(hostid,16)
for x in hostname:
ioukey = ioukey + ord(x)
print("hostid=" + hostid +", hostname="+ hostname + ", ioukey=" + hex(ioukey)[2:])
# create the license using md5sum
iouPad1 = b'\x4B\x58\x21\x81\x56\x7B\x0D\xF3\x21\x43\x9B\x7E\xAC\x1D\xE6\x8A'
iouPad2 = b'\x80' + 39*b'\0'
md5input=iouPad1 + iouPad2 + struct.pack('!I', ioukey) + iouPad1
iouLicense=hashlib.md5(md5input).hexdigest()[:16]
print("\nAdd the following text to ~/.iourc:")
print("[license]\n" + hostname + " = " + iouLicense + ";\n")
print("You can disable the phone home feature with something like:")
print(" echo '127.0.0.127 xml.cisco.com' >> /etc/hosts\n")
lic = ["[license]\n" + hostname + " = " + iouLicense + ";" + "\n"]
f = open('/opt/unetlab/addons/iol/bin/iourc','w')
f.writelines(lic)
f.close()
继续阅读…
分类:乱七八糟日期:2018-03-25 - 22:14:31评论:5条作者:老谢
本来屏幕上有个坏点,电池循环次数700+,本来想走AC+免费把电池和屏幕换掉,然后最后一次摔手机,在屏幕和壳的链接处凹进去了一块,被拒保了…所以干脆走AC+意外险换了新机..无锡恒隆广场的直营店,总体感觉一般,预约检测完机器一个小时后拿到新机,然后付款就可以走人了。

分类:乱七八糟日期:2018-01-21 - 10:37:22评论:11条作者:老谢
2017算得上很关键的一年,开始了新的生活,算一算也已经离开家在外快10年了。
生活
通过所有考试,顺利拿到毕业证书以及申请学位证书。股票一波三折,一波操作失误没救回来,最终亏损10个点。
工作
转变很大。
学习
进展缓慢。
计划
2017年目标的完成情况:
- 感情顺其自然 完成(什么时候领证呢)
- 股票翻番 失败(亏损)
- 拔掉两颗智齿 完成(四颗)
- 苏州稳定下来 完成(基本稳定)
- 第一辆车 完成
- 坚持健身,减脂成功,练出腹肌 失败
- 除换一部iPhone以及刚需的产品,不再买任何大件(超过3000元)数码产品 失败(也没换iPhone),18年不剁手!
2018目标:
- 通过CCNA
- 通过CCNP
- 学习Python
- 学习PHP+MySQL
- 搭建Zabbix监控平台,开始运维自动化的工作
- 恢复健身,坚持健身
- 节约开支,争取买房
数据

总结
无。
历年总结
2016年末总结
2015年末总结
2014年末总结
2013年末总结
2012年末总结
2011年末总结
2010博客访问分析
分类:网络技术日期:2017-10-30 - 21:36:17评论:15条作者:老谢
由于一些需求,在DS216的基础上又增加了一台DS116作为辅助存储的设备,设置配置DS116的时候看到可以使用短信接口进行通知,碰巧感兴趣折腾一波:
<?php
$u = $_GET['u'];
$p = $_GET['p'];
$m = substr($_GET['m'],3,14);
$c = '【Synology】'.$_GET['c'];
$result = 'http://www.smsbao.com/sms?u='.$u.'&p='.md5($p).'&m='.$m.'&c='.urlencode($c);
file_get_contents($result);
?> |
<?php
$u = $_GET['u'];
$p = $_GET['p'];
$m = substr($_GET['m'],3,14);
$c = '【Synology】'.$_GET['c'];
$result = 'http://www.smsbao.com/sms?u='.$u.'&p='.md5($p).'&m='.$m.'&c='.urlencode($c);
file_get_contents($result);
?>
接口规则
http://www.xj123.info/tool/smsbao_synology.php?u=用户名&p=密码&m=+86电话号码&c=内容 |
http://www.xj123.info/tool/smsbao_synology.php?u=用户名&p=密码&m=+86电话号码&c=内容
根据国内运营商要求,必须加上【XXX】的内容才能发送短信,要单独写个接口是因为国际化的DSM在通知填写号码的时候,强制填写国际代码,所以号码前面会加“+86”这3个字符,而短信宝又太本土化,加了+86就发送不了短信了…
分类:linux日期:2017-10-29 - 0:06:12评论:0条作者:老谢
抽空给一台闲置的笔记本装了CentOS,完事插网线发现ifconfig没有eth0地址,做出如下调整后可以正常从HDCP获取到IP地址,编辑网络接口配置文件:
/etc/sysconfig/network-scripts/ifcfg-eth0 |
/etc/sysconfig/network-scripts/ifcfg-eth0
将ONBOOT改为yes,NM_CONTROLLED改为no,BOOTPROTO改为dhcp之后,重启网络连接即可:service network restart。

最新评论
王光卫博客:以前也喜欢DIY现在玩不动了
大D:大佬!
Sirit:够用就好,不过现在的电子产品是真的...
美樂地:我也想买个mini PC,打算等下一代的...
Mr.Chou:老牌子又不用带独显够用的,如换是...
小熊:评论区全是大佬,就我完全不太懂。
老俍:真是巧了,我也想给苏菲4pro换电池呢,...
空空裤兜:all in one的小主机都有两千的了。...
Pampo:1600组一个12100的不错了,价格压挺低...
无敌风火轮:和索尼没啥关系,这是索尼电脑的...