CaMM plugin v1.6.5 issue when editing new rule

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

User avatar
gthe
Cacti User
Posts: 410
Joined: Sat Jul 29, 2006 1:23 pm
Location: RU

Post by gthe »

You can also just open existed rule, open sql filter window and then press Done.
After that - check cacti.log
My cacti plugin -[url=http://forums.cacti.net/viewtopic.php?p=156769#156769]CaMM[/url]
[size=75]Sorry for my English. [/size]
galerien
Posts: 33
Joined: Wed Feb 11, 2009 12:16 pm
Location: Geneva

Post by galerien »

I had reloaded the CAMM pluggin, then I was able to create a rule from a syslog entry, here are the log related to this :

01/19/2010 12:38:31 PM - camm: Poller[0] php [camm_convert_json_to_sql_string] [sql_where]=[((((host is null AND facility is null) AND priority is null) AND sys_date=STR_TO_DATE('2010-01-19 11:59:41','%Y-%m-%d %H:%i:%s')) AND message is null)]

01/19/2010 12:38:31 PM - camm: Poller[0] php [getSQL] [operatorId]=[STRING_EQUAL] [fieldId]=[message] [values]=[] [return]=[message is null]

01/19/2010 12:38:31 PM - camm: Poller[0] php [getSQL] [operatorId]=[DATE_EQUAL] [fieldId]=[sys_date] [values]=[2010-01-19 11:59:41] [return]=[sys_date=STR_TO_DATE('2010-01-19 11:59:41','%Y-%m-%d %H:%i:%s')]

01/19/2010 12:38:31 PM - camm: Poller[0] php [getSQL] [operatorId]=[STRING_EQUAL] [fieldId]=[priority] [values]=[] [return]=[priority is null]

01/19/2010 12:38:31 PM - camm: Poller[0] php [getSQL] [operatorId]=[STRING_EQUAL] [fieldId]=[facility] [values]=[] [return]=[facility is null]

01/19/2010 12:38:31 PM - camm: Poller[0] php [getSQL] [operatorId]=[STRING_EQUAL] [fieldId]=[host] [values]=[] [return]=[host is null]

01/19/2010 12:38:31 PM - camm: Poller[0] php [camm_convert_json_to_sql_string] [raw_json_where]=[{\"left\":{\"left\":{\"left\":{\"left\":{\"fieldId\":\"host\",\"operatorId\":\"STRING_EQUAL\",\"values\":[{\"label\":\"172.xx.yy.14\",\"value\":\"172.xx.yy.14\"}]},\"logicalOperator\":\"AND\",\"right\":{\"fieldId\":\"facility\",\"operatorId\":\"STRING_EQUAL\",\"values\":[{\"label\":\"local7\",\"value\":\"local7\"}]}},\"logicalOperator\":\"AND\",\"right\":{\"fieldId\":\"priority\",\"operatorId\":\"STRING_EQUAL\",\"values\":[{\"label\":\"notice\",\"value\":\"notice\"}]}},\"logicalOperator\":\"AND\",\"right\":{\"fieldId\":\"sys_date\",\"operatorId\":\"DATE_EQUAL\",\"values\":[{\"value\":\"2010-01-19 11:59:41\",\"label\":\"2010-01-19 11:59:41\"}]}},\"logicalOperator\":\"AND\",\"right\":{\"fieldId\":\"message\",\"operatorId\":\"STRING_EQUAL\",\"values\":[{\"label\":\"5514: Jan 19 11:59:40: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet3/0/16, changed state to up\",\"value\":\"5514: Jan 19 11:59:40: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet3/0/16, changed state to up\"}]}}]
User avatar
gthe
Cacti User
Posts: 410
Joined: Sat Jul 29, 2006 1:23 pm
Location: RU

Post by gthe »

So, the problem is in JSON decode.
The most simple - install the module json to php.
If this does not help, then we will continue to debug file JSON.sql
My cacti plugin -[url=http://forums.cacti.net/viewtopic.php?p=156769#156769]CaMM[/url]
[size=75]Sorry for my English. [/size]
galerien
Posts: 33
Joined: Wed Feb 11, 2009 12:16 pm
Location: Geneva

Post by galerien »

I already have the json extension installed :

PHP Extensions - libxml, xml, session, pcre, SimpleXML, SPL, standard, Reflection, filter, date, apache2handler, ctype, dom, gd, iconv, json, mysql, mysqli, PDO, pdo_mysql, pdo_sqlite, snmp, sockets, SQLite, timezonedb, tokenizer, xmlreader, xmlrpc, zlib

What should I do ?
reinstall PHP ?

Give me some advises please...
User avatar
gthe
Cacti User
Posts: 410
Joined: Sat Jul 29, 2006 1:23 pm
Location: RU

Post by gthe »

galerien wrote:I already have the json extension installed :

PHP Extensions - libxml, xml, session, pcre, SimpleXML, SPL, standard, Reflection, filter, date, apache2handler, ctype, dom, gd, iconv, json, mysql, mysqli, PDO, pdo_mysql, pdo_sqlite, snmp, sockets, SQLite, timezonedb, tokenizer, xmlreader, xmlrpc, zlib
Yes, sorry, I did not notice right away.
then try to use another json module that came with the plugin. For this in the file camm_functions.php replace the line

Code: Select all

if (function_exists('json_decode')) {
to

Code: Select all

if (function_exists('json_decode_1')) {
and

Code: Select all

if (function_exists('json_encode')) {
to

Code: Select all

if (function_exists('json_encode_1')) {
And try...
My cacti plugin -[url=http://forums.cacti.net/viewtopic.php?p=156769#156769]CaMM[/url]
[size=75]Sorry for my English. [/size]
User avatar
gthe
Cacti User
Posts: 410
Joined: Sat Jul 29, 2006 1:23 pm
Location: RU

Post by gthe »

delete
My cacti plugin -[url=http://forums.cacti.net/viewtopic.php?p=156769#156769]CaMM[/url]
[size=75]Sorry for my English. [/size]
galerien
Posts: 33
Joined: Wed Feb 11, 2009 12:16 pm
Location: Geneva

Post by galerien »

delete ?
User avatar
gthe
Cacti User
Posts: 410
Joined: Sat Jul 29, 2006 1:23 pm
Location: RU

Post by gthe »

:D
No, I just sent a double-one and the same post.
My second post should be removed.
My cacti plugin -[url=http://forums.cacti.net/viewtopic.php?p=156769#156769]CaMM[/url]
[size=75]Sorry for my English. [/size]
galerien
Posts: 33
Joined: Wed Feb 11, 2009 12:16 pm
Location: Geneva

Post by galerien »

Fantastic !!!!!!

THANKS YOU VERY VERY MUCH...

:P :lol: :lol: :P

It's working fine now :lol: :P :lol:

01/19/2010 02:45:10 PM - camm: Poller[0] php [camm_convert_json_to_sql_string] [sql_where]=[((((host='172.xx.yy.14' AND facility='local7') AND priority='notice') AND sys_date=STR_TO_DATE('2010-01-19 11:59:41','%Y-%m-%d %H:%i:%s')) AND message='5514: Jan 19 11:59:40: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet3/0/16, changed state to up')]

01/19/2010 02:45:10 PM - camm: Poller[0] php [getSQL] [operatorId]=[STRING_EQUAL] [fieldId]=[message] [values]=[5514: Jan 19 11:59:40: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet3/0/16, changed state to up] [return]=[message='5514: Jan 19 11:59:40: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet3/0/16, changed state to up']

01/19/2010 02:45:10 PM - camm: Poller[0] php [getSQL] [operatorId]=[DATE_EQUAL] [fieldId]=[sys_date] [values]=[2010-01-19 11:59:41] [return]=[sys_date=STR_TO_DATE('2010-01-19 11:59:41','%Y-%m-%d %H:%i:%s')]

01/19/2010 02:45:10 PM - camm: Poller[0] php [getSQL] [operatorId]=[STRING_EQUAL] [fieldId]=[priority] [values]=[notice] [return]=[priority='notice']

01/19/2010 02:45:10 PM - camm: Poller[0] php [getSQL] [operatorId]=[STRING_EQUAL] [fieldId]=[facility] [values]=[local7] [return]=[facility='local7']

01/19/2010 02:45:10 PM - camm: Poller[0] php [getSQL] [operatorId]=[STRING_EQUAL] [fieldId]=[host] [values]=[172.xx.yy.14] [return]=[host='172.xx.yy.14']

01/19/2010 02:45:10 PM - camm: Poller[0] php [camm_convert_json_to_sql_string] [raw_json_where]=[{\"left\":{\"left\":{\"left\":{\"left\":{\"fieldId\":\"host\",\"operatorId\":\"STRING_EQUAL\",\"values\":[{\"label\":\"172.xx.yy.14\",\"value\":\"172.xx.yy.14\"}]},\"logicalOperator\":\"AND\",\"right\":{\"fieldId\":\"facility\",\"operatorId\":\"STRING_EQUAL\",\"values\":[{\"label\":\"local7\",\"value\":\"local7\"}]}},\"logicalOperator\":\"AND\",\"right\":{\"fieldId\":\"priority\",\"operatorId\":\"STRING_EQUAL\",\"values\":[{\"label\":\"notice\",\"value\":\"notice\"}]}},\"logicalOperator\":\"AND\",\"right\":{\"fieldId\":\"sys_date\",\"operatorId\":\"DATE_EQUAL\",\"values\":[{\"value\":\"2010-01-19 11:59:41\",\"label\":\"2010-01-19 11:59:41\"}]}},\"logicalOperator\":\"AND\",\"right\":{\"fieldId\":\"message\",\"operatorId\":\"STRING_EQUAL\",\"values\":[{\"label\":\"5514: Jan 19 11:59:40: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet3/0/16, changed state to up\",\"value\":\"5514: Jan 19 11:59:40: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet3/0/16, changed state to up\"}]}}]

thanks again
User avatar
gthe
Cacti User
Posts: 410
Joined: Sat Jul 29, 2006 1:23 pm
Location: RU

Post by gthe »

Thus, the problem was in some of the modules php.
It is a pity that we could not ascertain where.
And after each update, you will need so the same comment on these lines.

Do not forget to return all the file back without additional debug lines.
My cacti plugin -[url=http://forums.cacti.net/viewtopic.php?p=156769#156769]CaMM[/url]
[size=75]Sorry for my English. [/size]
galerien
Posts: 33
Joined: Wed Feb 11, 2009 12:16 pm
Location: Geneva

Post by galerien »

a last question could you explain me please what's the difference between the 2 functions the original one and the new one ?

Could you please explain me why my installation is not working with the original camm_functions.php file ?

If I upgrade camm, in the futur, I will have to modify the camm_functions.php file again ?

thanks for the response to this non urgent questions.
I like to understand things ...
galerien
Posts: 33
Joined: Wed Feb 11, 2009 12:16 pm
Location: Geneva

Post by galerien »

thnks
User avatar
gthe
Cacti User
Posts: 410
Joined: Sat Jul 29, 2006 1:23 pm
Location: RU

Post by gthe »

galerien wrote:a last question could you explain me please what's the difference between the 2 functions the original one and the new one ?

Could you please explain me why my installation is not working with the original camm_functions.php file ?

If I upgrade camm, in the futur, I will have to modify the camm_functions.php file again ?

thanks for the response to this non urgent questions.
I like to understand things ...
Yes, This will make use json module from the file JSON.php rather than built-in json php module.
But the next time after updating PHP - try using the native php module - perhaps it will work.
My cacti plugin -[url=http://forums.cacti.net/viewtopic.php?p=156769#156769]CaMM[/url]
[size=75]Sorry for my English. [/size]
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests