In this post, we will create a custom Nagios NRPE plugin to monitor openerp service. We have named it as check_openerp and it is written in bash script.

You can use this plugin with check_nrpe or check_by_ssh Nagios script.

In our server, we start the openerp service by using command nohup ./openerp-server &
In your server the case might be different, do the changes as per your requirement.

How does check_openerp work?

In check_openerp, we are counting the number of process running by OpenERP service. In case, if its count is zero then it will identify as a Critical alert on Nagios server.

Vice versa , if the openerp processes are one or more then it recognize as normal service with status OK.

Steps to create check_openerp Nagios plugin

Follow the given below steps to create check_openerp Nagios plugin.

Step 1 : Create a file check_openerp in nagios-plugin directory of your system. And paste the given below contents of nagios plugin script.

In my system the location is /usr/lib/nagios/plugins

#!/bin/bash

#Author Sharad Kumar Chhetri
#script is used for checking OpenERP Server status
#

oes=`ps -ef|grep openerp-server|grep -v grep|wc -l`
if [ "$oes" == 1 ]
then
echo "OK: OpenERP Server is running"
exit 0
else
if [ "$oes" == 0 ]
then
echo "CRIT: OpenERP Server is not running"
exit 2
fi
fi

Step 2: After saving the check_openerp file , give permission 755

chmod 755 check_openerp

Once the script is ready, you can use with check_nrpe or check_by_ssh plugin.

Read Some More Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.