Piwik

stern88
Posts: 134
Joined: Thu Oct 13, 2011 8:03 am

Piwik

Postby stern88 » Fri Dec 23, 2011 10:42 am

Hi!

I'm a proudly Piwik-tester and the first thing I noticed after install was that the apps are not indexed. So - in case Piwik should also be zero conf - there should be a script, which indexes all apps...? Now my idea is this one:
- some sort of implementation in the settings. A tab like "Indexing for Piwik" where the user can choose if he want to monitor his apps or not
- a script for indexing, something like that: //"ATTENTION: very very bad programing, its just a inspiration"

Code: Select all

//============================== // Name : Piwik_Indexer.cpp // Author : RN // Version : // Copyright : none // Description : something in C++, Ansi-style //============================== #include <iostream> #include <fstream> #include <string> //#include "main.h" using namespace std; class Index_managment { private: string indexyes "Index me!"; string indexno "Dont index me!"; public: void write_to_file (element& get_element) { string* ProjektPfad = new string [50]; *ProjektPfad = "/var/hda/web-apps/" strcat (*ProjektPfad, get_element.get_Index.get_name); strcat (*ProjektPfad, "/html/index.php"); ofstream out(*ProjektPfad,ios::app); if (out.is_open()) { out << "Indexed by HDA-Piwik" << endl; if (get_element.get_Index.get_indexmeornot == 0) { out << indexno << endl; out.close(); } else if (get_element-get_Index.get_indexmeornot == 1) { out << indexyes << endl; out.close(); else cout << "Error" << endl; } else { cout << "File not found!" << endl; } } } class element { private: Index my_index; element *next; static int numberofElements; public: element () { //Index = ? next = NULL; numberofElements++; } element (element *firstelement, Index first_index) { next = firstelement; my_Index = first_index; numberofElements++; } void set_index (Index set_index) { my_Index = set_index; } void set_next (element *set_next) { next = set_next; } element* get_next () { return next; } Index get_Index () { return my_index; } ~element () { anzahlElemente--; } static int get_numberofElements () { return numberofElements; } }; static int numberofElements = 0; class Index { private: string name; bool indexmeornot; public: Index(string f, bool yesorno):name(f),indexmeornot(yesorno) { } void set_name (string set_name) { name = set_name; } void set_indexmeornot (bool yesorno) { indexmeornot = yesorno; } string get_name () { return name; } bool get_indexmeornot () { return indexmeornot; } } int main() { return 0; }
However, I hope this "script" helped to explain my idea. Apps are stored in the "class Index" with their name and the value for "indexyesorno". The Apps are managed by "elements", which contains the Apps and the pointer to the next "element". My idea is the "class Index_managment" or "Index_writer" (or something like that) which contains functions for writing and reading the list.

However this script gets realized, the main thing is IMHO: zero conf. The user shouldn't know how to ssh into his Amahi-Box for using Piwik.

At next its IMHO mybe a better idea to write a shell-script with much more easier functions for file-writings like "tee"...? But unfortunatly I'm too stupid for this, so I cant help :( But I can test this script!

Merry X-Mas @ll!
stern

User avatar
bigfoot65
Project Manager
Posts: 11924
Joined: Mon May 25, 2009 4:31 pm

Re: Piwik

Postby bigfoot65 » Tue Dec 27, 2011 7:59 am

Sorry, I don't quite follow. What do you mean by zero conf? I would be glad to update the app, just not sure what to change to meet this requirement.

If you are suggesting to make a change to the Amahi platform for this app, then recommend you file a bug. All installed app info is already stored in the database, so might be able to do something with that.

However, I don't see us modifying the platform to add functionality to one app. We need a solution that can either be integrated with the app or added to the wiki to be done manually.

If I misunderstood, please set me straight.
ßîgƒσστ65
Applications Manager

My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2

stern88
Posts: 134
Joined: Thu Oct 13, 2011 8:03 am

