Tuesday, 27 March 2018

Issues: the semaphore value occupied more than the default value.

Error Log: 
[root@sankar ~]#  grep "A semaphore set has to be" /var/log/messages | head
Mar 18 03:05:27 xxx Server Administrator (Shared Library): Data Engine EventID: 0  A semaphore set has to be created but the system limit for the maximum number of semaphore sets has been exceeded
Mar 18 03:05:34 xxx  Server Administrator (Shared Library): Data Engine EventID: 0  A semaphore set has to be created but the system limit for the maximum number of semaphore sets has been exceeded
Mar 18 03:05:34 xxxx Server Administrator (Shared Library): Data Engine EventID: 0  A semaphore set has to be created but the system limit for the maximum number of semaphore sets has been exceeded



[root@sankar ~]# ipcs -ls
------ Semaphore Limits --------
max number of arrays = 128  //default value
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 32
semaphore max value = 32767

Currently occupied values are
[root@sankar ~]#ipcs -s |wc -l
131

So, we need to increase the 128 to some bigger value.
But in our case we’ve find multiple values occupied Nagios. Like as below

[[root@sankar ~]# ipcs -s

------ Semaphore Arrays --------
key        semid      owner      perms      nsems    
0x000000a7 2359296    root      600        1        
0x00000000 2719745    root      600        1        
0x00000000 2752514    root      600        1        
0x00000000 2785283    root      600        1        
0x00000000 3047428    root      600        1        
0x00000000 3014661    root      600        1        
0x00000000 2883590    root      600        1        
0x00000000 2916359    root      600        1        
0x00000000 2949128    root      600        1        
0x00000000 2981897    root      600        1        
0x00000000 3080202    root      600        1        
0x00000000 3112971    root      600        1        
0x00000000 3145740    root      600        1        
0x00000000 3178509    root      600        1        
0x00000000 3211278    root      600        1        
0x00000000 3244047    root      600        1        
0x00000000 3276816    root      600        1        
0x00000000 3309585    root      600        1        
0x00000000 3375122    root      600        1         
0x00000000 3407891    root      600        1        
0x00000000 3440660    root      666        1        
0x00000000 3473429    root      600        1        
0x00000000 3506198    root      600        1        
0x00000000 1875542039 www       600        1        
0x00000000 399966232  www       600        1        
0x00000000 3866649    root      600        1        
0x00000000 3899418    root      600        1        
0x00000000 3932187    root      600        1        
0x00000000 1065222172 www       600        1        
0x00000000 1734672413 www       600        1        
0x00000000 268402718  www       600        1        
0x00000000 991526943  www       600        1        
0x00000000 1003716640 www       600        1        
0x00000000 214138913  www       600        1        
0x00000000 893124642  www       600        1        
0x00000000 12419107   root      600        1        
0x00000000 12451876   root      600        1        
0x00000000 12484645   root      600        1        
0x00000000 12517414   root      600        1        
0x00000000 12550183   root      600        1        
0x00000000 12582952   root      600        1        
0x00000000 12615721   root      600        1        
0x00000000 12648490   root      600        1        
0x00000000 893157419  www       600        1        
0x00000000 892960812  www       600        1        
0x00000000 1351516205 www       600        1        
0x00000000 1351548974 www       600        1         
0x00000000 1351581743 www       600        1        
0x00000000 1351614512 www       600        1        
0x00000000 1378058289 nagios    600        1        
0x00000000 1378091058 nagios    600        1        
0x00000000 1378123827 nagios    600        1        
0x00000000 1378156596 nagios    600        1        
0x00000000 1396604981 nagios    600        1        
0x00000000 1396637750 nagios    600        1        
0x00000000 1396670519 nagios    600        1        
0x00000000 1396703288 nagios    600        1        
0x00000000 1401192505 nagios    600        1        
0x00000000 1401225274 nagios    600        1        
0x00000000 1401258043 nagios    600        1        
0x00000000 1401290812 nagios    600        1        
0x00000000 1405780029 nagios    600        1        
0x00000000 1405812798 nagios    600        1        
0x00000000 1405845567 nagios    600        1        
0x00000000 1405878336 nagios    600        1        
0x00000000 1408041025 nagios    600        1        
0x00000000 1408073794 nagios    600        1        
0x00000000 1408106563 nagios    600        1        
0x00000000 1408139332 nagios    600        1        
0x00000000 1410302021 nagios    600        1        
0x00000000 1410334790 nagios    600        1        
0x00000000 1410367559 nagios    600        1        
0x00000000 1410400328 nagios    600        1        
0x00000000 1421869129 nagios    600        1        
0x00000000 1421901898 nagios    600        1         
0x00000000 1421934667 nagios    600        1        
0x00000000 1421967436 nagios    600        1        
0x00000000 1449721933 nagios    600        1        
0x00000000 1449754702 nagios    600        1        
0x00000000 1449787471 nagios    600        1        
0x00000000 1449820240 nagios    600        1        
0x00000000 2029092945 nagios    600        1        
0x00000000 2029125714 nagios    600        1        
0x00000000 2029158483 nagios    600        1        
0x00000000 993919060  www       600        1        
0x00000000 2029191253 nagios    600        1        
0x00000000 2045313110 nagios    600        1        
0x00000000 2045345879 nagios    600        1        
0x00000000 2045378648 nagios    600        1        
0x00000000 2045411417 nagios    600        1        
0x00000000 2047574106 nagios    600        1        
0x00000000 2047606875 nagios    600        1        
0x00000000 2047639644 nagios    600        1        
0x00000000 2047672413 nagios    600        1        
0x00000000 2049966174 nagios    600        1        
0x00000000 2049998943 nagios    600        1        
0x00000000 2052161632 nagios    600        1        
0x00000000 2052194401 nagios    600        1        
0x00000000 2052227170 nagios    600        1        
0x00000000 2052259939 nagios    600        1        
0x00000000 2054422628 nagios    600        1        
0x00000000 2054455397 nagios    600        1        
0x00000000 2054488166 nagios    600        1        
0x00000000 2054520935 nagios    600        1        
0x00000000 2056683624 nagios    600        1        
0x00000000 2056716393 nagios    600        1        
0x00000000 2056749162 nagios    600        1        
0x00000000 2056781931 nagios    600        1         
0x00000000 2105573484 nagios    600        1        
0x00000000 2105606253 nagios    600        1        
0x00000000 2105639022 nagios    600        1        
0x00000000 2105671791 nagios    600        1        
0x00000000 2107834480 nagios    600        1        
0x00000000 2107867249 nagios    600        1        
0x00000000 2107900018 nagios    600        1        
0x00000000 2107932787 nagios    600        1        
0x00000000 516325492  nagios    600        1        
0x00000000 516358261  nagios    600        1        
0x00000000 516391030  nagios    600        1        
0x00000000 516423799  nagios    600        1        
0x00000000 518586488  nagios    600        1        
0x00000000 1003618425 www       600        1        
0x00000000 518619258  nagios    600        1        
0x00000000 518652027  nagios    600        1        
0x00000000 518684796  nagios    600        1        
0x00000000 520945789  nagios    600        1        
0x00000000 520978558  nagios    600        1        
[root@sankar ~]#

[root@sankar ~]# ipcs -s |grep nagios |wc -l
76

We’ve restart the service nagios-agent and Data Engine(omsa) services.

[root@sankar ~]# service xinetd stop
Stopping xinetd:                                           [  OK  ]

[root@sankar ~]# /etc/init.d/dataeng stop
Stopping Systems Management Data Engine:
Stopping dsm_sa_eventmgrd:                                 [  OK  ]
Stopping dsm_sa_datamgrd:                                  [  OK  ]
[root@sankar ~]# /etc/init.d/dsm_sa_ipmi stop
Stopping dsm_sa_ipmi drivers:                              [  OK  ]
[root@sankar ~]#/etc/init.d/dsm_sa_ipmi start
Starting dsm_sa_ipmi drivers:                              [  OK  ]
[root@sankar ~]# /etc/init.d/dataeng start
Starting Systems Management Data Engine:
Starting dsm_sa_datamgrd:                                  [  OK  ]
Starting dsm_sa_eventmgrd:                                 [  OK  ]
[root@sankar ~]# service xinetd status
xinetd is stopped
[root@sankar ~]#service xinetd start

Starting xinetd:                                           [  OK  ]

Now currently occupied semaphore values like as below and that value under the default threshold.
 [root@sankar ~]## ipcs -s |wc -l
55

Now we did not get the above errors on /var/log/messages.

Upgrade Python from 2.6.x to 2.7.x on RHEL/CentOS 6

Downloading latest Python version:

[root@sankar ~]# cd /opt

[root@sankar ~]#pwd
/opt
[root@sankar ~]# wget http://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz 
--2018-03-23 16:40:12--  http://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz
Resolving www.python.org... 151.101.116.223, 2a04:4e42:1c::223
Connecting to www.python.org|151.101.116.223|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz [following]
--2018-03-23 16:40:12--  https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tar.xz
Connecting to www.python.org|151.101.116.223|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10525244 (10M) [application/octet-stream]
Saving to: “Python-2.7.8.tar.xz”

100%[=========================================================================================>] 10,525,244  --.-K/s   in 0.1s    

2018-03-23 16:40:12 (95.9 MB/s) - “Python-2.7.8.tar.xz” saved [10525244/10525244]

[root@sankar ~]# ls -ltrh
total 24M
-rw-r--r--   1 root    root   9.8M May 11  2013 Python-2.7.5.tar.xz
-rw-r--r--   1 root    root    11M Jun 29  2014 Python-2.7.8.tar.xz
drwxr-xr-x   3 root    root   4.0K Aug 24  2016 sun
drwxr-xr-x   4 root    bin    4.0K Aug 24  2016 SYMCquiesce
-rw-r--r--   1 root    root   3.8M Mar  3  2017 xymon-4.3.28.tar.gz
drwxrwxr-x  16     500 nagios 4.0K Mar  3  2017 xymon-4.3.28
drwxr-xr-x   5 monitor ctsrvp 4.0K Mar 24  2017 monitor
drwx------   7 ansible ctmemp 4.0K Aug  3  2017 ansible
drwxr-xr-x.  2 root    root   4.0K Oct  3 13:05 rh
drwxr-xr-x  18 root    root   4.0K Mar 20 03:46 Python-2.7.5
[root@sankar ~]#

[root@sankar ~]#tar -xvf  Python-2.7.8.tar.xz 
[root@sankar ~]#ls -ltrh
total 24M
-rw-r--r--   1 root    root   9.8M May 11  2013 Python-2.7.5.tar.xz
drwxr-xr-x  17    1000   1000 4.0K Jun 29  2014 Python-2.7.8
-rw-r--r--   1 root    root    11M Jun 29  2014 Python-2.7.8.tar.xz
drwxr-xr-x   3 root    root   4.0K Aug 24  2016 sun
drwxr-xr-x   4 root    bin    4.0K Aug 24  2016 SYMCquiesce
-rw-r--r--   1 root    root   3.8M Mar  3  2017 xymon-4.3.28.tar.gz
drwxrwxr-x  16     500 nagios 4.0K Mar  3  2017 xymon-4.3.28
drwxr-xr-x   5 monitor ctsrvp 4.0K Mar 24  2017 monitor
drwx------   7 ansible ctmemp 4.0K Aug  3  2017 ansible
drwxr-xr-x.  2 root    root   4.0K Oct  3 13:05 rh
drwxr-xr-x  18 root    root   4.0K Mar 20 03:46 Python-2.7.5
[root@sankar ~]#

[root@sankar ~]# ./configure --prefix=/usr/local

[root@sankar ~]# make

[root@sankar ~]# make altinstall


[root@sankar ~]# python2.7 -V
Python 2.7.8
[root@sankar ~]# python2.7
Python 2.7.8 (default, Mar 23 2018, 17:50:22) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-18)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()

Now we need to create a alias from default python path to latest version
[root@sankar ~]#python -V
Python 2.6.6

[root@sankar ~]# vi ~/.bashrc
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
# User specific aliases and functions
alias python=/usr/local/bin/python2.7

[root@sankar ~]#source ~/.bashrc

Now it's shows upgraded version only
[root@sankar ~]#python -V
Python 2.7.8