header

Monitoring support in AMGA

AMGA supports monitoring via the <a href="http://sourceforge.net/projects/monami/"MonAMI monitoring service which can also forward information into MonALISA. The following is an example script in Python which requests information from an AMGA server. The server is contacted on the standard port:
  #!/usr/bin/env python
  import socket

  # Open TCP socket to AMGA server
  s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  s.connect(("localhost", 8822))

  # Request statistics
  s.send('statistics\n\n')

  # Read response
  result = ''
  while 1:
      r = s.recv(1000)
      result = result + r
      if not r:
          break

  start = result.find('<Service>') # Skip response header
  result = result[start:]
  print result
The server is contacted and monitoring is requested via the "statistics\n\n" command. In the response of the server the server greeting needs to be skipped. The rest of the result is then an XML encoded status report according to the GLUE schemas as described here.

The following is an example result:

  <Service>
  <Name>AMGA</Name>
  <Version>1.1.0</Version>
  <Data>
    <Key>MaxConnections</Key>
    <Value>50</Value>
    <Key>PreparedConnections</Key>
    <Value>1</Value>
    <Key>UsedConnections</Key>
    <Value>1</Value>
    <Key>MaxSessions</Key>
    <Value>1024</Value>
    <Key>UsedSessions</Key>
    <Value>0</Value>
    <Key>SessionStorage</Key>
    <Value>shm</Value>
  </Data>
  </Service>

You can use a Nagios probe for AMGA. You can find this probe named check_amga in the scripts directory. This probe needs a perl-XML-Simple package. You must install this package first.

  $ sudo yum install perl-XML-Simple

You can test as follow.

  $ cd org.glite.amga.server/scripts
    
  $ ./check_amga
  
  Return :
  OK: Success|0.001s;10;0
  or
  CRITICAL: Failed to connect AMGA Server (localhost:8822)  

Generated on Mon Apr 16 16:54:31 2012 for AMGA by  doxygen 1.4.7