Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when creating an Alert Rules based on program name #220

Closed
arno-st opened this issue Dec 13, 2023 · 7 comments
Closed

Error when creating an Alert Rules based on program name #220

arno-st opened this issue Dec 13, 2023 · 7 comments

Comments

@arno-st
Copy link
Contributor

arno-st commented Dec 13, 2023

Describe the bug
When creating an Alet Rules, based on a program name, and SQL error it prompted emtpy:

Note, we could not process all your actions. Details are below.

The SQL Syntax Entered is invalid. Please correct your SQL.

The Pre-processed SQL is:

To Reproduce
1: create an Alert Rules
2: select Match type as program name
3: enter a program name as displayed on the 'System Logs' page
4 click save

Expected behavior
Not an error, just a OK filter saved!

Plugin (please complete the following information):

  • Version: 4.1 latest Develop version (as of december 12)
  • Source: github

Desktop (please complete the following information):

  • OS: AlmaLinux 8
  • Browser firefox
@arno-st
Copy link
Contributor Author

arno-st commented Dec 13, 2023

Whe I do a test with hostname is
the SQL query is the following:
SELECT * FROM `syslog`.`syslog_incoming` WHERE `host_id` = lslmysp11 AND `status` = 100100

I think the problem is the same a program name, you ask for a NAME but the query is based on an ID
And You can't have the ID of the host on the 'Syslog Messages Filter' page,

@arno-st
Copy link
Contributor Author

arno-st commented Jan 12, 2024

I got this error when I try to do a rules with mariadb as program name:

12/01/2024 14:00:24 - ERROR PHP ERROR: Uncaught ValueError: PDO::prepare(): Argument #1 ($query) cannot be empty in /usr/share/cacti/lib/database.php:434 Stack trace: #0 /usr/share/cacti/lib/database.php(434): PDO->prepare() #1 /usr/share/cacti/lib/database.php(727): db_execute_prepared() #2 /usr/share/cacti/plugins/syslog/database.php(167): db_fetch_assoc_prepared() #3 /usr/share/cacti/plugins/syslog/syslog_alerts.php(306): syslog_db_fetch_assoc_prepared() #4 /usr/share/cacti/plugins/syslog/syslog_alerts.php(87): api_syslog_alert_save() #5 /usr/share/cacti/plugins/syslog/syslog_alerts.php(46): form_save() #6 {main} thrown in file: /usr/share/cacti/lib/database.php on line: 434
12/01/2024 14:00:24 - CMDPHP PHP ERROR Backtrace:  (CactiShutdownHandler())

Anyone have any clue ?

@TheWitness
Copy link
Member

Are you running the latest version?

@TheWitness
Copy link
Member

Can you attach a screen shot of the Query Edit page?

@arno-st
Copy link
Contributor Author

arno-st commented Jan 29, 2024

I just update the code from the dev repo (still 4.1), and here is the error I get:

29/01/2024 08:26:30 - CMDPHP PHP ERROR Backtrace:  (CactiShutdownHandler())
--
29/01/2024 08:26:30 - ERROR PHP ERROR: Uncaught ValueError:  PDO::prepare(): Argument #1 ($query) cannot be empty in  /usr/share/cacti/lib/database.php:434 Stack trace: #0  /usr/share/cacti/lib/database.php(434): PDO->prepare() #1  /usr/share/cacti/lib/database.php(727): db_execute_prepared() #2  /usr/share/cacti/plugins/syslog/database.php(167):  db_fetch_assoc_prepared() #3  /usr/share/cacti/plugins/syslog/syslog_alerts.php(306):  syslog_db_fetch_assoc_prepared() #4  /usr/share/cacti/plugins/syslog/syslog_alerts.php(87):  api_syslog_alert_save() #5  /usr/share/cacti/plugins/syslog/syslog_alerts.php(46): form_save() #6  {main} thrown in file: /usr/share/cacti/lib/database.php on line: 434

Edit syslog alert

@TheWitness
Copy link
Member

That screen shot helps.

TheWitness added a commit that referenced this issue Mar 17, 2024
* Error when creating an Alert Rules based on program name
* Preparing for release 4.2
@TheWitness
Copy link
Member

@arno-st , this is fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants