Cacti with sqlite - any interest?

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

muellerjm
Posts: 12
Joined: Tue Jun 04, 2013 12:28 pm

Re: Cacti with sqlite - any interest?

Post by muellerjm »

uff.. found it.. php5-sqlite
thanks. :lol:
beagle1
Posts: 18
Joined: Fri Aug 24, 2012 1:56 am

Re: Cacti with sqlite - any interest?

Post by beagle1 »

You probably haven't got the sqlite driver installed.

try 'apt-get install php5-sqlite'
muellerjm
Posts: 12
Joined: Tue Jun 04, 2013 12:28 pm

Re: Cacti with sqlite - any interest?

Post by muellerjm »

Hello beagle1,

so now i have the problem, what you have described.

I can't generate a Data Template. After save button i got an empty page. Apache log entry:

[Wed Jun 05 08:08:50 2013] [error] [client 2xx.1xx.176.50] PHP Fatal error: pdo error: [0: ] in EXECUTE("SELECT data_input_fields.id as id, data_input_fields.type_code as type_code, data_input_data.value as value, data_input_data.t_value as t_value FROM data_input_fields INNER JOIN (data_template_data INNER JOIN data_input_data ON data_template_data.id = data_input_data.data_template_data_id) ON data_input_fields.id = data_input_data.data_input_field_id WHERE (data_input_fields.input_output='in') AND (data_input_data.t_value='' OR data_input_data.t_value IS NULL) AND (data_input_data.data_template_data_id=75) AND (data_template_data.local_data_template_data_id=0)")\n in /var/www/cacti/lib/adodb/adodb-errorhandler.inc.php on line 77, referer: http://xxx.selfhost.me/cacti/data_templ ... edit&id=52

But it's possible to create a Data Input Methode, Device, Host Template.. etc.

@btw: Data Template is empty... also under Graph Templates (select a Template)

Any Idea? What shoult i try?

... would be soooo great if sqlite3 can be used....
beagle1
Posts: 18
Joined: Fri Aug 24, 2012 1:56 am

Re: Cacti with sqlite - any interest?

Post by beagle1 »

found the issue. edit line 688 in file "data_template.php" in the root of your cacti installation (the middle line in the code below):

original:

Code: Select all

data_template.id,
                data_template.name,
                data_input.name AS data_input_method,
modified:

Code: Select all

data_template.id,
                data_template.name as name,
                data_input.name AS data_input_method,
muellerjm
Posts: 12
Joined: Tue Jun 04, 2013 12:28 pm

Re: Cacti with sqlite - any interest?

Post by muellerjm »

Yeah, great! Data Template fixed.

You have also a look at Graphic Template --> edit? (the same)

hope, hope and Thanx
joe

in Apache log this Error:
1[Wed Jun 05 15:18:29 2013] [error] [client 2xx.xxx.176.50] PHP Fatal error: pdo error: [0: ] in EXECUTE("select graph_templates_item.id as id, graph_templates_item.text_format as text_format, graph_templates_item.value as value, graph_templates_item.hard_return as hard_return, graph_templates_item.graph_type_id as graph_type_id, graph_templates_item.consolidation_function_id as consolidation_function_id, data_template_data.name||' - '||data_template_rrd.data_source_name as data_source_name, cdef.name as cdef_name as cdef_name, colors.hex as hex from graph_templates_item left join data_template_rrd on (graph_templates_item.task_item_id=data_template_rrd.id) left join data_local on (data_template_rrd.local_data_id=data_local.id) left join data_template_data on (data_local.id=data_template_data.local_data_id) left join cdef on (cdef_id=cdef.id) left join colors on (color_id=colors.id) where graph_templates_item.graph_template_id=27 and graph_templates_item.local_graph_id=0 order by graph_templates_item.sequence")\n in /var/www/cacti/lib/adodb/adodb-errorhandler.inc.php on line 77, referer: http://xxxx.selfhost.me/cacti/graph_templates.php
beagle1
Posts: 18
Joined: Fri Aug 24, 2012 1:56 am

Re: Cacti with sqlite - any interest?

Post by beagle1 »

find this line in graph_templates.php:

cdef.name as cdef_name as cdef_name,

and remove the duplicate 'as cdef_name'
muellerjm
Posts: 12
Joined: Tue Jun 04, 2013 12:28 pm

Re: Cacti with sqlite - any interest?

Post by muellerjm »

as always - great job :D

now its time to generate graphs in fhem.de on a Raspberry PI for monitoring several sensors. I would write a german tutorial for beginners and will store it on fhem.wiki.de. Certainly with you as author and a link to your thread. Is it usefull to store the fixed Cacti Installation files on Github?

Thank you
joe


ahhh.. next problem:

i can't save a new data template: (white page)

[Thu Jun 06 07:22:16 2013] [error] [client 2xx.167.176.50] PHP Fatal error: pdo error: [0: ] in EXECUTE("SELECT data_input_fields.id as id, data_input_fields.type_code as type_code, data_input_data.value as value, data_input_data.t_value as t_value FROM data_input_fields INNER JOIN (data_template_data INNER JOIN data_input_data ON data_template_data.id = data_input_data.data_template_data_id) ON data_input_fields.id = data_input_data.data_input_field_id WHERE (data_input_fields.input_output='in') AND (data_input_data.t_value='' OR data_input_data.t_value IS NULL) AND (data_input_data.data_template_data_id=73) AND (data_template_data.local_data_template_data_id=0)")\n in /var/www/cacti/lib/adodb/adodb-errorhandler.inc.php on line 77, referer: http://xx.selfhost.me:800/cacti/data_te ... edit&id=52

help again.. Thank you
muellerjm
Posts: 12
Joined: Tue Jun 04, 2013 12:28 pm

Re: Cacti with sqlite - any interest?

Post by muellerjm »

... hmmm, beagle1 is on unavailable. It's a shame, because a great Community is waiting for a Solution. Is anybody else in a position to found a issue? (A new Data Template could not be saved - get a white Page).

I also tried to find the Problem with DiffDaff etc. Maybe you have a peace of advice to find the problem?

Thank you
Joe
beagle1
Posts: 18
Joined: Fri Aug 24, 2012 1:56 am

Re: Cacti with sqlite - any interest?

Post by beagle1 »

hey this is only my part-time job and it doesn't pay as well as my day job, so be patient!

I couldn't reproduce your problem - perhaps I am not using the same inputs for a data template.. However, I was able to track down and fix the query that you have posted. Edit lib/template.php, find this block of code:

Code: Select all

         /* pull out all custom templated 'input' values from the template itself
         * templated items are selected by querying t_value = '' OR t_value = NULL */
        $template_input_fields = array_rekey(db_fetch_assoc("SELECT " .
                        "data_input_fields.id as id, " .
                        "data_input_fields.type_code as type_code, " .
                        "data_input_data.value as value, " .
                        "data_input_data.t_value as t_value " .
                        "FROM data_input_fields " .
                        "INNER JOIN (data_template_data " .
                        "INNER JOIN data_input_data " .
                        "ON data_template_data.id = data_input_data.data_template_data_id) " .
                        "ON data_input_fields.id = data_input_data.data_input_field_id " .
                        "WHERE (data_input_fields.input_output='in') " .
                        "AND (data_input_data.t_value='' OR data_input_data.t_value IS NULL) " .
                        "AND (data_input_data.data_template_data_id=" . $data_template_data["id"] . ") " .
                        "AND (data_template_data.local_data_template_data_id=0)"), "id", array("type_code", "value", "t_value"));
and replace with:

Code: Select all

        /* pull out all custom templated 'input' values from the template itself
         * templated items are selected by querying t_value = '' OR t_value = NULL */
        $template_input_fields = array_rekey(db_fetch_assoc("SELECT " .
                        "data_input_fields.id as id, " .
                        "data_input_fields.type_code as type_code, " .
                        "data_input_data.value as value, " .
                        "data_input_data.t_value as t_value " .
                        "FROM data_input_fields, " .
                        "data_template_data, " .
                        "data_input_data " .
                        "WHERE data_template_data.id = data_input_data.data_template_data_id " .
                        "AND data_input_fields.id = data_input_data.data_input_field_id " .
                        "AND (data_input_fields.input_output='in') " .
                        "AND (data_input_data.t_value='' OR data_input_data.t_value IS NULL) " .
                        "AND (data_input_data.data_template_data_id=" . $data_template_data["id"] . ") " .
                        "AND (data_template_data.local_data_template_data_id=0)"), "id", array("type_code", "value", "t_value"));
Let me know if this does the trick for you
muellerjm
Posts: 12
Joined: Tue Jun 04, 2013 12:28 pm

Re: Cacti with sqlite - any interest?

Post by muellerjm »

juhuu!!! Now its working! Hope i don't annoy you again. Really great....
muellerjm
Posts: 12
Joined: Tue Jun 04, 2013 12:28 pm

Re: Cacti with sqlite - any interest?

Post by muellerjm »

all o.k.

thank you so much....
muellerjm
Posts: 12
Joined: Tue Jun 04, 2013 12:28 pm

Re: Cacti with sqlite - any interest?

Post by muellerjm »

Hello beagle1,

sorry, there ist another problem. After saving a new data template there is only a view on a white page. So i have to go in the section "Data Templates" again to see the saved Template. Other way is to position the cursor in the url field again and press <ENter> . This is a little bit circular...

to foreclose an error made by myself, i made a fresh installation on my raspberry pi. The same problem occurred again. This problem applies only the data templates section.

Hope you understand my ugly english. Can you help again? I would be very happy...

joe
gcargile
Posts: 9
Joined: Mon Jun 17, 2013 6:10 pm
Location: Mountain View, CA

Re: Cacti with sqlite - any interest?

Post by gcargile »

I too have been following this thread with great interest, as I'm trying to implement cacti using lighttpd and sqlite3 on a Beaglebone Black running Debian. Other platforms (Raspberry Pi) may soon follow if I can get it working on the BBB first.
I've been able to verify that my installation of lighttpd/sqlite3/php5-cgi is working, but I'm stuck at even trying to load the initial Cacti webpage.

The error I'm getting in the lighttpd error.log is this:

(mod_fastcgi.c.2676) FastCGI-stderr: PHP Fatal error: pdo error: [HY000: ] in EXECUTE("select value from ``.`settings` where name='oldplugins'")
in /var/www/cacti-sqlite/cacti/lib/adodb/adodb-errorhandler.inc.php on line 77

Anyone have suggestions where too look, or how to correct whatever needs fixin'?

Cheers!
-Gerry
beagle1
Posts: 18
Joined: Fri Aug 24, 2012 1:56 am

Re: Cacti with sqlite - any interest?

Post by beagle1 »

Hey Joe - for both issues, can you check if there are any errors in your logs?

Gerry - did you load the initial database?
gcargile
Posts: 9
Joined: Mon Jun 17, 2013 6:10 pm
Location: Mountain View, CA

Re: Cacti with sqlite - any interest?

Post by gcargile »

Did I load the initial database....?

Unless I'm overlooking something obvious (wouldn't be the first time), yes... although I get the same error with a zero-length cacti.db. (created by 'touch /var/www/cacti/cacti.db')

For completeness, here are the steps I have taken:
After installation of Debian....
root@BBB-Deb# apt-get install lighttpd sqlite3 php5 php5-cgi php5-common php-pear php5-sqlite

Configure everything and make sure it's working. (following the instructions on this page: http://www.scandio.de/2012/11/setting-u ... d-sqlite3/ )

root@BBB-Deb# cd /var/www
root@BBB-Deb# git clone https://github.com/arjunadeltoso/cacti-sqlite
root@BBB-Deb# ln -s /var/www/cacti-sqlite/cacti /var/www/cacti
root@BBB-Deb# cd /var/www/cacti
root@BBB-Deb# sqlite3 /var/www/cacti/cacti.db < /var/www/cacti/cacti-sqlite.sql
memory <-output from the sql. Does this mean anything useful?

root@BBB-Deb# vi /var/www/cacti/include/config.php
$database_type = "sqlite";
$database_default="";
$database_hostname = "localhost";
$database_username = "";
$database_password = "";
$database_port = "/var/www/cacti/cacti.db";
$database_ssl = false;
$url_path = "/cacti/";

root@BBB-Deb# chown -R www-data:www-data /var/www/
root@BBB-Deb# chmod 770 /var/www/cacti/cacti.db
root@BBB-Deb# /etc/init.d/lighttpd restart

And then from another machine, attempt to open http://bbb-deb/cacti/
I get: HTTP Error 500, and the lighttpd error posted previously.

This is NOT the same "Connection attempt failed: could not find driver] in CONNECT(sqlite:/var/lib/sqlite/cacti.db, '****', '****', )" that muellerjm posted on Jun 04, 2013 2:00 pm. Though I DO get that error if I delete the db and forget to recreate it, or get my $database_port path wrong.

Am I blind?
-Gerry
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests