cat userparameter_http.conf

UserParameter=http_discovery,/usr/bin/python  /etc/zabbix/scripts/base/http_discovery.py
UserParameter=http.info[*],/bin/bash /etc/zabbix/scripts/base/check-http-expire.sh $1 

cat /etc/zabbix/scripts/base/http_list

baidu.com 443 

cat  /etc/zabbix/scripts/base/http_discovery.py

#!/usr/bin/env python
#coding:utf-8 import os
import sys
import json #这个函数主要是构造出一个特定格式的字典,用于zabbix
def ssl_cert_discovery():
web_list=[]
web_dict={"data":None}
with open("/etc/zabbix/scripts/base/http_list","r") as f:
for sslcert in f:
dict={}
dict["{#DOMAINNAME}"]=sslcert.strip().split()[0]
dict["{#PORT}"]=sslcert.strip().split()[1]
dict["{#OLDNS}"]=sslcert.strip().split()[2]
web_list.append(dict)
web_dict["data"]=web_list
jsonStr = json.dumps(web_dict,indent=4)
return jsonStr
if __name__ == "__main__":
print ssl_cert_discovery()

cat /etc/zabbix/scripts/base/check-http-expire.sh

#!/bin/bash
host=$1
#end_date=`whois -H $host|grep "Registry Expiry Date"|awk '{print $NF}'`
end_date=`whois -H $host|egrep "Registry Expiry Date|Expiration Time"|awk '{print $3,$4}'|sed 's#Date: ##g'` #echo "$end_date"
if [ -n "$end_date" ]
then
end_date_seconds=`date '+%s' --date "$end_date"`
now_seconds=`date '+%s'`
echo "($end_date_seconds-$now_seconds)/24/3600" | bc
fi

模板

<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>5.2</version>
<date>2022-08-12T04:53:53Z</date>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<templates>
<template>
<template>Template http expire date</template>
<name>Template http expire date</name>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<applications>
<application>
<name>域名过期剩余时间</name>
</application>
</applications>
<discovery_rules>
<discovery_rule>
<name>域名到期_Discovery</name>
<type>ZABBIX_ACTIVE</type>
<key>http_discovery</key>
<delay>24h</delay>
<lifetime>8h</lifetime>
<item_prototypes>
<item_prototype>
<name>[{#DOMAINNAME}]域名过期剩余时间:</name>
<type>ZABBIX_ACTIVE</type>
<key>http.info[{#DOMAINNAME},{#PORT}]</key>
<delay>24h</delay>
<history>0</history>
<trends>7d</trends>
<units>天</units>
<applications>
<application>
<name>域名过期剩余时间</name>
</application>
</applications>
<preprocessing>
<step>
<type>MULTIPLIER</type>
<parameters>
<parameter>1</parameter>
</parameters>
</step>
</preprocessing>
<trigger_prototypes>
<trigger_prototype>
<expression>{last()}&lt;33</expression>
<name>[{#DOMAINNAME}] 域名过期剩余时间小于33天</name>
<priority>HIGH</priority>
<manual_close>YES</manual_close>
</trigger_prototype>
</trigger_prototypes>
</item_prototype>
</item_prototypes>
</discovery_rule>
</discovery_rules>
</template>
</templates>
</zabbix_export>

zabbix 监控域名到期时间的更多相关文章

  1. zabbix 监控域名证书到期时间!!!!

    在客户端机器上创建脚本 vim /etc/zabbix/zabbix_agentd.d/check-cert-expire.sh #!/bin/sh host=$1port=$2end_date=`o ...

  2. zabbix监控域名带宽

    代码地址:https://github.com/Ma-Jing/python/blob/master/ngxv2_traffic_daemon.py READ.md里有使用说明! #!/usr/bin ...

  3. zabbix监控系统时间的问题

    分类: 监控 2013-03-19 21:40:11   发现zabbix监控系统时间的一个问题!zabbix监控系统时间用的key是system.localtime,返回当前的系统时间,而配置tig ...

  4. Zabbix监控Low level discovery实时监控网站URL状态

    今天我们来聊一聊Low level discovery这个功能,我们为什么要用到loe level discovery这个功能呢? 很多时候,在使用zabbix监控一些东西,需要对类似于Itens进行 ...

  5. Zabbix监控web,MySQL,TCP状态,Nginx

    接上篇Zabbix使用SMTP发送邮件报警并且制定报警内容 Zabbix怎么设置声音告警 web监控 在zabbix server选择web 创建一个监控web的场景 添加后这里有数字1 查看 假如在 ...

  6. 【zabbix告警监控】配置zabbix监控nginx服务

    zabbix监控nginx,nginx需要添加--with-http_stub_status模块 使用zabbix监控nginx,首先nginx需要配置开启ngx_status.但是我这边nginx安 ...

  7. zabbix监控服务部署

    目录 zabbix监控服务部署 1. zabbix介绍 1.1 zabbix的组件 1.2 zabbix的进程 1.3 zabbix常用术语 2. zabbix工作原理 3. zabbix监控架构 4 ...

  8. 使用Zabbix监控Oracle数据库

    Orabbix介绍 监控Oracle数据库我们需要安装第三方提供的Zabbix插件,我们先测试比较有名的Orabbix,http://www.smartmarmot.com/product/orabb ...

  9. zabbix 监控web网站性能

    一直在纠结用什么实例来给大家演示呢?想来想去还是官方的好,那我们怎么用zabbix监控web性能和可用性呢?我们这边分为几个步骤:打开网站.登陆.登陆验证.退出,一共4个小step,看实例. 检测流程 ...

  10. Zabbix监控disk performance

    概述 zabbix获取/sys里面的磁盘信息并分析来监控disk performance sysfs是Linux内核中设计较新的一种虚拟的基于内存的文件系统,它的作用与 proc 有些类似(默认挂载在 ...

随机推荐

  1. vue中aciton使用的自我总结

    一.需求: 我需要从后台中获取菜单列表在路由守卫中进行限制. 二.遇到的问题: action中setMenuData的方法如下: actions: { setMenuData(context){ ge ...

  2. 实验四:开源控制器实践——OpenDaylight

    实验要求: (一)基本要求: 1.利用Mininet平台搭建下图所示网络拓扑,并连接OpenDaylight控制器: 2.通过Postman工具调用OpenDaylight提供的API下发流表,实现拓 ...

  3. python实现PDF指定页面旋转

    下面示例代码,是将横向纸张旋转为纵向(根据纸张大小判断纸张方向) 方法一:使用PyPDF2库 from PyPDF2 import PdfFileWriter, PdfFileReader def p ...

  4. LeetCode(Java版)

    两数之和 题目描述 给定一个整数数组和一个目标值,找出数组中和为目标值的两个数. 你可以假设每个输入只对应一种答案,且同样的元素不能被重复利用. 示例: 给定 nums = [2, 7, 11, 15 ...

  5. Server2008通过bat命令自动定时备份MySQL数据库

    第一种方法: 环境: MySQL 安装位置:D:\MySQL 论坛数据库名称为:Db_Test 数据库备份目的地:D:\db_bak\ 1.首先新建一个bat文件 rem ************** ...

  6. Unity ARCore动态增加识别图

    项目需要,有两点要求说明一下 1.如果你的图片是下载生成的,那没什么问题 2.如果你的识别图是存储在APK包里的话需要调整图片属性: 代码如下: using QFramework; using Sys ...

  7. gitlab-runner运行流水线过程中出现报错

    1.提示error: could not lock config file D:\gitlab-runner\builds\fJW28yU8\0\auto_test_10\auto_test_dp20 ...

  8. log4net两分钟三步急速搭建日志框架教程(注意System.Configuration.ConfigurationErrorsException: 配置系统未能初始化 ---> System.Configuration.ConfigurationErrorsException: )

    最近接了个活,winform的帮人做几个页面,这里就以winform项目为例了,之前log4net都是项目中继承好了的,这次自己研究从0到1搭建了一个,发现其实也蛮简单的,主要分为以下三步和一个注意事 ...

  9. 支持批量图片转文字的【OCR】文字识别工具,支持截图识别,速度快,准确度高,免费OCR,开源软件

    想必大家偶尔也有需要从图片中提取文字的需求,虽然现在手机上都自带了拍照识别功能,可是从电脑上的图片传到手机识别再将结果发回来实 在是有点麻烦,尤其当图片数量较多时,更是费时费力,使用网页版工具又要面临 ...

  10. 遍历dom节点

    function selectOnchang(obj) { var selectedValue = obj.selectedIndex if (selectedValue == 0) { obj.pa ...