美文网首页
zabbix批量添加监控项

zabbix批量添加监控项

作者: zwb_jianshu | 来源:发表于2019-08-10 13:26 被阅读0次

    一、登录

    curl -b cookie -c cookie http://10.0.0.61/zabbix/index.php >index.html
    curl -b cookie -c cookie -L -d 'name=Admin&password=zabbix&autologin=1&enter=Sign+in' 'http://10.0.0.61/zabbix/index.php' >index2.html
    

    二、创建5个主机

    for n in  10.0.0.{1..5};do  curl -b cookie -c cookie -L -d "sid=a0ee31e96d8723db&form_refresh=2&form=create&flags=0&tls_connect=1&tls_accept=1&host=${n}&visiblename=&groups%5B%5D=16&interfaces%5B1%5D%5Bitems%5D=&interfaces%5B1%5D%5Blocked%5D=&interfaces%5B1%5D%5BisNew%5D=true&interfaces%5B1%5D%5Binterfaceid%5D=1&interfaces%5B1%5D%5Btype%5D=1&interfaces%5B1%5D%5Bip%5D=${n}&interfaces%5B1%5D%5Bdns%5D=&interfaces%5B1%5D%5Buseip%5D=1&interfaces%5B1%5D%5Bport%5D=10050&mainInterfaces%5B1%5D=1&description=&proxy_hostid=0&status=0&templates%5B%5D=10001&ipmi_authtype=-1&ipmi_privilege=2&ipmi_username=&ipmi_password=&show_inherited_macros=0&macros%5B0%5D%5Bmacro%5D=&macros%5B0%5D%5Bvalue%5D=&inventory_mode=-1&tls_connect=1&tls_in_none=1&tls_psk_identity=&tls_psk=&tls_issuer=&tls_subject=&add=%E6%B7%BB%E5%8A%A0"  'http://10.0.0.61/zabbix/hosts.php' ;done 
    

    三、创建10个监控项

    for n in  `cat tcp.txt`;do  curl -b cookie -c cookie -L -d "sid=a0ee31e96d8723db&form_refresh=1&form=create&hostid=10279&selectedInterfaceId=0&name=${n}%E6%95%B0%E9%87%8F%E7%8A%B6%E6%80%81&type=0&key=${n}&url=&query_fields%5Bname%5D%5B1%5D=&query_fields%5Bvalue%5D%5B1%5D=&timeout=3s&post_type=0&posts=&headers%5Bname%5D%5B1%5D=&headers%5Bvalue%5D%5B1%5D=&status_codes=200&follow_redirects=1&retrieve_mode=0&http_proxy=&http_username=&http_password=&ssl_cert_file=&ssl_key_file=&ssl_key_password=&interfaceid=14&snmpv3_authprotocol=0&snmpv3_privprotocol=0&params_es=&params_ap=&params_f=&value_type=3&units=&delay=30s&delay_flex%5B0%5D%5Btype%5D=0&delay_flex%5B0%5D%5Bdelay%5D=&delay_flex%5B0%5D%5Bschedule%5D=&delay_flex%5B0%5D%5Bperiod%5D=&history_mode=1&history=90d&trends_mode=1&trends=365d&valuemapid=0&new_application=&applications%5B%5D=1246&inventory_link=0&description=&status=0&add=%E6%B7%BB%E5%8A%A0" "http://10.0.0.61/zabbix/items.php?form=create&hostid=10279";done
    

    相关文章

      网友评论

          本文标题:zabbix批量添加监控项

          本文链接:https://www.haomeiwen.com/subject/rncrjctx.html