Tuesday, March 27, 2012

Adding custom services for Windows host to be monitored by Nagios (Monitoring MS SQL Database Table)

Nagios has many in-built services which can be easily configured for a host so that it can be monitored. Services for Windows host like check cpu load, drive space, running processes can be monitored by using various parameters in check_nt command.
While monitoring, situation comes when you have to monitor a specific service which may be a part of an application, size of particular file or a table in database and many others. In these cases, you have to make your own customized program/script to monitor them. Nagios should be configured to run this customized program and get its output and show the service status.

Saturday, March 24, 2012

Kannel–A quick installation and configuration guide

Kannel is free and open source SMS and WAP gateway. It is easy to use, install and configure. This article will describe a quick and easy steps for installing and configuring this gateway for sending and receiving SMS.
Installation
Kannel in based on Linux and can be easily installed from repository. It is available in both aptitude and yum repositories and can be installed right away by giving their respective commands.
apt-get install kannel
or
yum install kannel
If you don’t find it in repository, then you can add more repositories. This link gives guide to add repository to CentOS. You can find for other Linux distribution too.
Configuration
After you install, you will find a file named kannel.conf at /etc/. The configuration file for my modem Nokia30 is shown below.

Monday, March 19, 2012

[Solved] Kinamu Reporter 'Invalid argument supplied' Problem

You might have seen the below error in Kinamu Reporter:
Warning: Invalid argument supplied for foreach() in \modules\KReports\KReportQuery.php on line 401
Warning: reset() expects parameter 1 to be array, null given in \modules\KReports\KReportQuery.php on line 784
Warning: Invalid argument supplied for foreach() in \modules\KReports\KReportQuery.php on line 785

This problem comes when you have not added any field in the selection criteria.
While creating report, on the right panel under Report Definition, you can see 2 things: Selectioncriteria and Display Fields. Problem occurs when you add fields only in Display Field but not in Selectioncriteria.

Let us suppose that you added first name and last name from module contacts in Display Fields, then the query will be:
select first name, last name from contacts

This statement should work but in basic version of Kinamu Reporter, this statement alone does not work. So you need to specify parameters in Selectioncriteria also. Adding parameters in Selectioncriteria means that you are specifying where clause for the query statement. For e.g. if you set first_name = 'Poonam' in Selectioncriteria, then the query will be:
select first name, last name from contacts where first_name = 'Poonam'

This solves the problem.

Thursday, March 15, 2012

Remove 'View Change Log' from SugarCRM Detail View

For 'Contacts' Module

1. Copy file from  'sugarcrm\modules\Contacts\metadata\detailviewdefs.php' to  sugarcrm\custom\modules\Contacts\metadata\detailviewdefs.php

Inside the form array, add 1 line,
'hideAudit' => true,

Go to Admin->Repair->Quick Repair and Rebuild. This will execute the code.

Do the same for other modules replacing 'Contacts' by 'your-module'.

Remove 'Direct Reports' from SugarCRM Contacts subpanel

Create Directory: sugarcrm\custom\Extension\modules\Contacts\Ext\Layoutdefs

Create a file named layoutdefs.ext.php inside this directory with code as below:
<?php unset($layout_defs['Contacts']['subpanel_setup']['contacts']); ?>

Go to Admin->Repair->Quick Repair and Rebuld. This will execute the code

Remove 'Duplicate' from Detail View of SugarCRM

1. Copy file from  'sugarcrm\modules\Contacts\metadata\detailviewdefs.php' to  sugarcrm\custom\modules\Contacts\metadata\detailviewdefs.php

2. Inside the form arrary, you will see an array with values 'edit', 'delete', 'duplicate'. Remove 'duplicate' from the array.

Go to Admin->Repair->Quick Repair and Rebuild. This will execute the code.

Remove 'Import Contacts' from SugarCRM

1. Go to directory: sugarcrm\custom\Extension\modules\Contacts\Ext\Menus
   (Create the directory if you already don't have one)
2. Create a file: menu.ext.php
   
Write the below code in that file

foreach ($final_module_menu as $key => $val){
if($val[1] == $mod_strings['LNK_IMPORT_CONTACTS'])
unset($final_module_menu[$key]);
}

If you check the file sugarcrm\modules\Contacts\Menu.php, you can see the code for all menus that are seen in Action Menu of contacts.

$final_module_menu is the array which contains all those values:
$final_module_array =
Array (
    [0] =>Array ( [0] => index.php?module=Contacts&action=EditView&return_module=Contacts&return_action=index [1] => Create Contact [2] => CreateContacts [3] => Contacts )
    [1] => Array ( [0] => index.php?module=Contacts&action=ImportVCard [1] => Create Contact From vCard [2] => CreateContacts [3] => Contacts )
    [2] => Array ( [0] => index.php?module=Contacts&action=index&return_module=Contacts&return_action=DetailView [1] => View Contacts [2] => Contacts [3] => Contacts )
    [3] => Array ( [0] => index.php?module=Import&action=Step1&import_module=Contacts&return_module=Contacts&return_action=index [1] => Import Contacts [2] => Import [3] => Contacts ) )

So comparing $val[1] with the value of the item we want to remove, gives the required $key value.

After making any changes in the file, go to Admin->Repair->Quick Repair and Rebuild. This will execute the code.

Note: Sugarcrm Version - Sugarcrm 6.0.2