Category Archives: Monitoring & Diagnostics

Icinga missing check_nrpe on Ubuntu

Now that I’ve got Icinga up and running, I was looking to expand its’ reach by using NRPE to monitor some additional items, most noticeably Windows Event Log entries.

However, I could not get any NRPE commands to work.  The reason, the check_nrpe plugin was missing from /usr/lib/nagios/plugins or anywhere else on the server.

It would seem that the check_nrpe plugin is no longer included within the standard Nagios Plugins, but it may be installed separately through apt-get:

apt-get install nagios-nrpe-plugin

However, this also command will prompt you install the additional packages of nagios3, nagios3-cgi, nagios3-common and nagios3-core. As I’m using Icinga, this is the last things I want or need to install.

The solution, is to run the apt-get command with –use-no-install-recommends parameter:

apt-get install nagios-nrpe-plugin --use-no-install-recommends

Worked like a treat.

 

– very few of the

Monitoring MySQL with Zabbix using the appaloosa-zabbix-templates

The standard MySQL Templates for Zabbix are a little basic and I admit I never really got them to work properly.  Thankfully, the Appaloosa Zabbix Templates are available that are based on the excellent Percona Monitoring Plugins.

As always, this is how I got this to work.  If you have any suggestions or improvements, get in touch.

Initial Work

On Ubuntu, some additional Perl modules are required:

$ apt-get install libxml-simple-perl libdatetime-perl

You also need to create some directories

$ mkdir /usr/local/zabbix
$ mkdir /usr/local/zabbix/plugins
$ mkdir /usr/local/zabbix/agent.d
Generating the Template

Download the source from Google Project Hosting

$ wget http://appaloosa-zabbix-templates.googlecode.com/files/appaloosa-zabbix-templates-0.0.1.tgz

Extract the source by running

$ tar -zxvf appaloosa-zabbix-templates-0.0.1.tgz

Open the extracted folder and generate the template XML

$ cd appaloosa-zabbix-templates-0.0.1
$ perl tools/gen_template.pl defs/mysql.pl mysql.xml

Copy the generated file, mysql.xml, to the /usr/local/zabbix/plugins directory

$ cp mysql.xml /usr/local/zabbix/plugins
Creating the Config File

Now create the agent’s config file by editing conf/mysql_agentd.conf using the sed command.

$ sed -e 's|$ZABBIX_AGENT_PATH|/usr/local/zabbix/plugins|' conf/mysql_agentd.conf > mysql.conf

Copy the new config file to the /usr/local/zabbix/config.d directory

$ cp mysql.conf /usr/local/zabbix/config.d

Open the Zabbix Agent configuration file

$ nano /usr/local/etc/zabbix_agentd.conf

Add the following line

Include=/usr/local/zabbix/agent.d
Restart the Zabbix Agent
$ service zabbix-agent restart
Creating a MySQL User

Connect to mysql using the command: (you will be prompted for the root’s password)

$ mysql --u root -p mysql

Create the new user

mysql> CREATE USER 'zabbixmonitor'@'localhost' IDENTIFIED BY 'password';

Grant privileges to the user

mysql> GRANT SELECT, SUPER, PROCESS ON *.* TO 'zabbixmonitor'@'localhost';

Reload all privileges:

mysql> FLUSH PRIVILEGES;

Exit mysql

mysql> quit

Alternatively, you can use a UI tool like Webmin if it is installed on your server.

Configuring the PHP Script

The template requires a PHP file from the original Cacti template.  Download and extract the latest version of the Cacti Templates using

$ wget http://mysql-cacti-templates.googlecode.com/files/better-cacti-templates-1.1.8.tar.gz
$ tar -zxvf better-cacti-templates-1.1.8.tar.gz

Copy the file scripts/ss_get_mysql_stats.php to /usr/local/zabbix/plugins

$ cp better-cacti-templates-1.1.8/scripts/ss_get_mysql_stats.php /usr/local/zabbix/plugins

Open ss_get_mysql_stats.php for editing

$ nano /usr/local/zabbix/plugins/ss_get_mysql_stats.php

Change the values of $mysql_user and $mysql_pass to that of the mysql user created above

$mysql_user = 'zabbixmonitor';
$mysql_pass = '12345678';

Save and close the file

Import the Template

If you generated the mysql.xml on the Zabbix server, you need to download it to your client computer.

Once you have the file, log into Zabbix and go to Configuration > Templates

Click on the Import button in the top right

Click on Choose File to select mysql.xml and then click on Import

If successful, you should see the message Template Imported

Adding the template to a host

In Zabbix, go to Configuration > Hosts

Click on the host to add the template

Select the Templates tab

Click on Add and select template_mysql from the list

Click on Select and then Save

Troubleshooting

If you don’t get any data, check the Zabbix agent’s log.  The logfile’s path is defined in the agent’s configuration file, but the default are:

  • Linux: /tmp/zabbix_agent.log
  • Windows: c:\zabbix\zabbix_agentd.log

Don’t forget, if you make any changes to the configuration file, you will need to restart the agent for them to take effect.

References

Appaloosa Installation Notes: http://code.google.com/p/appaloosa-zabbix-templates/wiki/Installation

Buxxnt: http://buzznt.blogspot.co.uk/2011/09/install-zabbix-mysql-plugin-imported.html

 

Resetting Webmin password for Ubuntu

The inevitable happened: I forgot the password for Webmin on one of my Ubuntu servers.  In my defence, it is a server that I principally manage via SSH.  Being Ubuntu, the necessary files are not in the same place as Webmin documentation.  However, a quick Google search found a blog post with the solution.  For my own records, I am duplicating below:

  1. Open a shell or SSH session on the target server
  2. Enter the command
    • /usr/share/webmin/changepass.pl /etc/webmin username password
    • Where username = webmin username.  For me this was root
    • And password = new password.
  3. Login to Webmin to test

Thanks to and original information from http://ranawd.wordpress.com/2010/06/14/reset-webmin-password-for-ubuntu/

Given the number of password I seemingly have to remember, I think it is time that I employed some for of Password Safe.

Reset Webmin Password for ubuntu

13 Votes

I found this problem at the first time when webmin installed. Also this happens to everyone at one time or another. You go on vacation and when you come back, you forget all of the passwords on your computer.

I failed logging in several times and then Webmin blocked my IP. Getting localhost blocked isn’t a good thing to see. So I searched the Internet for a way to reset the password and I found this procedure:

1. Login to your computer as root. Type on browser address bar https://localhost:10000/
2. If you are running a Debian distribution (ubuntu), enter the following command:
/usr/share/webmin/changepass.pl /etc/webmin username password
3. Login to Webmin with your reset password.
4. eNjoY!

Remotely managing disks on Windows 2008/Hyper-V Server R2

As I’m mooting some hardware upgrades to my bash’n’crash Hyper-V server, I wanted to check out a few things with regards to it’s performance and general health.  I duly fired up Server Manager, but was thwarted when I tried to use Disk Management and got the message of RPC Server is unavailable.  I checked the Firewall, and the requisite rules (see below) were enabled.  I recycled the Virtual Disk Service and still had no luck.

After hunting around a while I found a Technet Forum post that covered this.  You have to enable the necessary inbound rules both on the server being managed and the managing computer.  Once I had done this, and restarted Server Manager, I could access Disk Management.

For reference, the two rules that need to be enabled are:

Remote Volume Management – Virtual Disk Service (RPC)

Remote Volume Management – Virtual Disk Service Loader (RPC)

As per the Technet post, I found that you don’t need the Remote Volume Management (RPC-EPMAP) rule enabled.  Needless to say, I only enabled both rules for the Domain firewall profile.