首先,zabbix自带的检查肯定是不能够满足大家需求的,例如,我们服务器上跑着apache(zabbix官方应该有apache模板),我需要一个独立的脚本来每隔1分钟检查一下apache服务的状态是否正常,这个时候我们就可以定制化我们的镜像了 首先,我们先看一下官方的镜像是如何制作出来的 [crayon-642256c4045691417……
分类目录:监控工具
使用容器搭建你的zabbix监控系统(下)
使用容器搭建你的zabbix监控系统(上)
statuspage api调用python脚本
zabbix数据库优化 分表(mysql_partition)
通过ruby脚本调用zabbixapi接口删除主机
有时候需要删除zabbix上的主机,web页面懒的打开,写了一个ruby的脚本
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
#!/usr/local/bin/ruby -w require "zabbixapi" #get the host from input line host_receive_count="#{ARGV.size}" if "#{host_receive_count}" !="1" puts "only one at one time Use:ruyb zabbix_delte_host.rb <FQDN>" else puts "#{ARGV[0]}" host_name="#{ARGV[0]}" zbx = ZabbixApi.connect( :url => 'https://localhost/zabbix/api_jsonrpc.php', :user => 'testuser', :password => 'testpassword', #:debug => true ) #get the host we want to delte hosts = zbx.query( :method => "host.get", :params => { :filter => { :host => "#{host_name}" }, :output => ['hostid','host'] } ) host=Hash.new length="#{hosts.length}" puts "#{hosts.length}" #delte one at one time if "#{hosts.length}"!="1" puts "Something may wrong,we get more than one node ,we get #{length}" else host=hosts[0] puts "#{host}" #get the id of host host_id=host["hostid"] # puts "going to delete the host:#{host_name} with hostid:#{host_id}" hosts_delteid=zbx.query( :method => "host.delete", :params =>[ "#{host_id}" ] ) end end |