一、条件测试与比较1、test测试表达式常用test-ffile&&echotrue||echofalse2、[测试表达式]特别常用[-ffile]&&echotrue||echofalse3、[[测试表达式]]二、流程控制1、流控制语句if实例1#!/bin/bash#获取uid=0(root)中的0;id=id|awk-F‘[=(]‘‘{
分类:
系统相关 时间:
2019-09-01 14:46:45
阅读次数:
156
关于在zabbix监测脚本中使用ps命令监控进程CPU使用率和内存使用率,获得数据为0的情况描述
分类:
系统相关 时间:
2018-05-31 16:43:00
阅读次数:
749
监控网卡7种状态#!/bin/bash
functionSYNRECV{
/usr/sbin/ss-s|grep‘synrecv‘|awk‘{print$2}‘
}
functionESTAB{
/usr/sbin/ss-s|grep‘estab‘|awk‘{print$2}‘
}
functionFINWAIT1{
/usr/sbin/ss-o|grep‘FIN-WAIT-1‘|wc-l
}
functionFINWAIT2{
/usr/sbin/ss-ant|grep‘FIN-WAIT-2‘..
分类:
其他好文 时间:
2017-05-18 01:26:30
阅读次数:
149
[root@vt52zabbix_agentd.d]#catcoreservice.confUserParameter=coreservice.status,bash../shell/coreservice.sh上面是错误的[root@vt52zabbix_agentd.d]#catcoreservice.confUserParameter=coreservice.status,bash/etc/zabbix/shell/coreservice.sh[root@vt52zabbix_agentd...
分类:
其他好文 时间:
2017-04-25 14:49:45
阅读次数:
94
[root@va3zabbix_agentd.d]#catpingyz.conf
UserParameter=ping.time[*],bash/etc/zabbix/shell/pingyztime.sh$1
UserParameter=ping.loss[*],bash/etc/zabbix/shell/pingyzloss.sh$1
[root@va3zabbix_agentd.d]#cat../shell/
cut-log.shiosstatus.shnginx_status.shping2.shpi..
分类:
其他好文 时间:
2017-03-28 22:16:57
阅读次数:
236
[root@yzshell]#catpingsmtpexmail.sh
#!/bin/bash
echo"">>/etc/zabbix/shell/pingsmtpexmail.log
echo"">>/etc/zabbix/shell/pingsmtpexmail.log
echo"===========================================================================">>/etc/zabbix/shell/..
分类:
其他好文 时间:
2017-03-13 16:53:16
阅读次数:
151
[root@yzshell]#catpingsmtpexmail.sh
#!/bin/bash
echo"">>/etc/zabbix/shell/pingsmtpexmail.log
echo"">>/etc/zabbix/shell/pingsmtpexmail.log
echo"===========================================================================">>/etc/zabbix/shell/..
分类:
其他好文 时间:
2017-03-13 16:52:58
阅读次数:
107
最近有朋友问我怎么监控公司网站:目的是网站不能访问及时报警。当然一些云服务器肯定是自带功能,可是物理服务器可没有那么智能,但是开源是强大的,这里就分享一下个人监控网站的两种方式。一、zabbix自带的web检测:1.1)配置>主机(需联网)>web场景>创建web场景..
分类:
Web程序 时间:
2017-02-08 00:26:39
阅读次数:
2017
因为领导提出需要每天看几次服务器的流量图,今天早上9点上班开始截图,十多台服务器、指定时间12小时流量图,截完图反复对照好几遍,一是怕选错主机,二是怕搞错时间段。使用zabbix时间不长,一直感觉很别扭,容易出错。加上中间还做了一点其他东西的统计,最后等邮件发出的时..
分类:
系统相关 时间:
2016-06-17 00:51:45
阅读次数:
1758
#!/bin/bash
PROGNAME=$(basename$0)
#####Helperfunctions
functionusage
{
echo"ThisscriptaddsWEBchecksfromafiletoazabbixhostbyinputtingtheurlsdirectlyintothedatabase."
echo"USEWITHCARE!!"
echo""
echo"usage:${PROGNAME}"
echo""
echo"MySQLconnectionoptions:"
..
分类:
其他好文 时间:
2014-10-01 00:59:01
阅读次数:
740