Rather than opening your web browser and blacking out a server by typing entries into the address bar, you can write a script to achieve the same effect. 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
.
#!/usr/bin/perl 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; $browser->credentials( $ARGV[0], '', $ARGV[1], $ARGV[2] ); 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"; }
Windows users can omit the shebang 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
If you are unsure of the host name and port to use, check the
configuration_report.txt
file. Be sure to
specify the correct port for the Tomcat server. Specify the
server you wish to blackout using the name that appears in the
Server Tree, being sure to include a colon and port number as
shown in the preceding example. Make sure that the user you
specify is a "manager". Specifying a user with "dba" rights only
will not black out a server and no error will be displayed.
You can confirm that a server is blacked out by looking at the
server name in the Dashboard; the name of a blacked out server
is greyed. To end the blackout, run the same script, changing
the final argument to false
.
Restarting MySQL Enterprise Monitor will not reactivate a blacked out server.
User Comments
Add your own comment.