[Ultrapossum-cvs 842] demo/haviewer/lib/haviewer 1.14, 1.15, ultrapossum.rb

Back to archive index

Masato Taruishi taru****@users*****
2004年 10月 13日 (水) 16:01:13 JST


===================================================================
RCS file: demo/haviewer/lib/haviewer/ultrapossum.rb,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- demo/haviewer/lib/haviewer/ultrapossum.rb	2004/10/13 06:21:01	1.14
+++ demo/haviewer/lib/haviewer/ultrapossum.rb	2004/10/13 07:01:13	1.15
@@ -12,8 +12,13 @@
     PID = ".1.2.0"
     SINCE = ".1.3.0"
 
+    def UltraPossumHost.ldapmaster
+      fqdn = UltraPossumHost.conf["LDAPMASTER"]
+      fqdn += ".#{UltraPossumHost.conf["DOMAIN"]}" if UltraPossumHost.conf["DOMAIN"].size > 0
+    end
+
     def UltraPossumHost.update_latest_entryCSN
-      `ldapsearch -l 1 -x -h #{UltraPossumHost.conf["LDAPMASTER"]} -b #{@@monitored_entry} -s base -LLL +`.each_line do |line|
+      `ldapsearch -l 1 -x -h #{UltraPossumHost.ldapmaster} -b #{@@monitored_entry} -s base -LLL +`.each_line do |line|
         case line
         when /entryCSN: (.+)/
           @@latest_entryCSN = $1
@@ -61,7 +66,7 @@
     def monitor_entry
       @entryCSN = ""
       return if ! avail?
-      `ldapsearch -l 1 -x -h #{@host} -b #{@@monitored_entry} -s base -LLL +`.each_line do |line|
+      `ldapsearch -l 1 -x -h #{fqdn} -b #{@@monitored_entry} -s base -LLL +`.each_line do |line|
         case line
         when /entryCSN: (.+)/
           @entryCSN = $1
@@ -77,6 +82,11 @@
       end
     end
 
+    def fqdn
+      buf = @host
+      buf += ".#{@@conf["DOMAIN"]}" if @@conf["DOMAIN"].size > 0
+    end
+
     def snmp
       status = @@conf["SNMP_MIB"] + STATUS
       statusbuf = nil
@@ -84,8 +94,6 @@
       pidbuf = nil
       since = @@conf["SNMP_MIB"] + SINCE
       sincebuf = nil
-      fqdn = @host
-      fqdn += ".#{@@conf["DOMAIN"]}" if @@conf["DOMAIN"].size > 0
 
       snmpget = "snmpget -On -v1 -t 3 -c ultrapossum #{fqdn} #{status} #{pid} #{since}"
       $stderr.puts "#{`date`.chomp} #{snmpget}" if $DEBUG
@@ -266,7 +274,7 @@
           STDERR.reopen(pe[1])
           pe[1].close
 
-          exec("ldapmodify -x -h #{UltraPossumHost.conf["LDAPMASTER"]} -D #{UltraPossumHost.conf["ROOTDN"]} -w #{UltraPossumHost.conf["ROOTPW"]}")
+          exec("ldapmodify -x -h #{UltraPossumHost.ldapmaster} -D #{UltraPossumHost.conf["ROOTDN"]} -w #{UltraPossumHost.conf["ROOTPW"]}")
         }
 
         pw[0].close



Ultrapossum-cvs メーリングリストの案内
Back to archive index