Browse Source

[trac521]
- update copyright
- add new command "sendstats" which send statistics data to stats daemon
- remove unnecessary lines to send statistics data

Naoki Kambe 14 years ago
parent
commit
7b794844b6
1 changed files with 10 additions and 12 deletions
  1. 10 12
      src/bin/bind10/bind10.py.in

+ 10 - 12
src/bin/bind10/bind10.py.in

@@ -1,6 +1,6 @@
 #!@PYTHON@
 
-# Copyright (C) 2010  Internet Systems Consortium.
+# Copyright (C) 2010,2011  Internet Systems Consortium.
 #
 # Permission to use, copy, modify, and distribute this software for any
 # purpose with or without fee is hereby granted, provided that the above
@@ -280,6 +280,15 @@ class BoB:
             if command == "shutdown":
                 self.runnable = False
                 answer = isc.config.ccsession.create_answer(0)
+            elif command == "sendstats":
+                # send statistics data to the stats daemon immediately
+                cmd = isc.config.ccsession.create_command(
+                    'set', { "stats_data": {
+                            'bind10.boot_time': time.strftime('%Y-%m-%dT%H:%M:%SZ', _BASETIME)
+                            }})
+                seq = self.cc_session.group_sendmsg(cmd, 'Stats')
+                self.cc_session.group_recvmsg(True, seq)
+                answer = isc.config.ccsession.create_answer(0)
             else:
                 answer = isc.config.ccsession.create_answer(1, 
                                                             "Unknown command")
@@ -899,17 +908,6 @@ def main():
     sys.stdout.write("[bind10] BIND 10 started\n")
     dump_pid(options.pid_file)
 
-    # send "bind10.boot_time" to b10-stats
-    time.sleep(1) # wait a second
-    if options.verbose:
-        sys.stdout.write("[bind10] send \"bind10.boot_time\" to b10-stats\n")
-    cmd = isc.config.ccsession.create_command('set', 
-            { "stats_data": {
-              'bind10.boot_time': time.strftime('%Y-%m-%dT%H:%M:%SZ', _BASETIME)
-              }
-            })
-    boss_of_bind.cc_session.group_sendmsg(cmd, 'Stats')
-
     # In our main loop, we check for dead processes or messages 
     # on the c-channel.
     wakeup_fd = wakeup_pipe[0]