Graphite Custom page Creation


We have some procedures to Create the custom page for Graphite. The brief steps are,
   Define the URL path
   Create the Sample page Directory
   Create the Sample page HTML view
   Link the HTML with specific folder
   Call the Html from specific folder using Python


Step 1:
We have to set the URL path in urls.py file which is located in /opt/graphite/webapp/graphite/urls.py . In this file we have some set of line which contain the url paths . So inside of this line we have to add our own web path with the same pattern.
Example: If we have a Directory called Test (With my own functions) then we have to add a line in this file url.py with the same pattern as below,
('^Test/', include('graphite.Test.urls')),
^Test/                                  : This is the URL extension (What we type after localhost)
graphite.Test.urls : Calling the python URL file which is in graphite/test/
Note : URL extensions are Case sensitive .To avoid the complex make all links as lower case
Step 2:
Now we have to create the sample Directory. So to avoid the complex of the implementation we can copy the browser directory which is located in /opt/graphite/webapp/graphite/ and rename the browser directory as Test. Paste it in same location (/opt/graphite/webapp/graphite/) So the Test Directory will contain the same files, which are in default page. Now we can edit the Test folder which contain url.py and views.py files. Each file we have some small changes.
The /opt/graphite/webapp/graphite/test directory contain url.py and views.py. Now change the graphite.browser.views as graphite.test.views to access our own page.
Similar Change the browser.html page as test.html in views.py file.
/opt/graphite/webapp/graphite/templates/test.html
Step 3:
Now we have to Create the HTML page for test with that what we mention above .So for that we have to create html file in /opt/graphite/webapp/graphite/templates/ as test.html.
Step 4:
Design the Page with your own Specification.
So finally we have to work with only three files for custom page creation
urls.py
views.py
test.html
Done.

No comments:

Post a Comment