Time to install MEM 3.0, and get its built-in agent working.
[ If you want some tips on What’s New, have a look here. ]
I’ve downloaded the Monitor Server and the agent zipped s/w for Linux & Win from http://edelivery.oracle.com:
mysqlmonitor-3.0.0.2887-linux-x86-installer.bin mysqlmonitoragent-3.0.0.2887-linux-glibc2.3-x86-32bit-installer.bin mysqlmonitoragent-3.0.0.2887-windows-installer.exe
The Monitor install
So, on my Oracle Linux machine:
./mysqlmonitor-3.0.0.2887-linux-x86-installer.bin
It all installs fine. No issues, if you’re used to MEM 2.3.
Double check your configuration_report.txt :
MySQL Enterprise Monitor (Version 3.0.0.2887 : 3.0.0.2887) Here are the settings you specified: Application hostname and port: http://127.0.0.1:18080 Tomcat Ports: 18080 - 18443 (SSL) MySQL Port : 13306 Use the following command to login to the MySQL Enterprise Monitor database: mysql -u**** -p**** -P13306 -hlocalhost
To startup | shutdown:
service mysql-monitor-server start | stop
Before looking any further, once it’s started up, I personally see that my poor little Virtualbox VM is screaming for more memory, eating swap. My fault for keeping it too tight. java, jsvc & mysqld procs are a little high, for my demo env.
Especially as I plan to do as much as possible in this env (replication, utilities, etc.) so I’ll end up with 3x mysqld’s, as well as java, etc.
Remember: this is my own doing. You won’t want to do this in a proper production environment. Au contraire, you’ll probably want to assign more memory, etc.
cd /opt/mysql/enterprise/monitor/apache-tomcat/bin vi setenv.sh #JAVA_OPTS="-Xmx768M -Xms768M -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/mysql/enterprise/monitor/apache-tomcat/temp -XX:+UseParallelOldGC -XX:MaxPermSize=512M" JAVA_OPTS="-Xmx400M -Xms400M -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/mysql/enterprise/monitor/apache-tomcat/temp -XX:+UseParallelOldGC -XX:MaxPermSize=256M" cd ../.. ./mysqlmonitorctl.sh restart ./mysqlmonitorctl.sh status
To see which the ‘root’ user is for mysql CLI access:
/opt/mysql/enterprise/monitor/apache-tomcat/webapps/ROOT/WEB-INF/config.properties
don’t know why you’d want to play around there though.
Now go to the console http://192.168.56.104:18080 and complete the setup instructions. You’ll see a more blank version of the console, but it’s something like this: Also, the cool thing is, before we actually go and install any agent, the monitor will automatically detect the other MySQL instances on the same server. In fact, what you can see here is when I actually deleted an existing entry for a specific previously detected and monitored instance. MEM acknowledges that you’re deleted it, but it will still tell you that you’ve an unmonitored instance.. just waiting for you to add it in:
Agent install
./mysqlmonitoragent-3.0.0.2887-linux-glibc2.3-x86-32bit-installer.bin
Language Selection Please select the installation language [1] English - English [2] Japanese - æ¥æ¬èª Please choose an option [1] : ---------------------------------------------------------------------------- Welcome to the MySQL Enterprise Monitor Agent Setup Wizard. ---------------------------------------------------------------------------- Installation directory Please specify the directory where MySQL Enterprise Monitor Agent will be installed Installation directory [/opt/mysql/enterprise/agent]: /opt/mysql/enterprise/agent56 Agent Service Name [mysql-monitor-agent]: mysql-monitor-agent56
I’m giving it a specific path under “agent56” as I know I’ll be installing other agents later…
How will the agent connect to the database it is monitoring? [1] TCP/IP [2] Socket Please choose an option [1] : ---------------------------------------------------------------------------- Monitoring Options You can configure the Agent to monitor this host (file systems, CPU, RAM, etc.) and then use the Monitor UI to furnish connection parameters for all current and future running MySQL Instances. This can be automated or done manually for each MySQL Instance discovered by the Agent. (Note: scanning for running MySQL processes is not available on Windows, but you can manually add new connections and parameters from the Monitor UI as well.) Visit the following URL for more information: http://dev.mysql.com/doc/mysql-monitor/3.0/en/mem-qanal-using-feeding.html Monitoring options: [1] Host only: Configure the Agent to monitor this host and then use the Monitor UI to furnish connection parameters for current and future running MySQL Instances. [2] Host and database: Configure the Agent to monitor this host and furnish connection parameters for a specific MySQL Instance now. This process may be scripted. Once installed, this Agent will also continuously look for new MySQL Instances to monitor as described above. Please choose an option [2] : 2 ---------------------------------------------------------------------------- Setup is now ready to begin installing MySQL Enterprise Monitor Agent on your computer. Do you want to continue? [Y/n]: ---------------------------------------------------------------------------- Please wait while Setup installs MySQL Enterprise Monitor Agent on your computer. Installing 0% ______________ 50% ______________ 100% ######################################### ---------------------------------------------------------------------------- MySQL Enterprise Monitor Options Hostname or IP address []: 192.168.56.104 Tomcat SSL Port [18443]: Agent Username [agent]: memagent Agent Password : Re-enter : ---------------------------------------------------------------------------- Monitored Database Information IMPORTANT: The Admin user account specified below requires special MySQL privileges. Visit the following URL for more information: http://dev.mysql.com/doc/mysql-monitor/3.0/en/mem-agent-rights.html MySQL hostname or IP address [127.0.0.1]: 192.168.56.104 Validate MySQL hostname or IP address [Y/n]: MySQL Port [3306]: 3356 Admin User []: root Admin Password : Re-enter Password : Monitor Group []: ol63uek01 Warning: Error running /opt/mysql/enterprise/agent56/bin/agent.sh --test-credentials -f --host=192.168.56.104 --port=3356 --admin-user=root : [1045] Access denied for user 'root'@'192.168.56.104' (using password: YES) Press [Enter] to continue : ---------------------------------------------------------------------------- Monitored Database Information IMPORTANT: The Admin user account specified below requires special MySQL privileges. Visit the following URL for more information: http://dev.mysql.com/doc/mysql-monitor/3.0/en/mem-agent-rights.html
Ok, so I forgot to let root access from that IP. Let’s keep it simple:
MySQL hostname or IP address [192.168.56.104]: 127.0.0.1
Validate MySQL hostname or IP address [Y/n]:
MySQL Port [3356]:
Admin User [root]:
Admin Password [********] : Re-enter Password [********] : Monitor Group [ol63uek01]:
----------------------------------------------------------------------------
Agent User Account Creation IMPORTANT: Less privileged accounts can be used to enhance monitoring security, and can even be created for you if the Admin account has GRANT privileges. Visit the following URL for more information: http://dev.mysql.com/doc/mysql-monitor/3.0/en/mem-agent-rights.html Auto-Create Less Privileged Users [Y/n]: General Username []: general General Password : Re-enter Password : Limited Username []: limited Limited Password : Re-enter Password : ---------------------------------------------------------------------------- Configuration Report
MySQL Enterprise Monitor Agent (Version 3.0.0.2887 : 3.0.0.2887) The settings you specified are listed below. Note that if you are using a Connector to collect Query Analyzer data, you will need some of these settings to configure the Connector. See the following for more information: http://dev.mysql.com/doc/mysql-monitor/3.0/en/mem-qanal-using-feeding.html Installation directory: /opt/mysql/enterprise/agent56 MySQL Enterprise Monitor UI: ------------------------- Hostname or IP address: 192.168.56.104 Tomcat Server Port: 18443 Use SSL: yes Monitored MySQL Database: ------------------------- Hostname or IP address: 127.0.0.1 Port: 3356 Press [Enter] to continue : Press [Enter] to continue : ---------------------------------------------------------------------------- Start MySQL Enterprise Monitor Agent Info to start the MySQL Enterprise Monitor Agent, Aggregator, and Proxy The MySQL Enterprise Monitor Agent was successfully installed. To start the Agent please invoke: /etc/init.d/mysql-monitor-agent56 start Press [Enter] to continue : ---------------------------------------------------------------------------- Setup has finished installing MySQL Enterprise Monitor Agent on your computer. View Agent Readme File [Y/n]:
[ Didn’t see any passwords or asterisks, did you? Try and find them.. go on. “Bigger, Stronger…” ]
Also, remember that if no entry is given to any particular answer, it will take the default, i.e. the option in uppercase (Y/n) or if you’re relaunching a ctrl-c’ed agent install, it will read you back the previous config.
Now, I want to take a moment to point out that the README‘s are sometimes useful, so, I suggest doing what their name hints upon, because:
.. .. Agent: ------ Several differences from the 2.3 Agent installation are worth noting (see the documentation for more details):Press [Enter] to continue : - Multiple connection levels (Admin, General, Limited) are now defined and used by the Agent - Groups play a central role in the new UI and can optionally be assigned at Agent install-time - The old Agent .ini files (mysql-monitor-agent.ini and agent-instance.ini) are no longer supported - Passwords in the .ini file are now stored in encrypted form - The Service Manager now includes a built-in Agent (described above) - The MySQL Proxy and Aggregator are no longer bundled with the Agent installer. See the complete documentation for guidance if you will continue to use them with MEM 3.0. ... ..
Adding instances
As you might have seen before, the agent automatically detected a 5.7 instance. So let’s go and monitor it:
Add the specifics:
remember, in this example I’m using memagent, who has the “with grant option” priv, so that it can create the lesser privileged General & Limited users. This will let MEM do the tasks it needs to do, without having to use root all the time, max out the connections for the root user, etc.
If a group already exists that we want to add this unmonitored instance to, we can also do so:
and once we’ve added the instance, we refresh and wait a couple of minutes or so, and should then see if happily sitting in its group, and because it’s local the the MEM server, it’s also got o.s. monitoring:
When adding, deleting or whatever with the instances, and you’re not quite sure what’s going on, and refreshing like mad on the console, you might want to check things like user privileges, as I initially forgot to give my memagent the appropriate privileges, and I received an error in the /opt/mysql/enterprise/agent/logs/mysql-monitor-agent.log. The console itself will tell you also that Access Denied so there are hints as to what’s going wrong, as these issues will appear under Bad Configurations that appears.
Once I had deleted the instance, adjusted the privs, and added again, it was all ok.
Don’t ignore me
Now, in the previous image, you’ll see a highlighted instance that’s down. I know why it’s down, say we don’t have enough resources to keep them running all the time and/or it’s a rare occasion that we want to monitor it really, or maybe we’re evaluating 5.7.2 or something.
So let’s ignore it:
but once we’re done, we want it back again. But how do we get it back? On the host itself, there’s not a “show me an ignored instance” option.
It might be a little subtle, but everything in MEM 3.0 is there for a reason. There’s little redundancy and not too many of those “more than one way to skin a cat” type accesses. I like the fact that it’s just ‘efficient’.
So, under the 3 buttons “Create Group”, “Add MySQL Instance”, “Add Bulk MySQL Instances”, you’ll find the “MySQL Instance Details” bar, where, on the far right is a magnifying glass. Hit it.
This is the filter, and why we see what we actually do.
And the last button is “Ignored Instance” with the “Disabled option” by default. Choose “(any)” or “Enabled” and then hit the Filter button.
“(any)” shows us all of the instances, ignored and not, and “Enabled” will only show us that poor little ignored instance.
And now just choose the “Show Instance” option, and they’re back. Hello again!
Deleting instances
Say we make a mistake upon config time when adding an unmonitored instance and it appears in the Bad configs section. We can delete them again, via the “Delete Instance” option in the dropdown meno next to the check box.
The mysql-monitor-agent.log will say:
Deleted connection to server com.mysql.etools.agent.collection.MysqlConnection@12fad5
And the recently deleted auto-detected instance reappears as an Unmonitored instance.
So I click on the down-pointing arrow for the “Monitor instance | Ignore instance” dropdown. Choose “Monitor..”.
Leaving the “Monitor from” dropdown as is, I enter the IP address for the port number I’m interested in, 3357, and away we go.
If we added an instance manually, i.e. remotely monitored, and then delete it, if we use the filter on the MySQL Instance Details search button, and use Ignored Instance = (any), then we’ll see that when an instance is deleted, it’s first ignored, i.e. appears in italics, and when we insist, and click on the name, is says
“No MySQL Instance was selected or the connection details for the instance can not be obtained. (U0331)“.
We can be even more persistent, and click on “Refresh inventory”, but if we start clicking around and refreshing, then we’ll find that they will be removed before we can play around. Which is just what we wanted.. isn’t it now?
Remotely Monitored
Right, I’ve got a Raspberry Pi MySQL Cluster that I want to monitor. So, because ARM isn’t a supported platform, we’ll monitor that by some other means, and therefore, I can remotely monitor the cluster. Here’s how.
Adding:
“Add MySQL Instance” button, and on the Connection Settings tab, use the “Monitor From” entry of “ol63uek01: MEM Built-in Agent”. Mainly as you’re indicated to do so, by the ? question mark: “if there is no local Agent on the host and you are unable to install one, use the built-in or another Agent to monitor remotely.”
Once I’m happy with all the info, hit “Add Instance” and we get notified (top right):
Create a group for the newly added remote instances
Very simple, as this is a Raspberry Pi MySQL Cluster, I hit the Create Group button, under the MySQL Instance Details section, and just enter the group name you desire.
Now, I can configure events and advisors per group, and make it specific. This could have been Dev, Test, Preprod or whatever.
Add to group
Now to add the 2x instances to the group.
Click on the dropdown beside the name of the group, and hit “Add to Group”. The dialogue box comes up, and asks us which of the discovered instances we want to add, and so I select the 2 I’m interested in.
and we’re fit.
Notice the “Ungrouped” instances group disappears.
All we need to do now, is look at all the already enabled Advisors for each of my instances and see if I want to make anything group specific, or not, startup some SNMP trap forwarding using the /opt/mysql/enterprise/monitor/support-files/MONITOR.MIB file, and so on and so forth.
Hope this helped.
Great stuff, Keith! I particularly appreciated you showing how to remotely monitor your MySQL Cluster running on Rasperry Pi. I know you only had a couple of instances, but want to also draw attention to the “Add Bulk MySQL Instances” button and associated workflow – it makes adding monitoring of tens or even hundreds of MySQL instances a 30-second proposition. It’s a great way to evaluate MEM 3.0 without installing software on every box or spending hours configuring instances one-by-one.
Thanks for pointing that out Todd, and you’re totally right. I’ll see if I can get 10 more R-Pi’s or so.. (Christmas is getting close.. but I have I been a good boy this year?) and try it out. Seriously, it makes rolling out a whole lot easier. Thanks to the MEM team for this.
Reblogged this on Sutoprise Avenue, A SutoCom Source.