您的位置:首页 > 运维架构

监控ADLDAP

2021-02-18 20:46 731 查看
好久没有更新帖子了,最近有时间分享下如何监控ADLDAP,LDAP不容置疑,绝对是公司内最核心的功能模块,言归正传。⤵️⤵️⤵️⤵️⤵️

正常服务器监控中,对ldap监控仅限于监控端口状态是否正常,这种监控方式只能达到50%的功效。本次监控是PHP操作LDAP访问AD域进行认证登陆,监控到应用层方面。
通过zabbix agent调用PHP脚本进行ldap连接。如果连接成功输出 1 连接失败输出0,脚本部署在机器上D:\PHP

安装wampserver

在服务器上安装PHP环境wampserver

客户端conf添加文件配置

powershell中调用php脚本 命令须先导入php模块,此步骤需时较长,所以必须修改超时时间Timeout=30
UserParameter=ldap01,powershell.exe php -f D:\PHP\ldap01.PHP

脚本如下

<?php
// using ldap bind
$ldaprdn = 'CN=lili,OU=xxx,OU=xxx,DC=xxxx,DC=com'; // ldap rdn or dn
$ldappass = 'password'; // 1234w1231 password

// connect to ldap server @符号用于屏蔽程序自报错
$ldapconn =@ ldap_connect("xx.xxx.com",389)
or die("Could not connect to LDAP server.");

if ($ldapconn) {

// binding to ldap server
$ldapbind = @ldap_bind($ldapconn, $ldaprdn, $ldappass);

// verify binding
if ($ldapbind) {
//LDAP bind successful... print 1
echo "1";
} else {
//LDAP bind failed... print 0
echo "0";
}

}?>

zabbix配置

监控项配置

触发器配置

功能测试

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: