Wednesday, July 13, 2016

How to quickly install check_mk agent plugins

Check_mk has many agent plugins that a lot of us are not aware of. Some of them would open up monitoring opportunities that were not even considered about. Best of all, some of these plugins use APIs readily available to talk to applications and services. Theses same APIs are used by other commercial programs so the information gleamed from them is commercial-grade.
The hardest part of installing the application is to copy the plugin. The best option is to use the plugin provided by the monitoring Check_mk system. This ensures that the plugin works with the check_mk agent installed on the host. But it may not be convenient to download the plugin to the PC and upload it back to another server. So this is a really quick way to do this.
  1. First, ssh to the host and go the plugin directory, usually /usr/lib/check_mk_agent/plugins
  2. Open the browser to the WATO-Configuration ==> Monitoring Agents window of your Check_mk / OMD installation. 
  3. Right-click on the plugin you wish to upload to the host and copy the URL
  4. Go to the ssh window and type wget.
  5. Then paste the URL, which should look something like  http://192.168.1.100/prod_3f/check_mk/agents/plugins/apache_status. This is for the apache_status plugin.
  6. Since Check_mk / OMD requires a login, edit the line to look like this  http://<Username>:<password>@192.168.1.100/prod_3f/check_mk/agents/plugins/apache_status and press Enter.
  7. Change the permission of the plugin to be executable using chmod ugo+x apache_status 
That should do the trick. Go to Wato-Configuration ==> Hosts. Select the Host that the plugin was added to. Click on the Services button and activate the (new) missing services. Apply the configuration and the plugin should now be active. Check the services of that Host to see the new services.
Some plugins have specific requirements, like the credentials to access the service it monitors. The apache_status plugin needs a specific configuration to be in the apache configuration file. For example, the mk_mysql agent requires the credentials to be in the /etc/check_mk/mysql.cfg file. The file should look like this (replace with the correct information)
 
[client]
user=mysqluser
password=mysqluserpassword


Meet these requirements and  the agent can run and report on the service. Finally, you can go into WATO and check for the Host's Services menu item. The newly discovered services can be enabled here.

Wednesday, July 6, 2016

Check_mk Inventory not updating Solved

If you are just installing the check_mk inventory plugin, please understand the the plugin only run between a set interval times. This is because the inventory process is places a high load on the server and repeating it would impact the performance of the server. The default interval is 4 hours.
You can force an inventory check by doing the following
  1. Find and delete the mk_inventory.last.* file. This is the file that stores the last time the inventory process was run
  2. Go to the check_mk web interface and trigger / refresh the Check_MK HW/SW Inventory service.

Observe the Output of the check plugin entry in the service detail table for Check_MK HW/SW Inventory service. It should read a lot of entries.

Tuesday, June 28, 2016

Setting up the Check_mk Inventory plugin

Check_mk and by extension, OMD have a feature to audit the hardware and software inventory of a server that is being monitored. This can be used to find servers below of a specific specification (e.g RAM too low) or details of an installed software package. To do this, the Check_mk inventory plugin has to be installed. This is a two phase process. First we need to install the check_mk inventory plugin and then we need to setup Check_mk/OMD to start polling the server for inventory information.

Installing the check_mk inventory plugin

The plugin itself is very similar to how other plugins are installed.
  1. Obtain the plugin. This can be found in OMD at Wato Configuration ==> Monitoring agent. Download the file.
  2. Copy the file to the check_mk plugin directory. This can be at either in /usr/lib/check_mk_agent/plugins/ for RedHat/CentOS or in a directory called plugins located in the same directory as the check_mk_agent.exe file.
  3. For Linux hosts, change the file permissions to allow the plugin to be executable.
  4. For Windows hosts, the system account running the check_mk agent has the appropriate permissions to check the service the plugin is for.

Configuring Check_mk to poll for inventory information

Once the plugin is installed, check_mk must be told which servers to poll for the inventory information. Polling for this is done less often than polling for status. It is done via a ruleset.
  1. In Wato Configuration, go to Hosts.
  2. Click on the Rulesets button on the top.
  3. Click on Hardware/Software Inventory button. (bottom left button)
  4. Click on Do hardware/software Inventory
  5. If there are no rules in the folder, click Create rule in folder. Otherwise click on the green pencil icon to edit the existing rule.
  6. Check the box marked Specify explicit host names and enter the hostname of the host to be inventoried. 
  7. If this is an existing rule, understand the current settings and modify accordingly. If you are not sure, go back, create a new rule and repeat rule 6. 

 It will take some time for the hardware and software to be inventoried. Go to View ==> All Hosts. The hosts that are being inventoried have an icon showing a blue window with a CD in front of it.
Click on this icon to show the inventory. The inventory is displayed as a tree, so you need to expand it to show more items. If you are seeing only the hardware inventory showing only RAM information, the plugin is not working or hasn't been run yet. Click the refresh icon in the All Hosts screen to trigger this.
There are more inventory related operation in the Main Menu. Once the inventory is populated, these functions will be useful to discover or find hardware or software installed in the hosts that are being monitored.
If a few hours has passed and the inventory is still not updating, try this to immediately force an inventory check.

Thursday, May 19, 2016

How to install the Bareos Web UI

A bit of a background

Since Bareos is a descendant of the Bacula backup system, there are several ways to administer the system. There is a console-based bconsole, a character menu-driven system. For a GUI experience there is BAT (Bacula Admin Tool), which provides most of the features of bconsole. If you are using Webmin, there is Bacula Backup module which provides basic configuration and administration. A dedicated web interface was eventually developed, called Bacula-Web. However it is more of a monitoring tool than anything else. What drove a wedge between long time bacula users and the Bacula project is the web administration tool, which is available for the commercial version of Bacula but not the open source version. Other efforts at building a web administration tool have faltered with projects like Web-Bacula stalled and abandoned.
Bareos was committed from the get-go to a web administration tool. As more and more features were added, the Bareos WebUI finally moved out from a monitoring tool to an administration tool. However, it still does not support changing the Bareos configuration. The WebUI works through the Bareos Director to execute it's operation. Installing the WebUI can be done in three stages, installing configuring and finalising the setup.

Installing the Bareos WebUI

If you have followed the Bareos server setup post, the Bareos and EPEL repository should be already be set up. Installing it is very easy.

yum install bareos-webui

That will install the WebUI and the ZendFramework it runs on, plus it's dependencies. The process may take sometime as it installs over 100 packages automatically.

Configuring the Bareos WebUI

Configuration for the Bareos WebUI is tied closely to the Director. Most Bareos setups have one installation and one Bareos Director. However, the Bareos WebUI can support multiple directors, allowing for organisations using Bareos Backup to have multiple setups that are heavily customised for the purpose of the backup and backup strategy.
Again, the Bareos developers have provided an easy way to do this. Run the following commands as a privileged user or root user to add the WebUI configuration to a Director setup.

echo "@/etc/bareos/bareos-dir.d/webui-consoles.conf" >> /etc/bareos/bareos-dir.conf 
echo "@/etc/bareos/bareos-dir.d/webui-profiles.conf" >> /etc/bareos/bareos-dir.conf
 
The two commands add a line to the Director configuration. The top line is for the WebUI console configuration file. The file contains critical information such as the name of the profile, the username and password used to access the profile. This is the username and password used to log into Bareos WebUI. The default username is user1 and password is CHANGME. The bottom line is for the profile configuration. The configuration defines what the profile, and therefore the user, can do. The default profile name is webui and the default file allows full access. Restart the Bareos Director to load the new configuration.

service bareos-dir restart

If the server is a fresh installation, start the apache webserver and configure the firewall to allow connection to port 80.  The Bareos WebUI installation will setup the apache configuration in /etc/httpd/conf.d/bareos-webui.conf. Point your browser to the URL http://<Ip address of server>/bareos-webui and log in.
Once the Dashboard is shown, run a the sample job by going to Jobs, and the Run tab. Find the BackupClient1 line. Under the Action column, click the Run button. To check whether the job completed successfully, go back to the Dashboard or the Overview tab under Jobs.

Finalizing the setup

To complete the setup, make sure the apache server is set to start at book.

chckconfig httpd on

Make sure the firewall configuration is also saved.

Friday, May 13, 2016

Backing up a Windows PC with Bareos

This article will cover on how to install the Bareos Client for Windows to backup windows files. Although it is not necessary, the Bareos server should be installed first. This is to ensure that the some information, like the name of the Bareos Director has been set. In fact, that is the only information that is required from the server. The client is built specifically for windows and is smart enough to invoke the VSS service which allows it to backup files that are open by other applications.
Installation could not be easer.

  1. Get the installation files from http://download.bareos.org/bareos/release/latest/windows.
  2. Run the installation program, select FileDaemon.
  3. Give the PC a name to identify itself. This is the Client Name.  Also enter the name of the Bareos Server.  In the Network Address box, you can enter the PC's IP address or it's DNS name.
  4. The program will show the information that is required to be added to the Bareos Director. This will tell the Director where to find the client. Make note or save the client configuration information to be added to the Bareos Director.
  5. The program will install the Bareos Client and set it so that it will start up automatically after the next restart. You can do a test now but you have to start the program manually. 
 You can test the backup of the PC by adding the above information into the Bareos Director configuration on the server and creating a job for it. Don't forget to restart the director for it to recognise the new configuration. Bareos has a windows fileset that is geared to backup all files on  the Windows PC.

