cat ssl_check.sh
#!/bin/bash
#获取ssl证书的过期时间
#author:Allen
#获取证书的有效时间
time=$(echo | openssl s_client -connect $1:443 2>/dev/null | openssl x509 -noout -dates |awk -F'=' 'NR==2{print $2}')
#有效时间生成时间戳
time1=$(date +%s -d "$time")
#当前时间生成时间戳
time2=$(date +%s)
#当前时间减去有效时间,获得将要过期的天数
time3=$(((time1-time2)/(60*60*24)))
echo $time3
cat ssl.conf
UserParameter=ssl_check[*],/etc/zabbix/script/ssl_check.sh $1
image.png
image.png
cat redis_status.sh
#!/bin/bash
# by lutixia
######################
killall -0 /usr/local/redis/bin/redis-server &>/dev/null
if [ $? -eq 0 ];then
echo 1
else
echo 0
fi
cat redis.conf
UserParameter=redis.status,bash /data/sh/redis_status.sh
image.png
image.png
网友评论