Friday, July 3, 2015

Crontab: Permission denied


If you get "Permission denied" error message while adding any cron entry, follow these steps to fix the error.


[user@RHEL5 ~]$ crontab -e
-bash: /usr/bin/crontab: Permission denied




1. Check whether the user name is present in /etc/cron.deny file. If yes remove it.

2. Check whether /etc/cron.allow file is present. If yes, add user name to the file.

3. Check for cron related entry in PAM configuration  file.

    [user@RHEL5 ~]$grep "^+.*cron" /etc/security/access.conf

4. Change the file permission of crontab file

    #chmod 4775 /usr/bin/crontab

Wednesday, July 1, 2015

Reconnecting to DevStack screen and restarting the services


When the ./stack.sh is run, it uses screen application to create multiple sessions. Once the DevStack is up and running, you can reconnect to screen and gain control by running

stack@ubuntuvm:~/devstack$ ./rejoin-stack.sh




To view the list of tabs, CTRL+a and then press ". 


Select any tab by pressing the arrow key and hit Enter. To stop the process by pressing CTRL+c and press UP arrow key to view the command. Press enter to start the process again.



To close the screen, press CTRL+A+D.

You can also use screen command instead of rejoin-stack.sh



Screen commands

Next Tab          CTRL+a+n
Previous Tab    CTRL+a+b
Close screen     CTRL+a+d
List tabs           CTRL+a+"













Monday, June 22, 2015

Monitoring OpenStack Queue(AMQP)

RabbitMQ provides command line tool for checking the queue status. 

stack@ubuntuvm:~$ rabbitmqctl list_queues name

stack@ubuntuvm:~$ rabbitmqctl list_exchanges name

RabbitMQ provides web based GUI for monitoring and administration. To enable the management plugin, run

stack@ubuntuvm:~$ sudo rabbitmq-plugins enable rabbitmq_management
The following plugins have been enabled:
  mochiweb
  webmachine
  rabbitmq_web_dispatch
  amqp_client
  rabbitmq_management_agent
  rabbitmq_management
Plugin configuration has changed. Restart RabbitMQ for changes to take effect.


stack@ubuntuvm:~$  sudo service rabbitmq-server restart
 * Restarting message broker rabbitmq-server    


Web GUI can be accessed from http://server-name:15672/ URL.



Tuesday, May 19, 2015

Testing OpenStack REST API using JMeter

OpenStack provides numerous REST APIs for managing various tasks and fetching information. Project website provides a well written API document which can be found here.
APIs are classified based on components and version numbers.


While creating API end points, we need to give  three different URLs namely public, internal and admin and level of access for these endpoints are defined in keystone-paste.ini file.

1. Download JMeter from http://jmeter.apache.org/ and extract the archive.

2. Download JMeter plugins from http://jmeter-plugins.org/ and extract the content into JMeter directory.

3. Create a new JMeter test plan and add "Thread Group" controller with single thread.



4. Add "HTTP Header Manager" Config Element.



5.  In HTTP Request sampler, configure server ip, port  and REST request(In Body Data field).




6.  Configure JSON Path to extract the toke id.



7. Now configure another HTTP Request control to send the API request to the Nova node. Here HTTP request type is GET.



Save the configuration and click on run button. First JMeter will fire a request to Keystone endpoint and token id is obtained. Later token id is extracted using JSon Path and passed to the second API. You can view the results in Result tree.

Monday, May 11, 2015

Run OpenStack on your laptop using DevStack

DevStack requires Ubuntu 14.04 (Trusty Tahr) to run. First create a sudo user in you Linux box.

If you are using any higher version of Ubuntu then you can forcefully run DevStack by setting FORCE environment variable to yes. However you may face issue due to python library mismatch.

export FORCE=yes

Add a new user to run DevStack. This step is optional and DevStack can be run from any sudo user.
Sudo is required since DevStack downloads various  packages and also mounts disk partitions.

groupadd stack
useradd -g stack -s /bin/bash -d /opt/stack -m stack

user@ubuntuvm:~$ id
uid=1001(stack) gid=1001(stack) groups=1001(stack),27(sudo),130(libvirtd)


apt-get install sudo -y
echo "stack ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers


DevStack project is hosted on GIT and therefore install git client if not installed.

sudo apt-get install git -y

git clone https://git.openstack.org/openstack-dev/devstack

To download a specific branch

git clone https://github.com/openstack-dev/devstack.git -b stable/juno devstack/

cd devstack

./stack.sh
First this script will checkout DevStack source code from DevStack repository and it will download and install dependency packages from Ubuntu package repository.

stack.sh uses screen command. Once it is started you can close the terminal. To reconnect to the screen just ./rejoin.sh

To stop DevStack, run

./unstack.sh

This will stop all the processes and close screens.

Configuration file

In DevStack features can be enabled or disabled through local.conf file. I have created a sample local.conf file in which almost all OpenStack components
are enabled.


git clone https://github.com/uttamhoode/devstack

cp local.conf /opt/devstack


Stop DevStack instance and restart it.