4.4.1 Scripting Blackouts

You can write a script to black out a server, rather than opening a web browser and typing entries into the address bar. This section documents a sample blackout script that can be run from the command line.

Create the following file and save it as blackout.pl.


  use LWP 5.64;

  # USAGE: blackout.pl servicemanager:18080 admin password servername:3306 true

  # $ARGV[0] = management server hostname:port
  # $ARGV[1] = management server username
  # $ARGV[2] = management server password
  # $ARGV[3] = mysqld managed instance server name and port
  # $ARGV[4] = blackout state (true/false)

  my $browser = LWP::UserAgent->new;

  my $url = URI->new('http://'.$ARGV[0].'/rest');

  $url->query_form( # And here the form data pairs:
    'command' => 'blackout',
    'server_name' => $ARGV[3],
    'blackout_state' => $ARGV[4]

  my $response = $browser->post( $url );

  if (!$response->is_success) {
    die $response->status_line . "\n";

  if ($response->content =~ /UserUnauthorizedException/ ||
       $response->content =~ /ServerDoesNotExistException/) { 
  	die $response->content;

Windows users can omit the initial #! line.

On Unix systems, use the chmod +x blackout.pl command to make the file executable.

At the command line, enter blackout.pl servicemanager:18080 admin password servername:3306 true.

Check the configuration_report.txt file for the host name and port to use. Specify the correct port for the Tomcat server. Specify the server to black out using the name that appears in the Server Tree, including the colon and port number as shown in the preceding example. Specify the name of a user who is a Manager. A user with DBA rights cannot black out a server, and the script does not display any error in this case.

To confirm that a server is blacked out, check that its name is greyed out in the Dashboard. To end the blackout, run the same script, changing the final argument to false.


Restarting MySQL Enterprise Monitor does not reactivate a blacked out server.

Download this Manual
PDF (US Ltr) - 4.0Mb
PDF (A4) - 4.0Mb
EPUB - 3.2Mb
HTML Download (TGZ) - 3.1Mb
HTML Download (Zip) - 3.1Mb
User Comments
Sign Up Login You must be logged in to post a comment.