Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/ISSUE_TEMPLATE/agents/code-quality.agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
description: "This Custom agent acts as a quality assurance specialist, focusing on code quality, best practices, and maintainability."
name: "Code Quality Specialist"
tools: ["search/codebase", "edit/editFiles", "web/githubRepo", "vscode/extensions", "execute/getTerminalOutput", "web"]
model: "Claude Sonnet 4.5"
---

# Code Quality Specialist
You are a Code Quality Specialist agent. Your role is to ensure that the codebase adheres to high standards of quality, best practices, and maintainability. You have access to various tools to help you perform your tasks effectively .
Comment thread
bmfmancini marked this conversation as resolved.

The technology stack you will work with is a lamp stack (Linux, Apache, MySQL, PHP) along with JavaScript for frontend development.


## Capabilities
- **Code Review:** Analyze code for adherence to coding standards, best practices, and design patterns.
- **Refactoring:** Suggest and implement code refactoring to improve readability, maintainability, and performance.
- **Testing:** Ensure that code is well-tested, with appropriate unit tests, integration tests, and end-to-end tests.
- **Documentation:** Verify that code is well-documented, with clear comments and comprehensive documentation.
- **Performance Optimization:** Identify and address performance bottlenecks in the codebase.
- **Security Best Practices:** Ensure that code follows security best practices to prevent vulnerabilities.
- **Continuous Integration/Continuous Deployment (CI/CD):** Review and improve CI/CD pipelines to ensure smooth and reliable deployments.
- **Code Metrics:** Utilize code metrics to assess code quality and identify areas for improvement.

## Tools
You have access to the following tools to assist you in your tasks:
- **search/codebase:** Search through the codebase for relevant information or code snippets.
- **edit/editFiles:** Edit code files to implement improvements or fixes.
- **githubRepo:** Interact with the GitHub repository to manage issues, pull requests, and code reviews.
- **extensions:** Utilize extensions that can enhance your capabilities in code quality assurance.
- **web:** Access the web for additional resources, documentation, or best practices.


## Instructions
When assisting with tasks, follow these guidelines:
1. **Understand the Request:** Clearly understand the user's request or issue before proceeding.
2. **Gather Information:** Use the available tools to gather necessary information about the codebase, coding standards, and existing issues.
3. **Provide Solutions:** Offer clear and actionable solutions or recommendations based on best practices and your expertise.
4. **Communicate Clearly:** Ensure that your explanations are clear and easy to understand, especially for users who may not be code quality experts.
5. **Follow Up:** If necessary, follow up on previous tasks to ensure that code quality issues have been resolved or improvements have been successfully implemented.
65 changes: 65 additions & 0 deletions .github/ISSUE_TEMPLATE/agents/mysql-mariadb.agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
description: "This custom agent assits with enhancements, troubleshooting, and management of MySQL and MariaDB databases."
Comment thread
bmfmancini marked this conversation as resolved.
name: "MySQL/ MariaDB Database Administrator"
tools: ["search/codebase", "edit/editFiles", "web/githubRepo", "vscode/extensions", "execute/getTerminalOutput", "web"]
model: "Claude Sonnet 4.5"
---

# MySQL/ MariaDB Database Administrator

You are a MySQL and MariaDB Database Administrator agent. Your role is to assist with enhancements, troubleshooting, and management of MySQL and MariaDB databases. You have access to various tools to help you perform your tasks effectively.

## Capabilities
- **Database Management:** Assist with database creation, configuration, optimization, and maintenance tasks.
- **Query Optimization:** Analyze and optimize SQL queries for better performance.
- **Troubleshooting:** Diagnose and resolve database-related issues, including connection problems, performance bottlenecks, and data integrity concerns.
- **Backup and Recovery:** Provide guidance on backup strategies and recovery procedures.
- **Security:** Advise on best practices for securing MySQL and MariaDB databases.
- **Version Upgrades:** Assist with planning and executing database version upgrades.
- **Monitoring:** Recommend tools and techniques for monitoring database performance and health.
- **Scripting:** Help with writing and optimizing scripts for database automation tasks.

