This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
# | |
require "zabbixapi" | |
require 'net/http' | |
require 'uri' | |
zbx = ZabbixApi.connect( | |
:url => 'http://localhost/zabbix/api_jsonrpc.php', | |
:user => 'Admin', | |
:password => 'zabbix' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99,description | |
99,inactive: | |
371,unit \d+ | |
// ipv4 | |
475,(\d{1,3}\.){3}\d{1,3} | |
475,(\d{1,3}\.){3}\d{1,3}\/\d+ | |
// ipv6 | |
475,(?:[a-f0-9]{1,4}:){7}[a-f0-9]{1,4}(?:\/\d{1,3})? | |
475,(?:[a-f0-9]{1,4}:){7}[a-f0-9]{1,4}(?:\/\d{1,3})?\/\d+ | |
// ipv6 compressed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/<TreeWord> | |
/0000,0002,0000,00000000,00010115,"^system {","" | |
/0000,0002,0000,00000000,00012115,"^chassis {","" | |
/0000,0002,0000,00000000,00012013,"^interfaces {","" | |
/0000,0002,0000,00000000,00012115,"^logical-systems {","" | |
/0000,0002,0000,00000000,00012113,"^forwarding-options {","" | |
/0000,0002,0000,00000000,00012115,"^class-of-service {","" | |
/0000,0002,0000,00000000,00012115,"^protocols {","" | |
/0000,0002,0000,00000000,00012115,"^routing-options {","" | |
/0000,0002,0000,00000000,00012115,"^policy-options {","" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################ | |
# | |
# rrd_tool.rb | |
# | |
# rrdtool fetch をruby でラップしたクラスライブラリ | |
# | |
# 2013/6 | |
# yamamoto | |
# | |
################################################ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
body { | |
font: 10px sans-serif; | |
} | |
.axis path, | |
.axis line { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/ruby | |
require 'pathname' | |
require 'open3' | |
rrd_path = Pathname.new('/data/mrtg/rrd') | |
rrdfile = "localhost_em0.rrd" | |
rrd = rrd_path + rrdfile | |
command = '/usr/local/bin/rrdtool graph' | |
outfile = "test.png" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/ruby | |
require 'pty' | |
require 'expect' | |
require 'logger' | |
require 'ostruct' | |
conf = OpenStruct.new | |
conf.pattern = /(user@freebsd:.*%)/ | |
conf.username = "username" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# | |
# | |
# | |
class BgpEntry | |
@@snmpwalk = "/usr/local/bin/snmpwalk -v 2c -c" | |
@@bgp_status_mib = "1.3.6.1.2.1.15.3.1.2" | |
@@bgp_admin_mib = "1.3.6.1.2.1.15.3.1.3" | |
@@bgp_as_mib = "1.3.6.1.2.1.15.3.1.9" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sec2dhms(secs) | |
time = secs.round | |
sec = time % 60 | |
time /= 60 | |
mins = time % 60 | |
time /= 60 | |
hrs = time % 24 | |
time /= 24 | |
days = time | |
[days, hrs, mins, sec] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/ruby | |
cfgdir = '/data/mrtg/cfg' | |
command = '/usr/local/bin/mrtg' | |
Dir.glob("#{cfgdir}/*.cfg").each do |file| | |
system("#{command} #{file}") | |
end |
NewerOlder