Scripted Dashboards for Graphite - json

I am trying to generate dashboards for some metrics using graphite. Ideally, if i would like to display metrics such as CPU usage, Memory, and log statistics stored in graphite whisper DB. Is there any tool (and documentation) such as kibana3 which supports scripted dash-boards. Thanks

Try Grafana (http://grafana.org) it is based on Kibana.

Generated graphs can be configured and saved in the following ways-
1. Dashboard
The dashboard can be accessed at- http://graphite-url/dashboard. Once you display the graph(s), you can configure the size, lineMode, etc. Once done, save the dashboard by going to dashboard -> save as.
2. Composer
While installing graphite webapp, the django user auth details can be used to log into the webapp. Once logged in, every graph will have a save icon on the top-left of the composer window. Saved graphs will be saved under user-graphs, under the metric-tree.
3. Render endpoint
If by 'scripting' you meant content, than rendering, use the render URL endpoint. Generate the required url by script and do something like- http://graphite-host/composer/&target=a.b.c&target=d.*.e.f

Not sure if this is what you mean but for example using the graph-explorer graphite dashboard you can go to "/dashboard/server-basics/insert_hostname_here" and it will server graphs (cpu, memory, diskspace) for the given hostname. you can change the dashboards or add more to do the same things for other metrics.
edit: this does assume that the plugins that it uses were able to parse your metrics.

Related

Strategy for converting JSON to DBM Hash File (AEM with Apache backend)

I'm looking for some solution design assistance, as an idea I thought I could mimic apache's httxt2dbm tool.
Use case:
We currently manage our 301 RewriteRule's in apache for our AEM environment. My co-worker has built a webform for end users to submit their redirect requests and this puts the form data in MongoDB.
Problem:
How can I convert JSON into a dbm hash file like the httxt2bdm tool does?
Any ideas for how to tackle this problem?
The end goal here is that users can fill in the webform, then a cronjob will run and update apache followed by restarting httpd.
I know about the map manager tool but it doesn't really fit the use case.

Open application with browser link

We have a web application which is used to manage a list of main records in a database via a Spring Boot Web server talking to a back-end Java Server.
We also have a JavaFX standalone application which is used to graphically manipulate sub-records of these main web records, using a similar connection to the back-end Java Server.
We want to be able to launch this JavaFX application by clicking on a link next to each of the main records in the web interface. We would like to do this as seemlessly as possible.
At the moment the only way I can think that we can do this, is to use the Browser's 'Applications' set up to associate a particular MIME file type with the standalone JavaFX application, and somehow pass the UID of the record we click on as the 'file' being 'downloaded'.
Trouble is I'm not really sure what I should be googling for, to find out about this download process. For instance, does the browser pass the 'file' in a MIME message that is passed to the application, or does it save the 'file' in a temporary directory and then call the application with the temporary file path?
Has anyone done this sort of thing before, that could give us some pointers?
I don't have a turnkey solution but I think what you are looking for is a custom URI scheme (like the Magnet URI scheme magnet:, mailto:, or tel:).
Here is an article about launching applications using custom browser protocols and here is how to register an application to a URI Scheme on Windows.
You will have to modify the Windows Registry to link your custom protocol to an application, it looks like:
HKEY_CLASSES_ROOT
alert
(Default) = "URL:Alert Protocol"
URL Protocol = ""
DefaultIcon
(Default) = "alert.exe,1"
shell
open
command
(Default) = "C:\Program Files\Alert\alert.exe" "%1"

How to run a python script when a hyperlink is clicked from a webpage?

I have some code on my mac in the latest version of python idle 3, that collects certain data from a csv file that gets sent to myself and prints out the output in the terminal. I want to create a webpage that has a button or link that a user clicks and it runs the code and prints out the output of my program.
Eventually i want to be able to create a website with multiple links that can do the same operation.
Will i need to create an sql database? If so how?...
From the sound of it, you want to use a webpage as a user interface for your python script. Unfortunately without utilising a server-side language this is not possible.
Multiple options exist for reacting to a button press on the server side, with PHP being the most well known, but solutions using only python do exist, such as Flask.
If you're just after a local GUI for your script, simpler options exist within python such as Tk.
Actually you can expose this function using a webserver and then the webpage will call the server with the right url.
Since you are using python I will recommend to take a look at Flask http://flask.pocoo.org/ great micro framework to get you started.

auto complete dropdown with huge and dynamic json file

i am looking for a solution for an auto-complete dropdown box which needs to load entries from a huge json (json file is also being updated / generated every second.)
I tried "typeahead.js" but by default it caches the json file in browser and was not able to display new entries added to json file.
is there a solution for an auto-complete text box which can load entries from the server as fast as possible ?
please suggest.
thanks
In your case, you can take advantage of Bloodhound, the typeahead.js suggestion engine. It provides two options. Prefetch and Remote.
In Prefetch, data is fetched and processed on initialization. If the browser supports local storage, the processed data will be cached there to prevent additional network requests on subsequent page loads.
In Remote, it will fetch data from remote source when ever you need it. But remember, in order to prevent an obscene number of requests being made to the remote endpoint, requests are rate-limited.
I think you should user Remote option in your situation.
Reference : Link
There are two ways which are mentioned in the documentation for typeahead.js
You can make the TTL value = 1 for prefetch ( this did;t work for me )
https://github.com/twitter/typeahead.js/blob/master/doc/bloodhound.md
Or you can use clearPrefetchCache on click page load or click of a button .
category.clearPrefetchCache();

Executing Hudson jobs remotely

I am trying to automate Hudson by hitting the appropriate urls remotely. I am using python's urllib2 for doing the same.
First of all , I am trying to build an existing job and get the build status.
A sample url for the build would look like this:
http://tomcaturl:8080/hudson/job/.NET%20Build/build
However this returns to me html data.
Hudson docs say that I can get data in python/json/xml format, so I try to hit
http://tomcaturl:8080/hudson/job/.NET%20Build/build/api/json
But I get no data at all, although the build happens successfully.
Is there a way to find out which build was started by my remote build request, so that I can maintain a one-to-one mapping.
Please note that I am doing this through a remote python program and I DO NOT have access to hudson GUI.
First of all, if you have any security/login enabled you have to be logged in to the remote hudson server for the /job/JobName/build. If you allow starting the build without being logged in, this is not a problem.
The /job/JobName/build request will return html data. If you are not logged in you will get a repsonse redirecting to the login page and the build will not be started. If the request is successful you will not get a redirect to the login, and you can assume the build was queued. You can also check the build queue using the api url of the project (see below). Note that there may be a delay before the build is started, which you can control by calling /job/JobName/build?delay=0sec
The API is not available under the job/JobName/build url, but you can see api information here:
http://tomcaturl:8080/hudson/job/.NET%20Build/api
Most pages in hudson that shows information (about a project, a specific build and so on) has an api page if you append /api/xml or /api/json to the end of the url.
The reason /job/JobName/build doesn't have an api page is simply because it isn't an url to an information page.
Example api requests:
xml call for information about the project:
http://tomcaturl:8080/hudson/job/.NET%20Build/api/xml
json call for information about the last successful build of the project:
http://tomcaturl:8080/hudson/job/.NET%20Build/lastSucessfulBuild/api/json