免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 18898 | 回复: 19
打印 上一主题 下一主题

[SCO UNIX] unixware 巡检 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-06-03 11:23 |只看该作者 |倒序浏览
有做过unixware 巡检的吗,主要检查哪些方面

论坛徽章:
0
2 [报告]
发表于 2010-06-03 16:54 |只看该作者
这个问题太笼统了!巡检一般都是和应用系统、数据库相关的!
如果光是对操作系统巡检,最多也就是查看一下系统资源(硬盘空间、垃圾文件等)

论坛徽章:
0
3 [报告]
发表于 2010-06-03 17:56 |只看该作者
本帖最后由 wangdonsy 于 2010-06-07 13:56 编辑

大概写了个脚本,用于收集操作系统和sybase 数据库的信息,由于对unixware 掌握的比较少,很多命令还不太清楚,欢迎各位继续补充和修改,以完善这个脚本.

  1. #!/usr/bin/env sh
  2. #
  3. #Unixware System and Sybase Check Report,write by westmstc@gmail.com
  4. #Version 1.0  2010.06.03
  5. #
  6. ##################################################################
  7. #说明:unixware信息收集和sybase(页面为2K)数据库检查脚本
  8. #在unixware 7.1.1 和 sybase 11.9.2 上测试通过
  9. #欢迎各位继续补充和修改,以完善这个脚本
  10. ##################################################################
  11. VER="Version 1.0"
  12. CUSTNAME="XXX公司XXX服务器"
  13. CKPATH=/tmp/`hostname`report
  14. export CKPATH

  15. if test $LOGNAME != "root"
  16. then
  17.   echo "You must be root to use this script"
  18.   exit
  19. fi

  20. echo "Creating SysReport Folder"
  21. if [ -d $CKPATH ]
  22. then : # if it exists and is a folder do nothing
  23.   else
  24. mkdir -p $CKPATH
  25. fi


  26. # Next we want to create the index.html file whether it exists or not to allow for updating it
  27. # with new versions of the script


  28. ###########################Creating index.html#######################################
  29. echo "Creating index.html"
  30. cat > $CKPATH/index.html << EOF
  31. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
  32. <HTML><HEAD>
  33.         <META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=ISO-8859-1">
  34.         <META NAME="Author" Content="westmstc">
  35.         <TITLE>System Report</TITLE>
  36. </HEAD>
  37. <FRAMESET   COLS = "21%,79% "  >
  38.         <FRAME SRC="navigate.html" NAME="Navigate" RESIZE>
  39.         <FRAME SRC="Introduction.html" NAME="Modules" RESIZE>
  40. </FRAMESET>
  41. <NOFRAMES>
  42. <BODY>
  43. <P>
  44. </BODY>
  45. </NOFRAMES>
  46. </HTML>
  47. EOF

  48. ###########################Creating Introduction.html################################

  49. echo "Creating Introduction.html"
  50. cat > $CKPATH/Introduction.html << EOF
  51. <html><head><meta content="text/html;charset=gb2312" http-equiv="Content-Type">
  52. <title>Introduction to System Report</title></head>
  53. <body>
  54. <center><p><font size="5">XXX公司客户巡检详单</font></center>
  55. <table style="text-align: left; width: 100%;" border="2" cellpadding="2" cellspacing="2">
  56. <tbody><tr>
  57. <td style="vertical-align: top; background-color: rgb(153, 255, 255);">
  58. </td></tr></tbody></table>
  59. <br>
  60. <div class="block">
  61.                 <div align="right">
  62.                 <br><br>
  63.                 </div>
  64.                 <ul>
  65.                 <li><font size="5"><span class="label">客户名称:</span>$CUSTNAME</font></li>
  66.                 <li><font size="5"><span class="label">主机名称:</span>`hostname`</font></li>
  67.     <li><font size="5"><span class="label">巡检时间:</span>`date +"%Y-%m-%d %T %a"`</font></li>
  68.                 <li><font size="5"><span class="label">检测用户:</span>$LOGNAME</font></li>
  69.                 <li><font size="5"><span class="label">脚本版本:</span>$VER</font></li>
  70.                 </ul></div></br>
  71. <table style="text-align: left; width: 100%;" border="2" cellpadding="2" cellspacing="2">
  72. <tbody><tr>
  73. <td style="vertical-align: top; background-color: rgb(153, 255, 255);"></td></tr></tbody></table>
  74. <p align="center"><br>
  75. 说明:对本巡检详单有任何问题,请联系 QQ:xxxxxxxxx  邮箱:xxxxxxxxxxxx</p>
  76. <p align="center"> 联系电话:029-xxxxxxxxxx</br></p></body></html>
  77. EOF

  78. ###########################Creating navigate.html################################
  79. navigate()
  80. {
  81. cat >> $CKPATH/navigate.html << EOF
  82. <li><a href="$1.html " target="Modules">$2</a></li>
  83. EOF
  84. }

  85. htmlfun()
  86. {
  87. echo "Checking  ${1}info"  
  88. cat >> $CKPATH/${1}info.html << EOF
  89. <html><head><meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  90. <title>$1 Information</title></head>
  91. <body>
  92. <table style="text-align: left; width: 100%;" border="2" cellpadding="2"
  93. cellspacing="2">
  94. <tbody>
  95. <tr>
  96. <td style="vertical-align: top; background-color: rgb(153, 153, 255);">
  97. $2
  98. </td></tr>
  99. <tr>
  100. <td style="vertical-align: top; background-color: rgb(153, 255, 255);"><pre>
  101. EOF
  102. # generate the out put from system file
  103. $2  >> $CKPATH/${1}info.html
  104. # add the end of the file
  105. cat >> $CKPATH/${1}info.html << EOF
  106. </pre></td></tr></tbody></table></body></html>
  107. EOF
  108. }

  109. ############################# check operate system info######################

  110. navigate  Introduction  "Introduction to System Report"

  111. ##################hardware info#########################
  112. navigate hardinfo   "Hardware Information"
  113. htmlfun  hard       "hw"
  114. htmlfun  hard       "prtconf"
  115. htmlfun  hard       "sdiconfig -l"

  116. ##################cpu info##############################
  117. navigate cpuinfo   "Cpu Information"
  118. htmlfun  cpu       "/sbin/psrinfo -v"

  119. ##################disk info#############################
  120. navigate diskinfo  "Disk Information"
  121. htmlfun  disk      "df -k"
  122. htmlfun  disk      "dfspace"
  123. htmlfun  disk      "mount -v"
  124. htmlfun  disk      "cat /etc/vfstab"

  125. ##################memory info###########################
  126. navigate meminfo   "Memory  Information"
  127. htmlfun  mem       "prtconf | grep "Memory""
  128. htmlfun  mem       "swap -l"

  129. ##################pcibus  info##########################
  130. navigate pciinfo   "Pcibus  Information"
  131. htmlfun  pci       "hw -r pci"


  132. ##################network  info#########################
  133. navigate netinfo   "Network  Information"
  134. htmlfun  net       "ifconfig -a"
  135. htmlfun  net       "cat /etc/hosts"
  136. htmlfun  net       "cat /etc/resolv.conf"
  137. htmlfun  net       "netstat -rn"
  138. htmlfun  net       "netstat -s"
  139. htmlfun  net       "netstat -in"
  140. htmlfun  net       "netstat -an"


  141. #################op system  info###################
  142. navigate  opsysinfo   "Opsys Information"
  143. htmlfun   opsys       "cat  /etc/issue"
  144. htmlfun   opsys       "uname -acdilmnprsvAX"
  145. htmlfun   opsys       "ulimit -a"
  146. htmlfun   opsys       "uptime"
  147. htmlfun   opsys       "ps -ef"



  148. #################boot  info########################
  149. navigate  bootinfo   "boot Information"
  150. htmlfun   boot       "ls -l /stand"
  151. htmlfun   boot       "cat /stand/boot"



  152. #################cron  info########################
  153. navigate  croninfo   "Cron Information"
  154. htmlfun   cron       "crontab -l"


  155. #################environment info#######################
  156. navigate  envinfo   "Environment Information"
  157. htmlfun   env       "set"
  158. htmlfun   env       "cat /etc/profile"


  159. #################software info##########################
  160. navigate  softinfo   "Software Information"
  161. htmlfun   soft       "pkginfo"

  162. #################logfile  info##########################
  163. navigate  loginfo    "Logfile Information"
  164. htmlfun   log        "cat /etc/syslog.conf"
  165. htmlfun   log        "tail -n 100 /var/adm/syslog"
  166. htmlfun   log        "last"


  167. #######################server performance info###########
  168. navigate   perfinfo        "Performance Information"
  169. htmlfun    perf            "sar"
  170. htmlfun    perf            "sar -d"
  171. htmlfun    perf            "sar -b"
  172. htmlfun    perf            "ipcs"
  173. htmlfun    perf            "ps -eL"


  174. ############################# check sybase database info#####################


  175. ##########################check sybase##################
  176. #           收集sybase 数据库信息
  177. #SYBASE SAPASS DSQUERY 根据实际情况修改
  178. ########################################################
  179. SYBASE=/sybase
  180. DATAPWD=./
  181. SAPASS=stserver
  182. DSQUERY=stserver



  183. PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:${SYBASE}/bin:${SYBASE}/install:/usr/bin/X11:/bin:.
  184. export PATH SYBASE DSQUERY

  185. sa_execsql()
  186. {
  187.   echo $*      >tmp$$
  188.         echo "go"   >>tmp$$
  189.         echo "quit" >>tmp$$
  190.         isql -I ${SYBASE}/interfaces -P ${SAPASS}  -Usa -w2000  -Jiso_1 -S ${DSQUERY} -s'|' -itmp$$ -oinfo.dat
  191.         rm -f tmp$$
  192. }

  193. ########################sybstatus info##################
  194. navigate   sybinfo        "Sybase Status Information"
  195. htmlfun    syb            "showserver"
  196. sa_execsql "select @@version"
  197. htmlfun    syb            "cat info.dat"

  198. ########################database info###################
  199. navigate   dbinfo        "Database  Information"
  200. sa_execsql "sp_helpdb"
  201. htmlfun    db            "cat info.dat"

  202. ########################dbsize info###################
  203. navigate   dbsizeinfo        "Databasesize  Information"
  204. isql -I ${SYBASE}/interfaces -P ${SAPASS}  -Usa -w2000 -Jiso_1  -S ${DSQUERY} -s'|' -oinfo.dat <<EOF
  205. set nocount on
  206. go
  207. use master
  208. go
  209. select getdate() "update date:"
  210. go
  211. select dbid, db_name(dbid) "dbname",
  212.     convert(numeric(10,2),sum(size) / 512.0) "dbsizeMB",
  213.     convert(numeric(10,2),sum (case when segmap&~4=0 then 0 else size end) / 512.0) "datadevsizeMB",
  214.     convert(numeric(10,2),sum (case when segmap&~4=0 then 0 else unreservedpgs end) / 512.0) "datadevfreeMB",
  215.     convert(numeric(10,2),100.0 * (sum (case when segmap&~4=0 then 0 else unreservedpgs end) / 512.0) / (0.000000001+sum (case when segmap&~4=0 then 0 else size end) / 512.0)) "datadevfree%",
  216.     convert(numeric(10,2),sum (case when segmap=4 then size else 0 end) / 512.0) "logdevsizeMB",
  217.     convert(numeric(10,2),sum (case when segmap=4 then unreservedpgs else 0 end) / 512.0) "logdevfreeMB",
  218.     convert(numeric(10,2),100.0 * (sum (case when segmap=4 then unreservedpgs else 0 end) / 512.0) / (0.0000001+sum (case when segmap=4 then size else 0 end) / 512.0)) "logdevfree%"
  219. from sysusages group by dbid
  220. go
  221. exit
  222. go
  223. EOF
  224. htmlfun    dbsize            "cat info.dat"

  225. ########################sybase device info##############
  226. navigate   devinfo        "Sybase Device  Information"
  227. sa_execsql  "sp_helpdevice"
  228. htmlfun    dev            "cat info.dat"

  229. ########################sybase config info##############
  230. navigate   confinfo        "Sybase Config  Information"
  231. sa_execsql "sp_configure"
  232. htmlfun    conf            "cat info.dat"

  233. ########################sybase sysmon info##############
  234. #navigate   dbmoninfo        "Sybase Sysmon  Information"
  235. #sa_execsql  "sp_sysmon '00:01:00' "
  236. #htmlfun    dbmon            "cat info.dat"


  237. ########################sybase proc info################
  238. navigate   procinfo        "Sybase Proc Information"
  239. sa_execsql  "sp_who"
  240. htmlfun    proc         "cat info.dat"

  241. ########################sybase log info#################
  242. navigate   sybloginfo        "Sybase log Information"
  243. htmlfun    syblog            "tail -n 500  $SYBASE/install/errorlog"



  244. ############################# collect system log file    #####################



  245. ####################### collect system log ############
  246. mkdir -p $CKPATH/log
  247. cp -r /var/adm/syslog $CKPATH/log


  248. #########################tar SysSybreport dir###########
  249. cd  $CKPATH
  250. tar -cvf -  *  | compress >  ${CKPATH}`date +"%Y-%m-%d"`.Z
  251. cd  ..
  252. rm -rf info.dat
  253. rm -rf $CKPATH

复制代码

论坛徽章:
0
4 [报告]
发表于 2010-06-04 23:54 |只看该作者
不错,支持一下!

论坛徽章:
0
5 [报告]
发表于 2010-08-07 15:42 |只看该作者
收藏!!!

论坛徽章:
0
6 [报告]
发表于 2010-08-17 23:47 |只看该作者
一看就是准备对现代化支付做巡检。

论坛徽章:
0
7 [报告]
发表于 2010-09-22 13:37 |只看该作者
一看就晕倒

论坛徽章:
0
8 [报告]
发表于 2010-09-22 14:01 |只看该作者
一看就晕倒
sunfirewang 发表于 2010-09-22 13:37


晕倒后起来慢慢学!

论坛徽章:
0
9 [报告]
发表于 2010-10-07 15:24 |只看该作者
晕倒后起来慢慢学!
saintdragon 发表于 2010-09-22 14:01



   

论坛徽章:
0
10 [报告]
发表于 2010-10-08 11:20 |只看该作者
下次雁联公司来做巡检的时候看看他们检查的项目和楼主有啥区别
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP