Permalink
Browse files

For each server in pool, create separated thread with pingator agent

  • Loading branch information...
1 parent 95b6e55 commit 0ce715e28989fdfc4d4c18eabdd977ff35e8f30e @kachayev committed Aug 6, 2011
Showing with 7 additions and 1 deletion.
  1. +1 −1 gearoscope/apps/monitor/agents/pingator.py
  2. +6 −0 gearoscope/apps/monitor/sonard.py
@@ -44,6 +44,6 @@ def work(self):
self.log.info(PingLogRecord(self.ping(4), server={'host': self.server.host}))
def ping(count=4):
- cmd = ['ping', self.server, '-c', str(count)]
+ cmd = ['ping', self.server.host, '-c', str(count)]
return subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[-1]
@@ -21,6 +21,7 @@
from sonar.agents.supervisor import SupervisorAgent, Supervisor
from agents.gearmand import GearmanNodeAgent
+from agents.pingator import PingAgent
import scoper
from django.conf import settings
@@ -43,6 +44,11 @@ def make(options):
for server in scoper.models.Server.objects.all():
ServerPool.add(Server(**server.__dict__))
+ # Add special Pingator agent, which will periodicaly ping
+ # server with using subprocess PIPE and log information
+ # both about server availability and average response time
+ s.add_agent(PingAgent(ServerPool.get(server.name), settings.SONAR_PINGATOR_RETRIES))
+
# Create Supervisor agents with using information from database
for visor in scoper.models.Supervisor.objects.all():
names = ','.join([worker.name for worker in scoper.models.Worker.objects.filter(supervisor=visor)])

0 comments on commit 0ce715e

Please sign in to comment.