How to install and setup Monasca (2/3)

In this part of the tutorial, we will install and configure all Monasca components.

Before building all the other components, we should download all configuration files and do default setups for the log files.

git clone
sudo mkdir -p /var/log/monasca
sudo chmod o+w /var/log/monasca/

A better way would be to group all users from monasca into one group and give write permissions to it.

We will start with building and installing monasca-common as it is a requirement for the other components.

git clone
cd monasca-common
mvn clean install
cd ..

Then we will build and configure monasca-api.

git clone
cd monasca-api
mvn package
cd ..
sudo dpkg -i monasca-api/java/debs/binaries/*.deb
sudo cp monasca-sample-config/monasca-api/api-config.yml /etc/monasca/api/
sudo service monasca-api restart

Now for monasca-persister.

git clone
cd monasca-persister
mvn package
cd ..
sudo dpkg -i monasca-persister/java/debs/binaries/*.deb
sudo cp monasca-sample-config/monasca-persister/persister-config.yml /etc/monasca/persister/
sudo service monasca-persister restart

And now monasca-thresh. Make sure Apache Storm is running before starting the service.

git clone
cd monasca-thresh
mvn package
cd ..
sudo dpkg -i monasca-thresh/thresh/debs/binaries/*.deb
sudo cp monasca-sample-config/monasca-thresh/thresh-config.yml /etc/monasca/thresh/
sudo service monasca-thresh restart

Next one is monasca-notification.

sudo apt-get install python2.7-dev
sudo pip install --upgrade monasca-notification
sudo mkdir -p /etc/monasca/notification
sudo cp monasca-sample-config/monasca-notification/notification-config.yaml /etc/monasca/notification/
sudo adduser --system --group --no-create-home monasca-notification
sudo mkdir -p /var/log/monasca/notification
sudo chown monasca-notification:monasca-notification /var/log/monasca/notification/
sudo -Hu monasca-notification monasca-notification /etc/monasca/notification/notification-config.yaml

And finally, monasca-agent.

sudo apt-get install sysstat -y
sudo pip install --upgrade monasca-agent
sudo monasca-setup -u monasca-agent -p password --project_name monasca -s monitoring --keystone_url http://devstack:35357/v3 --monasca_url http://monasca:8080/v2.0 --config_dir /etc/monasca/agent --log_dir /var/log/monasca/agent --overwrite

Now moving over to Horizon and setting up the UI, you need to connect to your Openstack installation and run the following:

sudo pip install --upgrade monasca-ui python-monascaclient
sudo ln -s /usr/local/lib/python2.7/dist-packages/monitoring/enabled/ /opt/stack/horizon/openstack_dashboard/local/enabled/
sudo ln -s /usr/local/lib/python2.7/dist-packages/monitoring/ /opt/stack/horizon/monitoring
cd /opt/stack
git clone
sudo ln -s /opt/stack/grafana/src/ /opt/stack/horizon/static/grafana
cd /opt/stack/horizon
python compress
sudo service apache2 restart

And now we configure Keystone:

keystone tenant-create --name monasca --description "Monasca tenant"
keystone user-create --name monasca-agent --pass password --tenant [monasca-tenant-id]
keystone user-create --name monasca --pass password --tenant [monasca-tenant-id]
keystone role-create --name monasca-agent
keystone role-create --name monasca-user
keystone user-role-add --user [monasca-agent-id] --role [monasca-agent-role-id] --tenant [monasca-tenant-id]
keystone user-role-add --user [monasca-id] --role [monasca-user-role-id] --tenant [monasca-tenant-id]
keystone service-create --type monitoring --name monasca --description "Monasca monitoring service"
keystone endpoint-create --service [service-id] --publicurl http://monasca:8080/v2.0 --internalurl http://monasca:8080/v2.0 --adminurl http://monasca:8080/v2.0

Testing of the setup is next.


  1. sudo service monasca_api start is not working.

    because monasca-api upstart conf (/etc/init/monasca-api.conf) setgid field value is wrong.
    i changed that value from monasca to monasca-api.

    • mune

      4. March 2015 at 10:24

      You are correct. There are pending changes upstream (user and group normalization) which have not been published yet. In the current form, the group (monasca) needs to be manually created and proper permissions set, or each individual init script needs to be adjusted to the correct user & group combination.

  2. After I did:
    mvn package
    cd ..
    sudo dpkg -i monasca-api/java/debs/binaries/*.deb

    sudo service monasca-api restart still not working.
    There isn’t any service related to monasca, nor any conf file in /etc/init/
    What’s that about?

  3. I have followed the steps, all of them executed successfully but i am unable to start monasca-api service. I also copied monasca-api.conf file to /etc/init directory, still not able to start the service. Either i should stop here untill the problem is fixed or should i do the rest of steps?
    also help me to fix monasca-api service start problem.

  4. @Arslan Qadeer Please post your error , by journalctl -u monasca-api -e -l

  5. Hello, I am also trying to bring the same setup, but I maven build is failing in my case. I have installed the monasca-common package, but still below error is thrown while compiling rest of the packages…Please suggest where could be the problem?

    + whoami
    [INFO] + ME=root
    [INFO] + echo Running as user: root
    [INFO] + MVN=/home/cisco/monasca-thresh/apache-maven-3.2.1/bin/mvn
    [INFO] + BUILD_COMMON=false
    [INFO] Running as user: root
    [INFO] + POM_FILE=/home/cisco/.m2/repository/monasca-common/monasca-common/1.1.0 -SNAPSHOT/monasca-common-1.1.0-SNAPSHOT.pom
    [INFO] + [ ! -r /home/cisco/.m2/repository/monasca-common/monasca-common/1.1.0-S NAPSHOT/monasca-common-1.1.0-SNAPSHOT.pom ]
    [INFO] + check_user root
    [INFO] + ME=root
    [INFO] + [ root != jenkins ]
    [INFO] + echo \nERROR: Download monasca-common and do a mvn install to install t he monasca-commom jars\n
    [INFO] ERROR: Download monasca-common and do a mvn install to install the monasc a-commom jars
    [INFO] + exit 1
    [INFO] ————————————————————————
    [INFO] ————————————————————————
    [INFO] Result of /bin/sh -c cd /home/cisco/monasca-thresh && /home/cisco/monasca -thresh/ 1.1.0-SNAPSHOT org.codehaus.classworlds.Launcher package ex ecution is: ‘1’.
    [INFO] ————————————————————————
    [INFO] For more information, run Maven with the -e switch
    [INFO] ————————————————————————
    [INFO] Total time: 34 seconds
    [INFO] Finished at: Mon Dec 21 16:35:20 IST 2015
    [INFO] Final Memory: 12M/131M
    [INFO] ————————————————————————

  6. Hi,
    Thanks for your work!
    I am hitting below issue while install monasca-api, wondering what commit were you on?
    ubuntu@monasca-node1:~/monasca-api/java$ sudo service monasca-api restart
    monasca-api: unrecognized service

    Thanks again!

    • I manually copied ./devstack/files/monasca-api/monasca-api.conf to /etc/init/
      and change setgid/setuid to root to make it working.
      Not sure if I should creat group monasca and user mon-api?

  7. service monasca-thresh restart faild
    how to fix

Leave a Reply

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