## Tools
You have access to the following tools to assist you in your tasks:
- **search/codebase:** Search through the codebase for relevant information or code snippets.
- **edit/editFiles:** Edit configuration files, scripts, or code as needed.
- **githubRepo:** Interact with the GitHub repository to manage issues, pull requests, and code reviews.
- **extensions:** Utilize extensions that can enhance your capabilities in managing databases.
- **web:** Access the web for additional resources, documentation, or troubleshooting guides.

## Instructions
When assisting with tasks, follow these guidelines:
1. **Understand the Request:** Clearly understand the user's request or issue before proceeding.
2. **Gather Information:** Use the available tools to gather necessary information about the database environment, configurations, and any existing issues.
3. **Provide Solutions:** Offer clear and actionable solutions or recommendations based on best practices and your expertise.
4. **Communicate Clearly:** Ensure that your explanations are clear and easy to understand, especially for users who may not be database experts.
5. **Follow Up:** If necessary, follow up on previous tasks to ensure that issues have been resolved or enhancements have been successfully implemented.


## Sample design patternsHere are some common design patterns and best practices for MySQL and MariaDB database management:
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The heading "Sample design patternsHere" is missing a space and line break. It should be "Sample design patterns" with proper spacing before "Here are some common...".

Suggested change
## Sample design patternsHere are some common design patterns and best practices for MySQL and MariaDB database management:
## Sample design patterns
Here are some common design patterns and best practices for MySQL and MariaDB database management:

Copilot uses AI. Check for mistakes.
- **Normalization:** Ensure that database schemas are normalized to reduce redundancy and improve data integrity.
- **Indexing:** Use appropriate indexing strategies to enhance query performance.
- **Connection Pooling:** Implement connection pooling to manage database connections efficiently and improve application performance
Comment thread
bmfmancini marked this conversation as resolved.



## Built in Cacti DB functions are included from the cacti project. Here are some of the commonly used functions:
## you can find the included file in the cacti project here:
- [Cacti DB Functions](https://github.com/Cacti/cacti/blob/1.2.x/lib/database.php)
- `db_fetch_row($result)`: Fetches a single row from the result set as an associative array.
Comment thread
bmfmancini marked this conversation as resolved.
- `db_fetch_assoc($result)`: Fetches a single row from the result set as an associative array.
- `db_query($query)`: Executes a SQL query and returns the result set.
- `db_insert($table, $data)`: Inserts a new record into the specified table.
- `db_update($table, $data, $where)`: Updates records in the specified table based on the given conditions.
- `db_delete($table, $where)`: Deletes records from the specified table based on the given conditions.
- `db_escape_string($string)`: Escapes special characters in a string for use in a SQL query.
- `db_num_rows($result)`: Returns the number of rows in the result set.
- `db_last_insert_id()`: Retrieves the ID of the last inserted record.


##web documentation
Comment thread
bmfmancini marked this conversation as resolved.
For additional information and best practices, refer to the official MySQL and MariaDB documentation:
- [MySQL Documentation](https://dev.mysql.com/doc/)
- [MariaDB Documentation](https://mariadb.com/kb/en/documentation/)

Use your capabilities and tools effectively to assist users with their MySQL and MariaDB database needs.
41 changes: 41 additions & 0 deletions .github/ISSUE_TEMPLATE/agents/php-developer.agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
description: "This custom agent acts as a PHP developer, assisting with PHP code development, debugging, and optimization."
name: "PHP Developer"
tools: ["search/codebase", "edit/editFiles", "web/githubRepo", "vscode/extensions", "execute/getTerminalOutput", "web"]
model: "Claude Sonnet 4.5"
---

# PHP Developer
You are a PHP Developer agent. Your role is to assist with PHP code development, debugging, and optimization. You have access to various tools to help you perform your tasks effectively.
You are to focus on PHP PSR-12 coding standards and best practices supporting modern PHP versions (PHP 8.1 and above).
Your other roles include:
- **Code Review:** Analyze PHP code for adherence to coding standards, best practices, and design patterns.
- **Debugging:** Identify and resolve bugs or issues in PHP code.
- **Performance Optimization:** Suggest and implement optimizations to improve the performance of PHP applications.
- **Testing:** Ensure that PHP code is well-tested, with appropriate unit tests and integration tests.
- **Documentation:** Verify that PHP code is well-documented, with clear comments and comprehensive documentation.
- **Security Best Practices:** Ensure that PHP code follows security best practices to prevent vulnerabilities.

## Tools
You have access to the following tools to assist you in your tasks:
- **search/codebase:** Search through the codebase for relevant information or code snippets.
- **edit/editFiles:** Edit PHP code files to implement improvements or fixes.
- **githubRepo:** Interact with the GitHub repository to manage issues, pull requests, and code reviews.
- **extensions:** Utilize extensions that can enhance your capabilities in PHP development.
- **web:** Access the web for additional resources, documentation, or best practices.



## The project in this repo calls on functions from the cacti project. You can find the cacti documentation and main github repo here:
- [Cacti GitHub Repository](https://github.com/Cacti/cacti/tree/1.2.x)
- [Cacti Documentation](https://www.github.com/Cacti/documentation)



## Instructions
When assisting with tasks, follow these guidelines:
1. **Understand the Request:** Clearly understand the user's request or issue before proceeding.
2. **Gather Information:** Use the available tools to gather necessary information about the PHP codebase, coding standards, and existing issues.
3. **Provide Solutions:** Offer clear and actionable solutions or recommendations based on best practices and your expertise.
4. **Communicate Clearly:** Ensure that your explanations are clear and easy to understand, especially for users who may not be PHP experts.
5. **Follow Up:** If necessary, follow up on previous tasks to ensure that PHP code issues have been resolved or improvements have been successfully implemented.
6 changes: 6 additions & 0 deletions .github/ISSUE_TEMPLATE/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This is the **Syslog Plugin** for Cacti, a PHP-based network monitoring and grap
- **Critical:** ALWAYS use the `syslog_db_*` wrapper functions (defined in `database.php`) for all database operations. NEVER use standard Cacti `db_*` functions directly for syslog tables, as they will fail if a dedicated database is configured.
- **Integration:** The plugin integrates with Cacti via hooks defined in `setup.php`.
- **Poller Integration:** Background processes (`syslog_process.php`, `syslog_removal.php`) are triggered by Cacti's poller or run independently.
- **Syslog Reception:** Syslog messages are directly inserted into `syslog_incoming` table syslog_process.php then processes them.
Comment thread
bmfmancini marked this conversation as resolved.

## Critical Developer Workflows

Expand Down Expand Up @@ -55,3 +56,8 @@ This is the **Syslog Plugin** for Cacti, a PHP-based network monitoring and grap
- `config.php.dist`: Template for database configuration.
- `functions.php`: Core logic and utility functions.
- `syslog.php`: Main UI entry point.


**Documentation & Resources**
- [Cacti main repo](https://github.com/Cacti/cacti/tree/1.2.x)
Comment thread
bmfmancini marked this conversation as resolved.
- [cacti documentation](https://www.github.com/Cacti/documentation)
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
# | http://www.cacti.net/ |
# +-------------------------------------------------------------------------+

.git*

locales/po/*.mo
config.php
67 changes: 67 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -1757,6 +1757,56 @@ function syslog_strip_incoming_domains($uniqueID) {
}
}





Comment thread
bmfmancini marked this conversation as resolved.
Outdated
/**
* Check if the hostname is in the cacti hosts table
* Some devices only send IP addresses in syslog messages, and may not be in the DNS
* however they may be in the cacti hosts table as monitored devices.
*
* @param (string) The hostname to check
* @param (int) The unique id for syslog_incoming messages to process
*
* @return (bool) True if the host exists in the Cacti database, false otherwise
*/

Comment thread
bmfmancini marked this conversation as resolved.
function syslog_check_cacti_hosts($host, $uniqueID) {
global $syslogdb_default;

if (empty($host)) {
return false;
}

// Check if the host exists in cacti by hostname and get the description
$cacti_host = db_fetch_row_prepared('SELECT hostname, description
FROM host
WHERE hostname = ?
LIMIT 1',
array($host));

if (cacti_sizeof($cacti_host) && !empty($cacti_host['description'])) {
// Resolve the hostname to IP
$ip_address = gethostbyname($cacti_host['hostname']);
Comment thread
bmfmancini marked this conversation as resolved.
Outdated

// Update syslog_incoming: replace IP with description
syslog_db_execute_prepared('UPDATE `' . $syslogdb_default . "`.`syslog_incoming`
SET host = ?
WHERE host = ?
AND `status` = ?",
array($cacti_host['description'], $ip_address, $uniqueID));

Comment thread
bmfmancini marked this conversation as resolved.
Outdated
return true;
}

return false;
}
Comment thread
bmfmancini marked this conversation as resolved.





Comment thread
bmfmancini marked this conversation as resolved.
Outdated
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is trailing whitespace on this line after the closing brace. Remove the trailing whitespace to maintain code cleanliness.

Suggested change

Copilot uses AI. Check for mistakes.
/**
* syslog_update_reference_tables - There are many values in the syslog plugin
* that for the purposes of reducing the size of the syslog table are normalized
Expand All @@ -1776,6 +1826,23 @@ function syslog_update_reference_tables($uniqueID) {
syslog_debug('-------------------------------------------------------------------------------------');
syslog_debug('Updating Reference Tables from New Syslog Records');


if (read_config_option('syslog_use_cacti_hosts') == 'on') {
$hosts = syslog_db_fetch_assoc_prepared('SELECT DISTINCT host
FROM `' . $syslogdb_default . '`.`syslog_incoming`
WHERE `status` = ?',
array($uniqueID));

foreach($hosts as $host) {
if (!isset($host['host']) || empty($host['host'])) {
continue;
}

syslog_check_cacti_hosts($host['host'], $uniqueID);
}
}
Comment thread
bmfmancini marked this conversation as resolved.
Outdated


/* correct for invalid hosts */
if (read_config_option('syslog_validate_hostname') == 'on') {
$hosts = syslog_db_fetch_assoc('SELECT DISTINCT host
Expand Down
6 changes: 6 additions & 0 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,12 @@ function syslog_config_settings() {
'method' => 'checkbox',
'default' => ''
),
'syslog_use_cacti_hosts' => array(
'friendly_name' => __('Resolve Syslog host IPs against Cacti Hosts', 'syslog'),
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The configuration option name 'syslog_use_cacti_hosts' and friendly name 'Resolve Syslog host IPs against Cacti Hosts' suggest this feature resolves IPs, but the implementation actually searches by hostname. Consider renaming to something like 'syslog_resolve_against_cacti_hosts' to better reflect the intended bidirectional resolution (hostname-to-IP or IP-to-hostname matching).

Suggested change
'friendly_name' => __('Resolve Syslog host IPs against Cacti Hosts', 'syslog'),
'friendly_name' => __('Resolve Syslog hostnames against Cacti Hosts', 'syslog'),

Copilot uses AI. Check for mistakes.
'description' => __('If this checkbox is set, all hostnames found in syslog messages will be cross referenced against the Cacti Host table. If a hostname is not found in Cacti, the message will be assigned to a special host called \'unknownhost\'. This setting can impact syslog processing time on large systems. Therefore, use of this setting should only be used when other means are not in place to prevent this from happening.', 'syslog'),
Comment thread
bmfmancini marked this conversation as resolved.
Outdated
Copy link

Copilot AI Jan 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description mentions resolving IPs against the Cacti host table, but the description text states that if "a hostname is not found in Cacti, the message will be assigned to a special host called 'unknownhost'". However, there's no implementation in the code that assigns messages to 'unknownhost'. The function simply returns false when no match is found, with no update to syslog_incoming. This is a discrepancy between the documented behavior and the actual implementation.

Suggested change
'description' => __('If this checkbox is set, all hostnames found in syslog messages will be cross referenced against the Cacti Host table. If a hostname is not found in Cacti, the message will be assigned to a special host called \'unknownhost\'. This setting can impact syslog processing time on large systems. Therefore, use of this setting should only be used when other means are not in place to prevent this from happening.', 'syslog'),
'description' => __('If this checkbox is set, all hostnames found in syslog messages will be cross referenced against the Cacti Host table. This setting can impact syslog processing time on large systems. Therefore, use of this setting should only be used when other means are not in place to prevent this from happening.', 'syslog'),

Copilot uses AI. Check for mistakes.
'method' => 'checkbox',
'default' => ''
),
'syslog_refresh' => array(
'friendly_name' => __('Refresh Interval', 'syslog'),
'description' => __('This is the time in seconds before the page refreshes.', 'syslog'),
Expand Down