為了解決監控ogg運作狀态,更好的進行維護,是以采用腳本的形式讀取ogg運作狀态寫入文本通過tfp指令上傳到指定伺服器(ftp伺服器)進行文本解析,然後再shell腳本寫入指定資料庫。
1、讀取ogg程序狀态寫入文本腳本
cd C:\Users\Administrator\Desktop\ogg(ogg安裝目錄)
(echo info all echo exit)|ggsci|findstr "EXTRACT REPLICAT MANAGER" >> C:\Users\Administrator\Desktop\testogg.txt
:: 設定ftp位址
SET ip_address=xxx.xxx.xx.xx
:: 設定ftp使用者名
SET ftpusername=xx
:: 設定ftp密碼
SET ftppassword=xx
:: FTP檔案路徑(linux)
SET FTPFilePath=xx
:: 本地檔案路徑(windows)
SET localFilePath=xxxx
@Echo Off
Echo open %ip_address% >ftp.up
Echo %ftpusername%>>ftp.up
Echo %ftppassword%>>ftp.up
Echo Cd %FTPFilePath%>>ftp.up
Echo binary>>ftp.up
Echo put "%localFilePath%">>ftp.up
Echo bye>>ftp.up
FTP -s:ftp.up
del ftp.up /q
del C:\Users\Administrator\Desktop\testogg.txt
可能通過ftp上傳檔案,會遇到553 Could not create file.這時候在目标端設定ftp伺服器的ftp的ftpd_full_access配置為on,指令如下setsebool allow_ftpd_full_access on,同時搭建ftp伺服器需要取消匿名模式,将vsftpd.conf中anonymous_enable設定為NO,還需要設定local_root代表你ftp的檔案存放路徑,隻能把檔案上傳到此路徑下,同時設定777權限,否則可能導緻553 Could not create file.還需要配置nopriv_user,這個是用于你ftp上傳所用的使用者名,可以建立個ftp使用者,建議不使用root使用者
2、設定定時任務
window的控制台-->管理工具-->任務計劃程式
然後傻瓜式操作設定定時任務沒什麼特别的地方,進行設定觸發器設定時間次元。