Wednesday, May 4, 2016

Creating workflows in Alfresco

The Alfresco Document Management system comes with two types of workflows, a basic workflow and the advanced workflow. This is a comprehensive tutorial on the workflows that Alfresco provides. It covers both theoretical as well as practical aspects of using a workflow within Alfresco. Most small businesses would be using the basic workflow internally. For complex workflows, it would be prudent to hire a professional to help build the workflow and deploy it.

The advanced workflow within Alfresco is an internal effort called Activiti. It is built by the key people behind JBoss. A background in programming is required to setup advanced workflows. Alfresco open sourced Activiti and is used by other projects. A comprehensive manual is available here. Some Java background is needed to understand it. However, it works both as a manual and a tutorial. If there isn't time, there is a 10 minute overview to get started.
Activiti has even been forked into a project called Camunda. More technical information on Camunda can be found here.

Thursday, April 28, 2016

Installing the Bareos server

Some background is needed before setting up the Bareos server. The Bareos backup system is based on the Bacula backup system. It consists of  a Director (the central component),  a file system agent and a storage agent. If this is the first time installation, install the backup system components on the same server for testing purposes. The installation process is divided into three stages.

  1. Setting up the Bareos repository
  2. Installing in the programs 
  3. Setting up or configuring the system
A. Setting up the repository
  1. Refer to quickstart information in official documentation for your Distro specific instruction
  2. For RedHat, it's basically
    1. add the Bareos yum repository. The repositories are here. Make sure the client version matches the Bareos server version. Choose the version of RedHat or CentOS for the target server. Download the bareos.repo file to /etc/yum.repos.d
    2. do a yum check-update to update the repositories to load them
  3. For Oracle Linux, enable the Optional Latest repository.
  4. The latest verions requires the EPEL repository to be added also.
B. Installing the application
This requires a decision on the choice of database to use. Both MariaDB/MySQL and PostgeSQL are offered as option. Install bareos together with the choice of back-end. Using the example below will also install other necessary components. However, the database of choice must be installed first. For RedHat users using MariaDB/MySQL,

yum install bareos bareos-database-mysql bareos-webui

C. Configuring the system
After the program/application files are installed, the database has to be configured. A Bareos database has to be created, the tables within the Bareos database have to be made and the correct privileges assigned.  If this is a fresh server, install  mysql withe the following command

yum install mysql mysql-server
or
yum install mariadb-server

And then start mysql with the command: service mysqld start.

Bareos provides the script files to create the tables necessary. For MySQL/MariaDB the commands are
 
/usr/lib/bareos/scripts/create_bareos_database 
/usr/lib/bareos/scripts/make_bareos_tables 
/usr/lib/bareos/scripts/grant_bareos_privileges

Run these from a privileged or root account. If the database has just been installed, the commands would run without a problem. However, running a system without passwords is dangerous. After testing, secure this by following these instructions.

If your are using MySQL Community Edition version 8 and above, additional steps are required. You must run mysql_secure_installation to set the new root password. Create a ~/.my.cnf file in the root directory. And then run the 3 scripts above. Granting privileges  may cause additional errors if your password validation is set. Set the password in the file /etc/bareos/bareos-dir.d/catalog/MyCatalog.conf.

After configuring MySQL for Bareos, start the Bareos components to start the system
service bareos-dir start
service bareos-fd start
service bareos-sd start

Thankfully, the default installation will not only install the Director, File Daemon (agent) and Storage Daemon but also a working configuration.You can follow the instructions at the official bareos installation to do a sample test.

 If you have a different distribution or an existing server setup, refer to the Bareos installation documentation for more information and options. 

Reference
https://www.svennd.be/installing-bareos-on-centos-7/

Wednesday, April 27, 2016

Installing the Alfresco Document Management system

Alfresco is a document management system that has been around for a while. It has a decent community edition that is clearly geared to push a business using it to use the Enterprise Edition. For small businesses however, it will take a long time to reach that point. It can be also extended with add-ons of varying quality.

Setup is really easy. Techmint has a great how to on how to setup Alfresco together with the Ngnix web server. The instructions are meant to be executed on a dedicated server or a freshly installed server. So preparation for Alfresco itself is minimal. The instructions are clear, explaining what the commands are for as well as showing them. This is great for installing on other Linux distributions because the commands for doing certain actions would be different. Knowing what the command does allows it to be easily replaced. The only known issue is with downloading Alfresco community edition itself. The download speed can be slow and break off. That is why the HOWTO covers that too, using wget to download the installer file. Overall, if a basic document management system is the requirement, Alfresco is the case.