Prometheus 时间序列数据库 一般用来实现docker的监控
Zabbix metrics exporter for Prometheus
https://github.com/MyBook/zabbix-exporter
把zabbix的数据导出到Prometheus 然后用Prometheus做源,给grafana监控
Think! And Think Again
Prometheus 时间序列数据库 一般用来实现docker的监控
Zabbix metrics exporter for Prometheus
https://github.com/MyBook/zabbix-exporter
把zabbix的数据导出到Prometheus 然后用Prometheus做源,给grafana监控
awk -F’*:’ ‘{if ($2~/‘[0-9]+’/) print $2}’
如果$2 存在 一个或多个数字,打印$2
mkdir grafana-xxl-data
docker run -d –name=grafana-xxl -p 3000:3000 -v $PWD/grafana-xxl-data:/var/lib/grafana monitoringartist/grafana-xxl:3.0
值得一提的是,由于官方仓库托管在S3上,国内用户直接访问苦不堪言,万幸的是清华大学tuna镜像站已经提供了grafana的镜像,只需要将官方文档中提到的仓库地址对应的换成清华大学的镜像站的地址即可: https://mirrors.tuna.tsinghua.edu.cn/grafana/
http://gd.10086.cn/my/BILL_SEARCH.shtml 账单查询 直接点1月份
会在这个 看到账单
http://gd.10086.cn/my/BILL_SEARCH_NEW_EASYOWN.shtml
https://httpd.apache.org/download.cgi#apache24
rpmbuild -ts httpd-2.4.x.tar.bz2
注: 编译时可能有依赖
rpmbuild -tb apr-1.5.2.tar.bz2
rpm -Uvh /root/rpmbuild/RPMS/x86_64/apr-1.5.2-1.x86_64.rpm
rpm -Uvh /root/rpmbuild/RPMS/x86_64/apr-devel-1.5.2-1.x86_64.rpm
rpmbuild –rebuild
编包:
下载 apr 和 apr- 的源码包
复制
[root@aaauto srclib]# cp /tmp/apr-util-1.5.4/ /root/rpmbuild/BUILD/httpd-2.4.25/srclib/apr-util -rp
[root@aaauto srclib]# cp /tmp/apr-1.5.2 /root/rpmbuild/BUILD/httpd-2.4.25/srclib/apr -rp
vi /root/rpmbuild/SPECS/httpd.spec 添加
%configure \
--enable-layout=RPM \
--libdir=%{_libdir} \
--sysconfdir=%{_sysconfdir}/httpd/conf \
--includedir=%{_includedir}/httpd \
--libexecdir=%{_libdir}/httpd/modules \
--datadir=%{contentdir} \
--with-installbuilddir=%{_libdir}/httpd/build \
--enable-mpms-shared=all \
--with-apr=%{_prefix} --with-apr-util=%{_prefix} \
--enable-suexec --with-suexec \
--with-suexec-caller=%{suexec_caller} \
--with-suexec-docroot=%{contentdir} \
--with-suexec-logfile=%{_localstatedir}/log/httpd/suexec.log \
--with-suexec-bin=%{_sbindir}/suexec \
--with-suexec-uidmin=500 --with-suexec-gidmin=100 \
--enable-pie \
--with-pcre \
--enable-mods-shared=all \
--enable-ssl --with-ssl --enable-socache-dc --enable-bucketeer \
--enable-case-filter --enable-case-filter-in \
--disable-imagemap \
--with-included-apr \
--with-included-apr-util \
--with-included---with-pcre
cd /root/rpmbuild/SPECS
rpmbuild -ba httpd.spec
#########
1、卸载系统默认安装的http服务,apr
rpm -qa| grep http
yum remove httpd
rpm -qa| grep apr
yum remove apr
yum install httpd-2.4.25-1.x86_64.rpm httpd-devel-2.4.25-1.x86_64.rpm httpd-tools-2.4.25-1.x86_64.rpm apr-1.5.2-1.x86_64.rpm apr-devel-1.5.2-1.x86_64.rpm apr-util-1.5.4-1.x86_64.rpm apr-util-devel-1.5.4-1.x86_64.rpm
fab -H fonsview@172.16.6.66 –port=50000 – uname -a
mkdir -p ~/.pip/
vim ~/.pip/pip.conf
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
#####
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
前提条件 先安装pip
可以使用pip 安装本地的软件包。
生成软件包版本:
pip freeze > requirements.txt
下载对应的软件包:
pip download -r python_3rd/requirements.txt
安装对应的软件包:
pip install -r python_3rd/requirements.txt –no-index –find-links=file:///opt/fonsview/3RD/python_3rd/
如下 为pip下载的软件包:
-rw-r–r– 1 root root 52158 12月 23 22:31 APScheduler-3.2.0-py2.py3-none-any.whl
-rw-r–r– 1 root root 5151 12月 23 22:31 backports.ssl_match_hostname-3.4.0.2.tar.gz
-rw-r–r– 1 root root 46238 12月 23 22:31 Beaker-1.5.4.tar.gz
-rw-r–r– 1 root root 1252861 12月 23 22:32 boto-2.34.0-py2.py3-none-any.whl
-rw-r–r– 1 root root 190989 12月 23 22:32 Cheetah-2.4.4.tar.gz
-rw-r–r– 1 root root 32318 12月 23 22:35 configobj-4.7.2.tar.gz
-rw-r–r– 1 root root 29213 12月 23 22:35 confluent-kafka-0.9.2.tar.gz
-rw-r–r– 1 root root 230369 12月 23 22:35 coverage-3.6b3.tar.gz
-rw-r–r– 1 root root 6392924 12月 23 22:35 Cython-0.25.1-cp27-cp27mu-manylinux1_x86_64.whl
-rw-r–r– 1 root root 30333 12月 23 22:35 decorator-3.4.0.tar.gz
-rw-r–r– 1 root root 10889 12月 23 22:35 di-0.3.tar.gz
-rw-r–r– 1 root root 17697 12月 23 22:37 funcsigs-1.0.2-py2.py3-none-any.whl
-rw-r–r– 1 root root 14010 12月 23 22:37 futures-3.0.5-py2-none-any.whl
-rw-r–r– 1 root root 31278 12月 23 22:37 iniparse-0.4.tar.gz
-rw-r–r– 1 root root 28459 12月 23 22:38 IPy-0.75.tar.gz
-rw-r–r– 1 root root 6096 12月 23 22:38 jsonpatch-1.2.tar.gz
-rw-r–r– 1 root root 7203 12月 23 22:38 jsonpointer-1.9-py2-none-any.whl
-rw-r–r– 1 root root 193353 12月 23 22:38 kafka_python-1.3.1-py2.py3-none-any.whl
-rw-r–r– 1 root root 158105 12月 23 22:38 kitchen-1.1.1.tar.gz
-rw-r–r– 1 root root 3335355 12月 23 22:40 lxml-3.2.1.tar.gz
-rw-r–r– 1 root root 413563 12月 23 22:40 M2Crypto-0.21.1.tar.gz
-rw-r–r– 1 root root 407434 12月 23 22:40 Mako-0.8.1.tar.gz
-rw-r–r– 1 root root 279760 12月 23 22:40 Markdown-2.4.1.tar.gz
-rw-r–r– 1 root root 10911 12月 23 22:40 MarkupSafe-0.11.tar.gz
-rw-r–r– 1 root root 15325838 12月 23 22:41 numpy-1.11.2-cp27-cp27mu-manylinux1_x86_64.whl
-rw-r–r– 1 root root 523304 12月 23 22:42 Paste-1.7.5.1.tar.gz
-rw-r–r– 1 root root 1408539 12月 23 22:42 Pillow-2.0.0.zip
-rw-r–r– 1 root root 28053 12月 23 22:42 prettytable-0.7.2.zip
-rw-r–r– 1 root root 36516 12月 23 22:42 pyasn1-0.1.9-py2.py3-none-any.whl
-rw-r–r– 1 root root 70337 12月 23 22:42 pycurl-7.19.0.tar.gz
-rw-r–r– 1 root root 672870 12月 23 22:43 Pygments-2.0.2-py2-none-any.whl
登录的所有用户 无条件到hostmenu
3.
bash-3.2$ cat /usr/local/srsshd/bin/auto_login
#!/usr/bin/expect –
#version 3.1.7
set type [lindex $argv 0]
set os [lindex $argv 1]
set mode [lindex $argv 2]
set ip [lindex $argv 3]
set port [lindex $argv 4]
set user [lindex $argv 5]
set pwd1 [binary format H [lindex $argv 6]]
set pwd2 [binary format H [lindex $argv 7]]
proc usage { } {
puts “\n”
puts {Usage:auto_login [protocol] [system] [console_mode] [ip] [port] [username] [hex_pwd1] [hex_pwd2]}
puts {protocol: [-t(elnet)] [-s(sh)]}
puts {system: [-l(inux/unix)] [-w(indows)] [-c(isco)] [-h(uawei)] [-n(etdevice)]}
puts {console_mode: [0(VT100 disabled)] [1(VT100 enabled)]}
puts “\n”
exit 0
}
#GLOBAL: check param
if { $type == “” || $os == “” || $mode == “” || $ip == “” || $port == “” || $user == “” } {
puts “
usage
exit 1
}
set telnet “/usr/bin/telnet”
set ssh “/usr/bin/ssh”
set timeout 30
set keyfile “”
set string3 “”
set delay 1000
#GLOBAL: debugging…
#puts “type:$type”
#puts “os:$os”
#puts “mode:$mode”
#puts “ip:$ip”
#puts “port:$port”
#puts “user:$user”
#puts “pwd1:$pwd1”
#puts “pwd2:$pwd2”
#GLOBAL: while window resized
trap {
set rows [stty rows]
set cols [stty columns]
stty rows $rows columns $cols < $spawn_out(slave,name)
} WINCH
#GLOBAL: prepare variables
switch – $os \
-l {
set user_pmt “$ “
set root_pmt “# “
set elevation_cmd “su -“
} -c {
set user_pmt “>”
set root_pmt “#”
set elevation_cmd “en”
} -h {
set user_pmt “>”
set root_pmt “]”
set elevation_cmd “sys”
} -w {
set user_pmt “>”
set root_pmt “>”
set elevation_cmd “\r”
} -n {
set user_pmt “>”
set root_pmt “>”
set elevation_cmd “\r”
} default {
puts “
usage
exit 1
}
set elevation_pmt “assword:”
set pwd_pmt “assword:”
set elevation_ok_pmt $root_pmt
set login_pmt “ogin:”
set login_fail_pmt “failed”
set elevation_failed_pmt “assword:”
set excmd “0”
set empty_usr “NULL-PASS”
set empty_pwd “NULL-PASS”
proc handle_pwd { } {
global pwd1 root_pmt pwd_pmt elevation_cmd elevation_pmt pwd2 user_pmt empty_usr empty_pwd os delay
after $delay
if { $pwd1 == “” || $pwd1 == $empty_pwd } return
send – “$pwd1\r”
if { $pwd2 == “” } return
expect {
eof { puts “
timeout { puts “
“$user_pmt” {
if { $os == “-l” } {
send – “export LANG=en_US.UTF-8\r”
send – “export LANGUAGE=en_US.UTF-8\r”
}
send – “$elevation_cmd\r”
if { $pwd2 == $empty_pwd } return
expect {
eof { puts “
timeout { puts “
“$elevation_pmt” {
send – “$pwd2\r”
}
“$root_pmt” return
}
}
“$root_pmt” return
“$pwd_pmt” return
“as:” return
“sername:” return
}
}
proc handle_user { } {
global user pwd1 pwd_pmt empty_usr empty_pwd user_pmt root_pmt
if { $user == $empty_usr } return
send – “$user\r”
if { $pwd1 == “” || $pwd1 == $empty_pwd } return
expect {
eof { puts “
timeout { puts “
“$pwd_pmt” handle_pwd
“$user_pmt” return
“$root_pmt” return
“ogin:” return
“as:” return
“sername:” return
}
}
#get everything from database
if { $type == “-t” } {
set fd [open “| /usr/local/bin/expectAssistant $ip $user 1” “r”]
} elseif { $type == “-s” } {
set fd [open “| /usr/local/bin/expectAssistant $ip $user 0” “r”]
set fd2 [open “| /usr/local/bin/sshkeyAssistant $ip $user 0 $port” “r”]
gets $fd2 string3
close $fd2
} else {
puts “
usage
close $fd
exit 1
}
gets $fd string2
close $fd
if { $string2 != “” } {
set string [split $string2 “|”]
set login_pmt [binary format H [lindex $string 0] ]
set pwd_pmt [binary format H [lindex $string 1] ]
set root_pmt [binary format H [lindex $string 2] ]
set user_pmt [binary format H [lindex $string 3] ]
set login_fail_pmt [binary format H [lindex $string 4] ]
set elevation_cmd [binary format H [lindex $string 5] ]
set elevation_pmt [binary format H [lindex $string 6] ]
set elevation_ok_pmt [binary format H [lindex $string 7] ]
set elevation_failed_pmt [binary format H [lindex $string 8] ]
set excmd [binary format H [lindex $string 14] ]
}
if { $os == “-l” } {
if { $user_pmt == "$" } {
set user_pmt "\$ "
}
if { $root_pmt == "$" } {
set root_pmt "\$ "
}
}
if { $string3 != “” } {
set keyfile [binary format H* $string3]
}
if { $type == “-t” } {
if { $user == $empty_usr } {
spawn -noecho $telnet -E $ip $port
interact
exit 0
} else {
spawn -noecho $telnet -E -l $user $ip $port
}
} elseif { $type == “-s” } {
if { $user == $empty_usr } {
send_user -- "Plese Input Username: "
expect_user -re "(.*)\n"
send_user "\n"
set username $expect_out(1,string)
spawn -noecho $ssh -l $username -p $port $ip
} else {
if { $keyfile != "" } {
#spawn -noecho chmod 600 $keyfile
spawn -noecho $ssh -i $keyfile -l $user -p $port $ip
interact
exit 0
} else {
spawn -noecho $ssh -l $user -p $port $ip
}
}
} else {
puts “
usage
exit 1
}
set excmd2 [scan $excmd “%d”]
set len1 [string length $excmd]
set len2 [string length $excmd2]
if { $len1 == $len2 && $len1 != “0” } {
while { $excmd != “0” } {
send – “\r”
set excmd [expr $excmd - 1]
}
}
expect {
eof { puts “
timeout { puts “
“$pwd_pmt” handle_pwd
“name:” handle_user
“ogin:” handle_user
“as:” handle_user
“$login_pmt” handle_user
}
if { $mode == “1” } {
stty raw < $spawn_out(slave,name)
}
interact
exit 0
trap 1 2 3
pathmunge () {
if ! echo $PATH | /bin/egrep -q “(^|:)$1($|:)” ; then
if [ “$2” = “after” ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}
ANT_HOME=/usr/local/ant
JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0
export PATH=${PATH}:${ANT_HOME}/bin
if [ -z “$EUID” -a -x /usr/bin/id ]; then
EUID=id -u
UID=id -ru
fi
if [ “$EUID” = “0” ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi
ulimit -S -c 0 > /dev/null 2>&1
if [ -x /usr/bin/id ]; then
USER=”id -un
“
LOGNAME=$USER
MAIL=”/var/spool/mail/$USER”
fi
HOSTNAME=/bin/hostname
HISTSIZE=1000
if [ -z “$INPUTRC” -a ! -f “$HOME/.inputrc” ]; then
INPUTRC=/etc/inputrc
fi
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC
for i in /etc/profile.d/*.sh ; do
if [ -r “$i” ]; then
if [ “$PS1” ]; then
. $i
else
. $i >/dev/null 2>&1
fi
fi
done
unset i
unset pathmunge
export TMOUT=300
export CENTRALHOST=127.0.0.1:1381
umask 027
if [ $USER != root -a $USER != “sradmin” ]; then
#/usr/local/bin/srssh
/usr/local/bin/hostmenu
exit
fi