cloudpackがみさんです。

sensuのGraphiteハンドラを使いたい私ですこんばんは。

Amazon LinuxでGraphiteをインストールしようとknife solo cookしたのですが、 Graphiteが利用するDjangoフレームワークが無いとエラーが出てしまいました。

Berksfile

cookbooks "graphite"

run_list

{
    "run_list" : [
          "recipe[graphite]"
    ]
}

エラー

  * package[Django] action install
    * No version specified, and no candidate version available for Django
================================================================================
Error executing action `install` on resource 'package[Django]'
================================================================================


Chef::Exceptions::Package
-------------------------
No version specified, and no candidate version available for Django

解決策

GIthub issueの通り epelリポジトリよりdjangoをインストールしているらしいので”recipe[yum-epel]”しないとNGみたいです。
また、pipでライブラリがインストールされる途中でgccが走るためrecipe[build-essential]も導入しておきます。

{
    "run_list" : [
          "recipe[yum-epel]",
          "recipe[build-essential]"
          "recipe[graphite]"
    ]
}

cook実行

Recipe: graphite::apache
  * execute[create apache basic_auth file for graphite] action run (skipped due to only_if)
  * template[/etc/httpd/sites-available/graphite] action create
    - create new file /etc/httpd/sites-available/graphite
    - update content in file /etc/httpd/sites-available/graphite from none to ab767b
        --- /etc/httpd/sites-available/graphite 2014-05-19 15:23:18.661436542 +0000
        +++ /tmp/chef-rendered-template20140519-370-1s4jcgk     2014-05-19 15:23:18.665436481 +0000
        @@ -1 +1,45 @@
        +# Graphite Apache Virtual Host
        +#
        +# Generated by Chef
        +NameVirtualHost *:80
        +
        +# You may need to manually edit this file to fit your needs.
        +
        +        ServerName graphite
        +        ServerAdmin admin@org.com
        +        DocumentRoot "/opt/graphite/webapp"
        +        ErrorLog /opt/graphite/storage/log/webapp/error.log
        +        CustomLog /opt/graphite/storage/log/webapp/access.log common
        +
        +        Header set Access-Control-Allow-Origin "*"
        +        Header set Access-Control-Allow-Methods "GET, OPTIONS"
        +        Header set Access-Control-Allow-Headers "origin, authorization, accept"
        +
        +
        +        
        +
        +                SetHandler python-program
        +                PythonPath "['/opt/graphite/webapp', '/opt/graphite/lib'] + sys.path"
        +                PythonHandler django.core.handlers.modpython
        +                SetEnv DJANGO_SETTINGS_MODULE graphite.settings
        +                PythonDebug Off
        +                PythonAutoReload Off
        +        
        +
        +        
        +                SetHandler None
        +        
        +
        +        
        +                SetHandler None
        +        
        +
        +
        +       # NOTE: In order for the django admin site media to work you
        +       # must change @DJANGO_ROOT@ to be the path to your django
        +       # installation, which is probably something like:
        +       # /usr/lib/python2.6/site-packages/django
        +        Alias /media/ "@DJANGO_ROOT@/contrib/admin/media/"
        +
        +

  * execute[a2ensite graphite] action run
    - execute /usr/sbin/a2ensite graphite

  * execute[a2dissite 000-default] action run (skipped due to only_if)
Recipe: graphite::carbon_cache_init
  * service[carbon-cache] action restart
    - restart service service[carbon-cache]

Recipe: apache2::default
  * service[apache2] action reload
    - reload service service[apache2]

Recipe: graphite::web
  * execute[set admin password] action run
    - execute /opt/graphite/bin/set_admin_passwd.py root change_me


Running handlers:
Running handlers complete

Chef Client finished, 45/125 resources updated in 129.672336864 seconds

確認

これでOK.良いGraphiteライフを!

img_graphite-django-recipe_01

こちらの記事はなかの人(がみさん)監修のもと掲載しています。
元記事は、こちら