cat ssl_check.sh
#!/bin/bash
#獲取ssl證書的過期時(shí)間
#author:Allen
#獲取證書的有效時(shí)間
time=$(echo | openssl s_client -connect $1:443 2>/dev/null | openssl x509 -noout -dates |awk -F'=' 'NR==2{print $2}')
#有效時(shí)間生成時(shí)間戳
time1=$(date +%s -d "$time")
#當(dāng)前時(shí)間生成時(shí)間戳
time2=$(date +%s)
#當(dāng)前時(shí)間減去有效時(shí)間先口,獲得將要過期的天數(shù)
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