The point of no return

Centralized Supervisor Interface: Cesi

28th December 2014 by Ali Erdinç Köroğlu

I already mentioned about supervisor in here. But how about to manage all supervisors from one web interface which has authorization and advanced process management filtering? As you know Supervisord provides a basic web interface to monitor and restart your processes where supervisor installed but XML-RPC interface and API allows you to control remote supervisor and the programs it runs. So it’s possible.. One UI to rule them all..

Here is Cesi (Centralized supervisor interface): it’s a web interface to manage supervisors from single UI, developed by Gülşah Köse and Kaan Özdinçer.

Application Dependencies

  1. Python : a programming language :)
  2. Flask : a microframework for Python
  3. SQlite : a self-contained, serverless, zero-configuration, transactional SQL database engine

I’ll cover everything step by step for CentOS7 minimal installation..
Since Flask is not in CentOS7 or EPEL repositories, I’ll install it via pip. So what is pip? Pip is a tool for installing and managing Python packages from Python Package Index repository. We also need Git (for cesi) and Nginx (you can get nginx from EPEL or from official Nginx repository)

Required CentOS packages

[root@supervisord ~]# yum install python-pip sqlite git nginx

Flask installation

[root@supervisord ~]# pip install flask

Getting a clone from github

[root@supervisord ~]# cd /opt/
[root@supervisord opt]# git clone

Initial database operations

[root@supervisord cesi]# sqlite3 /opt/cesi/cesi/userinfo.db < userinfo.sql

Conf file should be in /etc

[root@supervisord cesi]# mv /opt/cesi/cesi/cesi.conf /etc

Let us define some remote supervisors

username = superv
password = superv1q2w3e
host =
port = 9001
username = superv
password = superv
host =
port = 9001
members = srv4, srv10
database = /root/cesi/cesi/userinfo.db
activity_log = /root/cesi/cesi/cesi_activity.log

Since cesi will run by nginx user /opt/cesi should be accessible for it

[root@supervisord opt]# chown -R nginx:nginx /opt/cesi

We’ll run cesi via supervisord :)

command=/bin/python /opt/cesi/cesi/

Flask will initialise twice the application in debug mode and when you try to stop via supervisord it will not stop.

root     17614  0.0  0.3 227168 12632 ?        Ss   21:05   0:00 /usr/bin/python /usr/bin/supervisord
nginx    17723  6.5  0.4 235768 16684 ?        S    21:36   0:00 /bin/python /opt/cesi/cesi/
nginx    17728  6.5  0.4 309592 16936 ?        Sl   21:36   0:00 /bin/python /opt/cesi/cesi/
[root@supervisord cesi]# supervisorctl stop cesi
cesi: stopped
[root@supervisord cesi]# ps aux
root     17614  0.0  0.3 227320 12664 ?        Ss   21:05   0:00 /usr/bin/python /usr/bin/supervisord
nginx    17728  0.5  0.4 309592 16936 ?        Sl   21:36   0:01 /bin/python /opt/cesi/cesi/
root     17738  0.0  0.0 123356  1380 pts/0    R+   21:40   0:00 ps aux
[root@supervisord cesi]# supervisorctl stop cesi
cesi: ERROR (not running)

As you see it’s not stopped, so simplest thing would be to change use_reloader in

---	2014-12-27 21:23:37.625143414 +0200
+++	2014-12-27 21:23:48.222118215 +0200
@@ -531,7 +531,7 @@
     if __name__ == '__main__':
-, use_reloader=True)
+, use_reloader=False)
 except xmlrpclib.Fault as err:
     print "A fault occurred"
     print "Fault code: %d" % err.faultCode

Working like a charm..

[root@supervisord cesi]# supervisorctl start cesi
cesi: started
[root@supervisord cesi]# ps aux| grep cesi
nginx    17704  0.2  0.4 237048 18232 ?        S    21:30   0:00 /bin/python /opt/cesi/cesi/

System side is ok and let us configure the nginx..

server {
        server_name localhost;
        location / {
                proxy_set_header Host $http_host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        location /static {
                root /opt/cesi/cesi/;

Let’s check TCP sockets

[root@supervisord cesi]# netstat -anp| grep LISTEN       
tcp        0      0*               LISTEN      17761/python        
tcp        0      0*               LISTEN      17614/python        
tcp        0      0    *               LISTEN      17842/nginx: master 
tcp        0      0*               LISTEN      852/sshd

It’s time to login..

Login screen


All supervisors in one screen

A node

A process log

Kudos goes to Gülşah and Kaan and that’s all folks..

A New Supervisord Plugin for Nagios

23rd December 2014 by Ali Erdinç Köroğlu

In my last entry I mentioned about Supervisord and how beautiful it is. While I’m looking for how to integrate Supervisord to Nagios I couldn’t find what I’m looking for so I decided to write a new supervisord plugin for nagios. What I was looking for is a plugin works on Nagios server (so no need to install remote servers) to get information about processes from remote supervisords. So here it is.. check_supervisor

Usage: -H -P 9001 -u superv -p superv -a glassfish
  -h, --help     
  -H HOSTNAME, --hostname=HOSTNAME (Supervisord hostname)
  -P PORT, --port=PORT (Supervisord port)
  -u USERNAME, --username=USERNAME (Supervisord username)
  -p PASSWORD, --password=PASSWORD (Supervisord password)
  -a PROCNAME, --process-name=PROCNAME (Process name defined in /etc/supervisor.d/*.ini or supervisorctl status)

Console Output:

[root@nagios ~]# /usr/lib64/nagios/plugins/ -H -P 9001 -u superv -p superv -a glassfish
glassfish OK: 12 day(s) 17 hour(s) 29 minute(s)

You should add the new command definition for check_supervisord into nagios’s commands.cfg

define command{
    command_name    check_supervisord
    command_line    $USER1$/ -H $HOSTADDRESS$ -P $ARG1$ -u $ARG2$ -p $ARG3$ -a $ARG4$

And you can use in a definition like this :)

define service {
    use generic-service
    host_name   srv1
    service_description Glassfish
    check_command   check_supervisord!9001!superv!superv!glassfish

A screenshot from nagios web interface

How to install IBM Director Common Linux Agent 6.3.5 on CentOS6

29th October 2014 by Ali Erdinç Köroğlu

If you’ve IBM hardware you already know about IBM Director, if you dont please leave now :)
As may know IBM only supports IBM Systems Director Common Agent 6.3.5 for RHEL5, RHEL6, SLES10 and SLES11 distributions. So what about CentOS6 users ??

Dont panic..

1. Discover your X86 server from Director Inventory
2. Give root permission for SSH access to Director and finish request access stage
3. Download the latest common agent from IBM website into the server where IBM Director is running!
4. Import the latest agent from Director > Release Management > Agents
5. Goto System x Management > View System x servers and operating systems
6. Find you server’s IP address and right click it
7. Choose Release Management > Install Agent
8. Follow Agent Installation steps but you gonna select CommonAgent 6.3.5 xLinux and finish installation agent.

Dont worry you’ll get errors :)
At this stage IBM Director is copied releated files into you server’s /tmp/commonagent_tmp directory, so let’s begin..

[root@dbs ~]# cd /tmp/commonagent_tmp/
[root@dbs commonagent_tmp]# mkdir rpm
[root@dbs commonagent_tmp]# ./dir6.3.5_commonagent_linux_x86 -x rhel6 -p rpm/
[1-Agree|0-Disagree]: 1
Extracting RPM files to rpm/
654801 blocks

Now we have rhel6 releated rpms..

[root@dbs commonagent_tmp]# cd rpm/
[root@dbs rpm]# ls
brocade_adapter_cimprovider-     ibmcim-baseserver-6.3.5-rhel6.i386.rpm        ibmcim-snmp-5.2.1-rhel6.i386.rpm                                ibmcim-baseserver-mof-6.3.5-1.i386.rpm        ibmcim-snmpextensions-6.3.5-rhel6.i386.rpm
diruninstall.agent                                   ibmcim-icu-36.0-rhel6.i386.rpm                ibmcim-ssl-
dsa-2.26-rhel6.i386.rpm                              ibmcim-instrumentation-6.3.5-rhel6.i386.rpm   install
emulex_fc_provider_ibm-    ibmcim-network-6.3.5-rhel6.i386.rpm           ISDCommonAgent-6.3.5-1.noarch.rpm
emulex_ucna_provider_ibm-  ibmcim-network-mof-6.3.5-1.i386.rpm           Lib_Utils-1.00-09.noarch.rpm
ibmcim-6.3.5-rhel6.i386.rpm                          ibmcim-objectmanager-6.3.5-rhel6.i386.rpm     lsi_mr_hhr-00.50.0506-rhel6.i386.rpm
ibmcim-agentextensions-6.3.5-rhel6.i386.rpm          ibmcim-openslp-2.1.1636-rhel6.i386.rpm        qlogic_cna_providers-1.5.6-rhel6.i386.rpm
ibmcim-agentextensions-mof-6.3.5-1.i386.rpm          ibmcim-sblim-2.2.8-1rhel6.i386.rpm            setup.lin
ibmcim-baseos-6.3.5-rhel6.i386.rpm                   ibmcim-serviceprocessor-6.3.5-rhel6.i386.rpm
ibmcim-baseos-mof-6.3.5-1.i386.rpm                   ibmcim-serviceprocessor-mof-6.3.5-1.i386.rpm
[root@dbs rpm]#

Apply my patch to install file..

---	2014-10-28 23:24:55.208104735 +0200
+++ install	2014-10-28 23:46:12.973181647 +0200
@@ -70,8 +70,8 @@
 # Distribution list and versions
-DISTROS="redhat-release redhat-release-server redhat-release-workstation sled-release sles-release SUSE_SLES_SAP-release SLES-for-VMware-release release vmware-esx-vmware-release-4"
-SUPPORTED_RELEASES="rhel5 rhel6 sles10 sles11"
+DISTROS="redhat-release redhat-release-server redhat-release-workstation centos-release sled-release sles-release SUSE_SLES_SAP-release SLES-for-VMware-release release vmware-esx-vmware-release-4"
+SUPPORTED_RELEASES="rhel5 rhel6 centos6 sles10 sles11"
 # RPM attributes
@@ -336,6 +336,13 @@
 	return 1
+        [ "${1}" == "centos-release-6" ] && \
+                RELEASE=rhel6 && BINARY_COMPAT_RELEASE=rhel6 && return 0
+        return 1
 	if [ "${1}" == "sles-release-10" ] || \
@@ -2453,6 +2460,8 @@
 	[ $1 == "redhat-release-server" ] || \
 	[ $1 == "redhat-release-workstation" ] && \
 	    RELEASE_RPM=$(rpm --qf '%{name}-%{version}\n' -q --whatprovides /etc/redhat-release)
+	[ $1 == "centos-release" ] && \
+            RELEASE_RPM=$(rpm --qf '%{name}-%{version}\n' -q --whatprovides /etc/redhat-release)
 	[ $1 == "sles-release" ] || \
 	[ $1 == "SUSE_SLES_SAP-release" ] || \
 	[ $1 == "SLES-for-VMware-release" ] || \

And then install the agent :)

[root@dbs rpm]# wget
--2014-10-29 02:08:42--
Connecting to||:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1413 (1.4K) [application/octet-stream]
Saving to: “install.patch”
100%[==============================================================================>] 1,413       --.-K/s   in 0s      
2014-10-29 02:08:47 (265 MB/s) - “install.patch” saved [1413/1413]
[root@dbs rpm]# patch -p0 < install.patch 
patching file install
[root@dbs rpm]# ./install -ivs -p /tmp/commonagent_tmp/rpm

PS: You may need to install pam.i686 before installation.

WordPress Flexform Theme Revslider space fix

23rd August 2013 by Ali Erdinç Köroğlu

If you’re having troubles 5 or 10px empty space at the bottom of your revolution slider after updating flexform (v1.5) and revslider (3.0.7) to latest version, you can apply this patch.

--- wordpress/wp-content/themes/flexform/page.php.old	2013-08-09 01:02:04.000000000 +0200
+++ wordpress/wp-content/themes/flexform/page.php	2013-08-23 17:48:53.000000000 +0200
@@ -106,7 +106,7 @@
 		<div class="page-content clearfix">
 			<?php the_content(); ?>			
-			<div class="link-pages"><?php wp_link_pages(); ?></div>
+			<!--<div class="link-pages"><?php wp_link_pages(); ?></div>-->
 		<?php } ?>