版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
【移動(dòng)應(yīng)用開發(fā)技術(shù)】Nagios配合飛信發(fā)短信
nagios的安裝在此頁面
/6205307/1403997
提示:飛信接口已經(jīng)不可用nagios要添加飛信報(bào)警功能,盡管網(wǎng)上有很多教程,不過許多都需要瞎折騰才能正常用飛信,所以下面記錄一下,供參考系統(tǒng)centos6.464位安裝飛信下載地址
/s/1sXpGj
找到linux安裝包
>飛信>fetiontar.zip#
unzip
fetiontar.zip
#
cd
fetiontar
#
ls
fetion
lib
#
mkdir
/usr/local/fetion
#
cp
fetion
/usr/local/fetion/
#
chmod
755
/usr/local/fetion/fetion#
ls
lib/
#lib文件夾下的so文件
ld-2.5.so
libcap.so.1
libcrypt.so.1
libpcre.so.0.0.1
ld-linux.so.2
libcap.so.1.10
libc.so.6
libproc-3.2.7.so
ld-lsb.so.3
libcidn-2.5.so
libeay32.dll
libpthread-2.5.so
ld.so.conf
libcidn.so.1
libnss_ldap-2.5.so
libpthread.so.0
libACE-5.6.5.so
libcom_err.so.2
libnss_ldap.so.2
libssl.so.0.9.7a
libACE-5.6.8.so
libcom_err.so.2.1
libpamc.so.0
libssl.so.0.9.8
libACE-5.7.2.so
libcrypt-2.5.so
libpamc.so.0.81.0
libssl.so.4
libACE_SSL-5.6.5.so
libcrypto.so.0.9.7a
libpam_misc.so.0
libstdc++.so.6
libACE_SSL-5.6.8.so
libcrypto.so.0.9.8
libpam_misc.so.0.81.2
libstdc++.so.6.0.8
libACE_SSL-5.7.2.so
libcrypto.so.0.9.8b
libpam.so.0
readme
libc-2.5.so
libcrypto.so.4
libpam.so.0.81.5
libcap.so
libcrypto.so.6
libpcre.so.0設(shè)置fetion的庫文件#
cp
-r
lib/
/lib64/fetion
#
vim
/etc/ld.so.conf.d/fetion.conf
/lib64/fetion#
ldconfig
-v|grep
fetion
ldconfig:
/etc/ld.so.conf.d/kernel-2.6.32-431.11.2.el6.x86_64.conf:6:
duplicate
hwcap
1
nosegneg
ldconfig:
/lib64/fetion/libstdc++.so.6
is
not
a
symbolic
link
ldconfig:
/lib64/fetion/libpamc.so.0
is
not
a
symbolic
link
ldconfig:
/lib64/fetion/libpam_misc.so.0
is
not
a
symbolic
link
ldconfig:
/lib64/fetion/libpcre.so.0
is
not
a
symbolic
link
ldconfig:
/lib64/fetion/ld-linux.so.2
is
not
a
symbolic
link
ldconfig:
/lib64/fetion/libcom_err.so.2
is
not
a
symbolic
link
ldconfig:
/lib64/fetion/libcap.so.1
is
not
a
symbolic
link
ldconfig:
/lib64/fetion/libpam.so.0
is
not
a
symbolic
link
/lib64/fetion:查看缺少哪些庫,然后依次安裝#
ldd
/usr/local/fetion/fetion
linux-gate.so.1
=>
(0x00e41000)
libACE-5.7.2.so
=>
/lib64/fetion/libACE-5.7.2.so
(0x007ec000)
libACE_SSL-5.7.2.so
=>
/lib64/fetion/libACE_SSL-5.7.2.so
(0x002ad000)
libssl.so.4
=>
/lib64/fetion/libssl.so.4
(0x0069d000)
libstdc++.so.6
=>
/lib64/fetion/libstdc++.so.6
(0x004f8000)
libm.so.6
=>
/lib/libm.so.6
(0x00c7d000)
libgcc_s.so.1
=>
/lib/libgcc_s.so.1
(0x00dfe000)
libc.so.6
=>
/lib/libc.so.6
(0x002c2000)
libcrypto.so.4
=>
/lib64/fetion/libcrypto.so.4
(0x03e4a000)
librt.so.1
=>
/lib/librt.so.1
(0x001d0000)
libdl.so.2
=>
/lib/libdl.so.2
(0x001d9000)
libgssapi_krb5.so.2
=>
not
found
libkrb5.so.3
=>
not
found
libcom_err.so.2
=>
/lib64/fetion/libcom_err.so.2
(0x001de000)
libk5crypto.so.3
=>
not
found
libresolv.so.2
=>
/lib/libresolv.so.2
(0x001e1000)
/lib/ld-linux.so.2
(0x0070f000)
libz.so.1
=>
not
found
libgssapi_krb5.so.2
=>
not
found
libkrb5.so.3
=>
not
found
libk5crypto.so.3
=>
not
found
libz.so.1
=>
not
found
libpthread.so.0
=>
/lib/libpthread.so.0
(0x0079e000)如果缺少libgcc_s.so.1,出現(xiàn)下面情況,那么
yuminstalllibgcc_s.so.1#
/usr/local/fetion/fetion
/usr/local/fetion/fetion:
error
while
loading
shared
libraries:
libgcc_s.so.1:
cannot
open
shared
object
file:
No
such
file
or
directory#
yum
install
krb5-libs
libgssapi_krb5.so.2
libz.so.1
-y
#
/usr/local/fetion/fetion
************************
IMPORTANT
STATEMENT
************************
**
**
**
PLEASE
DON'T
USE
THIS
SOFTWARE
TO
SEND
JUNK
SHORT
MESSAGES.
**
**
OTHERWISE
PLEASE
BEAR
YOUR
OWN
CONSEQUENCES.
**
**
**
**
Version:[20101205002-linux]
**
*********************************************************************
This
program
is
the
console
version
of
China
Fetion!
It's
free
for
personal
user.
This
project
website:
/
AUTHOR:KelvinH
MSN/EMAIL:shichangguo@
Usage:
--mobile=[mobile]
--sid=[sid]
--pwd=[pwd]
--config=[config
file]
*format:index
mobile
password
--index=[index
no
in
config
file,refer
to
sample.conf]
--debug
*debug
mode
on
--hide
*login
fetion
in
hidden
state
--to=[mobile/sid]
--command-path=[command
file
path]
--robotmode
--daemon(linux
only)
--proxy-ip(http
proxy
ip)
--proxy-port(http
proxy
port)
--msg-gb=[gb2312/gbk
message]
--msg-utf8=[utf8
message]
--msg-type=[0/1/2
sms
longsms
smartmsg]
--file-gb=[gb2312/gbk
file]
--file-utf8=[utf8
file]
--query-cmcc-no
--auto-retry
--exit-on-verifycode
--t3key=[/page/smssend/]ok,飛信已經(jīng)安裝好了,下面測(cè)試#/usr/local/fetion/fetion--mobile=你的手機(jī)號(hào)--pwd=飛信密碼--to=對(duì)方的手機(jī)號(hào)--msg-utf8="hello
hero"HTTP/1.1200OKConnection:closeDate:Sat,23Aug201409:50:19GMTServer:Microsoft-IIS/6.0X-Powered-By:ASP.NETContent-Location:X-AspNet-Version:4.0.30319Cache-Control:privateContent-Type:text/html;charset=utf-8Content-Length:2473<?xmlversion="1.0"encoding="UTF-8"?><results><pic-certificateid="f9c6154e-1e8f-4fe5-bb54-61b6ac4a3a85"pic="*****(省略)"#這里是提示輸入驗(yàn)證碼,驗(yàn)證碼到目錄,即下面的手機(jī)號(hào).jpg文件#cd/usr/local/fetion/#ls1591425****.cache
1591425****.jpg
fetion下面就可以給飛信的好友發(fā)送信息了#/usr/local/fetion/fetion--mobile=1591425****--pwd=******--to=******--msg-utf8="hello
hero,youareaman"SIP-C/4.0280SendSMSOKT:sip:1056282019@;p=7019I:3Q:1MRQ:56602213092L:112XI:7df854ffd4ff4abeb840b878110fec25以上確定飛信可以正常使用,下面詳細(xì)說明配置內(nèi)容下面幾個(gè)配置文件相互關(guān)聯(lián),commands.cfg中定義飛信發(fā)送短信的命令,contacts.cfg中說明發(fā)送短信的用戶和組,templates.cfg定義觸發(fā)后要執(zhí)行的動(dòng)作,比如發(fā)飛信或郵件,什么時(shí)候發(fā),用那個(gè)用戶發(fā)送,timeperiods.cfg定義時(shí)間,工作日或者7x24,這里我使用默認(rèn)的7x24,linuxhost.cfg為自己創(chuàng)建的文件,定義監(jiān)控的服務(wù)和主機(jī),監(jiān)控的動(dòng)作cd
/usr/local/nagios/etc/objects
commands.cfg
#定義飛信的發(fā)送命令
define
command
{
command_name
notify-host-by-fetion
command_line
/usr/local/fetion/fetion
--mobile=1591425****
--pwd=123456
--to=1591425****
--msg-utf8="$NOTIFICATIONTYPE$\nHost:
$HOSTNAME$\nState:
$HOSTSTATE$\nAddress:
$HOSTADDRESS$\nInfo:
$HOSTOUTPUT$\n\nDate/Time:
$LONGDATETIME$\n"
--msg-type=1
}
define
command
{
command_name
notify-service-by-fetion
command_line
/usr/local/fetion/fetion
--mobile=1591425****
--pwd=123456
--to=1591425****
--msg-utf8="$NOTIFICATIONTYPE$\nHost:
$HOSTNAME$\nState:
$HOSTSTATE$\nAddress:
$HOSTADDRESS$\nInfo:
$HOSTOUTPUT$\n\nDate/Time:
$LONGDATETIME$\n"
--msg-type=1
}contacts.cfg
#創(chuàng)建用戶和用戶組,定義使用飛信發(fā)送通知信息
define
contact{
contact_name
linux
use
linux-contact
alias
linux
server1
service_notification_period
24x7
host_notification_period
24x7
service_notification_options
w,u,c,r,f,s
host_notification_options
d,u,r,f,s
service_notification_commands
notify-service-by-fetion
host_notification_commands
notify-host-by-fetion
}
define
contactgroup{
contactgroup_name
linux
alias
linux
group1
members
linux
}templates.cfg
#在模板中定義檢測(cè)后所要執(zhí)行的選擇
define
contact{
name
linux-contact
service_notification_period
24x7
host_notification_period
24x7
service_notification_options
w,u,c,r,f,s
host_notification_options
d,u,r,f,s
service_notification_commands
notify-service-by-fetion
host_notification_commands
notify-host-by-fetion
register
0
}
define
host{
name
mylinux-server
use
generic-host
check_period
24x7
check_interval
5
retry_interval
1
max_check_attempts
10
check_command
check-host-alive
notification_period
24x7
notification_interval
120
notification_options
d,u,r
contact_groups
linux
register
0
}
define
service{
name
linux-service
active_checks_enabled
1
passive_checks_enabled
1
parallelize_check
1
obsess_over_service
1
check_freshness
0
notifications_enabled
1
event_handler_enabled
1
flap_detection_enabled
1
failure_prediction_enabled
1
process_perf_data
1
retain_status_information
1
retain_nonstatus_information
1
is_volatile
0
check_period
24x7
max_check_attempts
3
normal_check_interval
1
retry_check_interval
2
contact_groups
linux
notification_options
w,u,c,r
notification_interval
60
notification_period
24x7
register
0
}linuxhost.cfg
#定義主機(jī)和監(jiān)控的服務(wù)
define
host{
use
mylinux-server
host_name
webserver1
alias
webserver1
address
41
}
define
hostgroup{
hostgroup_name
group1
alias
Linux
group1
members
webserver1
}
define
service{
use
linux-service
host_name
webserver1
service_description
check
users
check_command
check_nrpe!check_users
}
define
service{
use
linux-service
host_name
webserver1
service_description
check
load
check_command
check_nrpe!check_load
}
define
service{
use
linux-service
host_name
webserver1
service_description
check
zombie
proce
check_command
check_nrpe!check_zombie_procs
}
define
service{
use
linux-service
host_name
webserver1
service_description
check
total
proce
check_command
check_nrpe!check_total_procs
}
define
service{
use
linux-service
host_name
webserver1
service_description
check
rootdisk
check_command
check_nrpe!check_rootdisk
}
define
service{
use
linux-service
host_name
webserver1
service_description
check
swap
check_command
check_nrpe!check_swap
}
define
service{
use
linux-service
host_name
webserver1
service_description
check
sda1
check_command
check_nrpe!check_sda1
}
define
service{
use
linux-service
host_name
webserver1
service_description
check
sda3
check_command
check_nrpe!check_sda3
}
define
service{
use
linux-service
host_name
webserver1
service_description
check
mysql
check_command
check_nrpe!check_mysql
}測(cè)試service發(fā)送短信:被監(jiān)控端user設(shè)置check_users-w3-c3現(xiàn)在5人登錄,稍后再登出nagios日志,SERVICENOTIFICATION:linux;webserver1;checkusers;CRITICAL;notify-service-by-fetion;USERSCRITICAL-5userscurrentlyloggedin[1409704648]
SERVICE
ALERT:
webserver1;check
users;CRITICAL;SOFT;1;USERS
CRITICAL
-
4
users
currently
logged
in
[1409704768]
SERVICE
ALERT:
webserver1;check
users;CRITICAL;SOFT;2;USERS
CRITICAL
-
5
users
currently
logged
in
[1409704888]
SERVICE
ALERT:
webserver1;check
users;CRITICAL;HARD;3;USERS
CRITICAL
-
5
users
currently
logged
in
[1409704888]
SERVICE
NOTIFICATION:
linux;webserver1;check
users;CRITICAL;notify-service-by-fetion;USERS
CRITICAL
-
5
users
currently
logged
in
[1409704948]
SERVICE
ALERT:
webserver1;check
users;OK;HARD;3;USERS
OK
-
1
users
currently
logged
in
[1409704948]
SERVICE
NOTIFICATION:
linux;webserver1;check
users;OK;notify-service-by-fetion;USERS
OK
-
1
users
currently
logged
in測(cè)試host發(fā)送短信:把被監(jiān)控端關(guān)機(jī)的nagios日志,HOSTNOTIFICATION:linux;webserver1;DOWN;notify-host-by-fetion;CRITICAL-HostUnreachable(41)[1409705298]
HOST
ALERT:
webserver1;DOWN;HARD;10;CRITICAL
-
Host
Unreachable
(41)
[1409705298]
HOST
NOTI
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025-2030年中國(guó)旅游度假區(qū)行業(yè)資本規(guī)劃與股權(quán)融資戰(zhàn)略制定與實(shí)施研究報(bào)告
- 2025-2030年中國(guó)咖啡館行業(yè)并購(gòu)重組擴(kuò)張戰(zhàn)略制定與實(shí)施研究報(bào)告
- 新形勢(shì)下金融押運(yùn)行業(yè)快速做大市場(chǎng)規(guī)模戰(zhàn)略制定與實(shí)施研究報(bào)告
- 2025-2030年中國(guó)商用廚房電器行業(yè)全國(guó)市場(chǎng)開拓戰(zhàn)略制定與實(shí)施研究報(bào)告
- 2025-2030年中國(guó)汽車分時(shí)租賃行業(yè)全國(guó)市場(chǎng)開拓戰(zhàn)略制定與實(shí)施研究報(bào)告
- 2025-2030年中國(guó)鈷行業(yè)開拓第二增長(zhǎng)曲線戰(zhàn)略制定與實(shí)施研究報(bào)告
- 關(guān)于大學(xué)生對(duì)學(xué)校組織愛心活動(dòng)的關(guān)注及其背后真實(shí)心理的調(diào)查
- 國(guó)有企業(yè)2024年工作情況總結(jié)及2025年工作計(jì)劃
- 2024-2030年中國(guó)金融系列行業(yè)市場(chǎng)全景分析及投資前景展望報(bào)告
- 電力工程招投標(biāo)過程中的風(fēng)險(xiǎn)分析與管理措施
- 中建醫(yī)療工程交付指南
- 2024年甘肅省職業(yè)院校技能大賽養(yǎng)老照護(hù)(中職學(xué)生組)賽項(xiàng)樣題1
- 圓圈正義讀書分享課件
- 人教版數(shù)學(xué)二年級(jí)下冊(cè)全冊(cè)核心素養(yǎng)目標(biāo)教學(xué)設(shè)計(jì)
- 《無人機(jī)駕駛航空試驗(yàn)基地(試驗(yàn)區(qū))基礎(chǔ)設(shè)施使用、管理規(guī)范(征求意見稿)》
- 寵物醫(yī)療行業(yè)人力資源管理戰(zhàn)略研究
- 《了凡四訓(xùn)》略說教學(xué)課件
- 項(xiàng)目15-1 蛋黃中免疫球蛋白的提取
- 品牌運(yùn)營(yíng)部工作職責(zé)
- 產(chǎn)褥期的生理變化
- 土壤肥料學(xué)智慧樹知到期末考試答案2024年
評(píng)論
0/150
提交評(píng)論