Re: Piwik

Postby stern88 » Thu Jan 26, 2012 10:05 am

Sorry, I don't quite follow. What do you mean by zero conf?
I just mentioned I will write a small "app", which will do the configuration for you. Sorry, my english is bad.

Will be glad, if you try out my program:

1.) unpack PiwikTracker.php.tar.gz to your /tmp/-Folder:

Code: Select all

pts/0 18:02 lux12[16] ls -l /tmp/PiwikTracker.php / -rw-r--r-- 1 rnasucin users 32664 2012-01-26 16:49 /tmp/PiwikTracker.php
2.) unpack test_001.tar.gz anywhere
you need some folders to simulate the piwik-configuration. By default this is:

Code: Select all

/tmp/hdadocroot/
this is your HDA wep-apps-folder. At next you need the folders for your wep-apps, like:

Code: Select all

/tmp/hdadocroot/b4rt/html/
and the index-files, like:

Code: Select all

/tmp/hdadocroot/b4rt/html/index.php
- or -

Code: Select all

/tmp/hdadocroot/b4rt/html/index.html
3.) run the program by typing into your terimal:

Code: Select all

./test_001 --add b4rt
the program will go into your b4rt-docroot:

Code: Select all

/tmp/hdadocroot/b4rt/html/
and will configurate your app (b4rt) for sending informations to your Piwik-tracker.

Please dont use this program to configurate your "real" web-apps.

Hope you like it.
Attachments
PiwikTracker.php.tar.gz
Piwik Tracker source file
(8.46 KiB) Downloaded 888 times
test_001.tar.gz
archive of my project
(161.02 KiB) Downloaded 797 times
Last edited by stern88 on Thu Jan 26, 2012 10:12 am, edited 1 time in total.

stern88
Posts: 134
Joined: Thu Oct 13, 2011 8:03 am

Re: Piwik

Postby stern88 » Thu Jan 26, 2012 10:10 am

By the way: I have send you my source code and the binary. Here is the binary separately
Attachments
test_001.noarch.tar.gz
(72.53 KiB) Downloaded 828 times

User avatar
bigfoot65
Project Manager
Posts: 11924
Joined: Mon May 25, 2009 4:31 pm

Re: Piwik

Postby bigfoot65 » Thu Jan 26, 2012 7:26 pm

I will have to give it a shot when I get time. Would be nice if we could automate this script as part of the install.
ßîgƒσστ65
Applications Manager

My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2

stern88
Posts: 134
Joined: Thu Oct 13, 2011 8:03 am

Re: Piwik

Postby stern88 » Fri Jan 27, 2012 2:42 am

Would be nice if we could automate this script as part of the install.
Yes, this is my idea.

In my opinion it is a good idea to add this program in the crontab for updating. In case the user installs more apps (after installing Piwik), Piwik won't "see" the new apps. Its the final goal to run the program with "--all" in order to index all apps.

This has a disadvantage: mybe the user won't track all apps. In this case the user has to run the program with the postfix "--remove b4rt" in order to remove b4rt from the index. != zero conf

User avatar
bigfoot65
Project Manager
Posts: 11924
Joined: Mon May 25, 2009 4:31 pm

Re: Piwik

Postby bigfoot65 » Fri Jan 27, 2012 6:04 am

Yes, this might be something to add to the wiki. If we add the basic script to index apps on the HDA when Piwik is installed, that will be a start.

Either way, I think wiki guidance will be needed to make this work. It might be worth documenting the whole process and providing the script there for others to try it out.
ßîgƒσστ65
Applications Manager

My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2

stern88
Posts: 134
Joined: Thu Oct 13, 2011 8:03 am

Re: Piwik

Postby stern88 » Fri Jan 27, 2012 9:52 am

providing the script there for others to try it out.
Try it out, I've posted the program here:

Posted: Thu Jan 26, 2012 10:05 am

Who is online

Users browsing this forum: No registered users and 7 guests