[Shell] monitor filesystem
oracle6機器是收集filesystem的機器,訪問其他的linux伺服器
按照monitor cpu&mem的順序,
配置/etc/hosts,建立user,配置ssh
1.建立table
Table created.SQL> create table mon_filesystem
2 (hostname varchar2(20),
3 filesystem varchar2(100),
4 allbytes varchar2(30),
5 usebytes varchar2(30),
6 freebytes varchar2(30),
7 usepct varchar2(10),
8 mounton varchar2(100),
9 mon_datetime varchar2(50)
10 );
2.shell script
[mon@oracle6 source]$ more mon_filesystem
#!/bin/bash
export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=xxxxxdb
DATETIME=`date +"%Y/%m/%d %H:%M:%S"`
HOSTNAME=/home/mon/source/mon_cpumem_hostname
FILESYSTEM=/home/mon/data/filesystem.txt
cat $HOSTNAME | while
read LINE
do
echo "df -P" | ssh -Tq mon@$LINE > $FILESYSTEM
cat $FILESYSTEM | grep % | grep -v .gvfs | while
read NLINE
do
FILESYSTEM=`echo $NLINE | awk '{print $1}'`
ALLBYTES=`echo $NLINE | awk '{print $2}'`
USEBYTES=`echo $NLINE | awk '{print $3}'`
FREEBYTES=`echo $NLINE | awk '{print $4}'`
USEPCT=`echo $NLINE | awk '{print $5}'`
MOUNTON=`echo $NLINE | awk '{print $6}'`
$ORACLE_HOME/bin/sqlplus -s mon/mon << EOF >> /home/mon/log/mon_filesystem.log
insert into mon_filesystem values ('$LINE','$FILESYSTEM','$ALLBYTES','$USEBYTES','$FREEBYTES','$USEPCT','$MOUNTON','$DATETIME');
commit;
exit;
EOF
done
done
3.定時任務crontab
[mon@oracle6 source]$ crontab -l
13 7,15,23 * * * /home/mon/source/mon_filesystem > /dev/null 2>&1
按照monitor cpu&mem的順序,
配置/etc/hosts,建立user,配置ssh
1.建立table
Table created.SQL> create table mon_filesystem
2 (hostname varchar2(20),
3 filesystem varchar2(100),
4 allbytes varchar2(30),
5 usebytes varchar2(30),
6 freebytes varchar2(30),
7 usepct varchar2(10),
8 mounton varchar2(100),
9 mon_datetime varchar2(50)
10 );
2.shell script
[mon@oracle6 source]$ more mon_filesystem
#!/bin/bash
export ORACLE_BASE=/u01/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=xxxxxdb
DATETIME=`date +"%Y/%m/%d %H:%M:%S"`
HOSTNAME=/home/mon/source/mon_cpumem_hostname
FILESYSTEM=/home/mon/data/filesystem.txt
cat $HOSTNAME | while
read LINE
do
echo "df -P" | ssh -Tq mon@$LINE > $FILESYSTEM
cat $FILESYSTEM | grep % | grep -v .gvfs | while
read NLINE
do
FILESYSTEM=`echo $NLINE | awk '{print $1}'`
ALLBYTES=`echo $NLINE | awk '{print $2}'`
USEBYTES=`echo $NLINE | awk '{print $3}'`
FREEBYTES=`echo $NLINE | awk '{print $4}'`
USEPCT=`echo $NLINE | awk '{print $5}'`
MOUNTON=`echo $NLINE | awk '{print $6}'`
$ORACLE_HOME/bin/sqlplus -s mon/mon << EOF >> /home/mon/log/mon_filesystem.log
insert into mon_filesystem values ('$LINE','$FILESYSTEM','$ALLBYTES','$USEBYTES','$FREEBYTES','$USEPCT','$MOUNTON','$DATETIME');
commit;
exit;
EOF
done
done
3.定時任務crontab
[mon@oracle6 source]$ crontab -l
13 7,15,23 * * * /home/mon/source/mon_filesystem > /dev/null 2>&1
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24237320/viewspace-2015510/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- PHP Filesystem 簡介PHP
- 2788647047_monitor
- 無法寫入檔案 Filesystem
- Postman的Monitor功能Postman
- Verilog 監控 Monitor
- 使用 Laravel-filesystem-oss web 直傳LaravelWeb
- go-filesystem 檔案管理器Go
- Azure Monitor(二)Log Analytics
- error initializing graphdriver: devmapper: Base Device UUID and Filesystem verifErrordevAPPUI
- synchronized的monitor監視器synchronized
- Xamarin Essentials應用教程檔案系統FileSystem
- Oracle 效能調優工具:SQL MonitorOracleSQL
- plsql developer工具生成sql monitor reportSQLDeveloper
- 使用sql monitor獲取更加詳細的執行計劃 - dbms_sqltune.report_sql_monitorSQL
- 「擴充套件包」Laravel-filesystem-oss 2.0 釋出套件Laravel
- 網速監控軟體 Traffic Monitor
- ceph儲存的monitor選舉流程
- 【翻譯】.NET 6 中的 dotnet monitor
- Guava併發:使用Monitor控制併發Guava
- [20190306]11g health monitor.txt
- JDK不同作業系統的FileSystem(unix-like)上篇JDK作業系統
- JDK不同作業系統的FileSystem(unix-like)中篇JDK作業系統
- Xamarin Essentials教程獲取路徑檔案系統FileSystem
- Java併發(十九)----Monitor原理及Synchronized原理Javasynchronized
- Oracle SQL調優系列之SQL Monitor ReportOracleSQL
- 管程(Monitor)概念及Java的實現原理Java
- 通過redis的monitor命令排除故障Redis
- mysql的三個sql的monitor選項MySql
- 使用 dotnet-monitor 分析.NET 應用程式
- MySQL 5.6 遭遇 OS bug INNODB MONITOR OUTPUT 事件MySql事件
- Shell:子shell概念
- 揭露 FileSystem 引起的線上 JVM 記憶體溢位問題JVM記憶體溢位
- 什麼是 Web 應用程式的 synthetic monitorWeb
- 【CURSOR】How to Monitor and tune Open and Cached Cursors (Doc ID 1430255.1)
- Monitor Ctrl-Break執行緒,有點坑執行緒
- Airpods Battery Monitor Mac(AirPods電池監控器)AIBATMac
- 基礎才是重中之重~lock和monitor的區別
- shell——shell輸入輸出
- Shell程式設計-11-子Shell和Shell巢狀程式設計巢狀