作为devops没有任何经验,我刚刚得到了一个项目,我必须完成整个事情。
那么,我如何关注磁盘,内存,数据库空间和访问时间,api回复时间等的使用情况?
答案 0 :(得分:0)
您可以使用Window Performance Analyzer。 Xperf也很有帮助。 这是相同的链接。
https://msdn.microsoft.com/en-us/library/windows/hardware/hh162945.aspx
答案 1 :(得分:0)
#!/bin/sh
file="/var/www/html/index.html"
linebreak="--------------------------------------------------------------------------------------------"
while true
do
echo "<html>" > $file
echo "<head>" >> $file
echo "<meta http-equiv="refresh" content="100">" >> $file
echo "</head>" >> $file
echo "<body>" >> $file
echo "<pre>" >> $file
date >> $file
echo $linebreak >> $file
uptime >> $file
echo $linebreak >> $file
top -b -n1 -u nobody | sed -n '3p' >> $file
echo $linebreak >> $file
free -m >> $file
echo $linebreak >> $file
df -h >> $file
echo $linebreak >> $file
iptables -nL >> $file
echo $linebreak >> $file
echo "</pre>" >> $file
echo "</body>" >> $file
echo "</html>" >> $file
sleep 100
done
我使用此脚本来监控温度,磁盘使用情况,内存,防火墙等信息。
我把结果放在apache的索引中。所以我可以打电话给服务器的主页,看看一切。
脚本每100秒刷新一次结果。网页也会每100秒刷新一次。
使用这些脚本和apache,您可以使用移动设备或PC监控全球的服务器。
Mo 28. Aug 14:36:03 CEST 2017 -------------------------------------------------------------------------------------------- 14:36:03 up 1:34, 4 users, load average: 0,10, 0,09, 0,11 -------------------------------------------------------------------------------------------- %Cpu(s): 14,8 us, 1,6 sy, 0,7 ni, 82,2 id, 0,5 wa, 0,0 hi, 0,1 si, 0,0 st -------------------------------------------------------------------------------------------- total used free shared buff/cache available Mem: 3949 1027 756 74 2165 2542 Swap: 4093 0 4093 -------------------------------------------------------------------------------------------- Filesystem Size Used Avail Use% Mounted on udev 2,0G 0 2,0G 0% /dev tmpfs 395M 6,0M 389M 2% /run /dev/sda1 21G 6,2G 14G 32% / tmpfs 2,0G 43M 1,9G 3% /dev/shm tmpfs 5,0M 4,0K 5,0M 1% /run/lock tmpfs 2,0G 0 2,0G 0% /sys/fs/cgroup Sharepoint 476G 300G 176G 64% /media/sf_Sharepoint tmpfs 395M 92K 395M 1% /run/user/1000 -------------------------------------------------------------------------------------------- Chain INPUT (policy ACCEPT) target prot opt source destination Chain FORWARD (policy ACCEPT) target prot opt source destination Chain OUTPUT (policy ACCEPT) target prot opt source destination --------------------------------------------------------------------------------------------
答案 2 :(得分:0)
任何管理员都必须始终关注正在运行的进程,这就是Server Monitory随手可得的地方。
尝试使用Monit,可以通过以下方式轻松安装:
apt-get install monit -y
nano /etc/monit/monitrc
使用示例配置来配置您要监控的内容,也可以通过http或https访问,此外您不需要访问它,因为如果您的服务器出现任何问题,它会提醒您。例如,如果您的内存消耗高于您在上面的配置文件中指定的内存消耗,或者CPU过载或某个网站关闭,您将收到一封电子邮件。
让我们深入研究一下。
输入monit status
以获取如下状态:
The Monit daemon 5.3.2 uptime: 1h 32m
System 'myhost.mydomain.tld'
status Running
monitoring status Monitored
load average [0.03] [0.14] [0.20]
cpu 3.5%us 5.9%sy 0.0%wa
memory usage 26100 kB [10.4%]
swap usage 0 kB [0.0%]
data collected Thu, 30 Aug 2017 18:35:00
File 'mysql_bin'
status Accessible
monitoring status Monitored
permission 755
uid 0
gid 0
timestamp Fri, 05 May 2017 22:33:39
size 16097088 B
checksum 6d7b5ffd8563f8ad44dde35ae4b8bd52 (MD5)
data collected Mon, 28 Aug 2017 06:21:02
File 'apache_rc'
status Accessible
monitoring status Monitored
permission 755
uid 0
gid 0
timestamp Fri, 05 May 2017 11:21:22
size 9974 B
checksum 55b2bc7ce5e4a0835877dbfd98c2646b (MD5)
data collected Mon, 28 Aug 2017 06:21:02
Filesystem 'Server01'
status Accessible
monitoring status Monitored
permission 660
uid 0
gid 6
filesystem flags 0x1000
block size 4096 B
blocks total 5006559 [19556.9 MB]
blocks free for non superuser 2615570 [10217.1 MB] [52.2%]
blocks free total 2875653 [11233.0 MB] [57.4%]
inodes total 1281120
inodes free 1085516 [84.7%]
data collected Mon, 28 Aug 2017 06:23:02
Filesystem 'Media'
status Accessible
monitoring status Monitored
permission 660
uid 0
gid 6
filesystem flags 0x1000
block size 4096 B
blocks total 4414923 [17245.8 MB]
blocks free for non superuser 3454811 [13495.4 MB] [78.3%]
blocks free total 3684839 [14393.9 MB] [83.5%]
inodes total 1130496
inodes free 1130384 [100.0%]
data collected Mon, 28 Aug 2017 06:23:02
System 'mywebsite.com'
status Resource limit matched
monitoring status Monitored
load average [0.01] [0.10] [0.61]
cpu 2.7%us 0.2%sy 0.0%wa
memory usage 1150372 kB [28.5%]
swap usage 184356 kB [35.2%]
data collected Mon, 28 Aug 2017 06:21:02
不要忘记,您将收到指定要监控的每条规则的电子邮件提醒,例如当您的网站“ mywebsite ”关闭时,或者当磁盘空间小于20%时,或磁盘故障,cpu超过x%等。
man monit