diff --git a/.github/agents/code-quality.agent.md b/.github/agents/code-quality.agent.md new file mode 100644 index 0000000..02aa9f3 --- /dev/null +++ b/.github/agents/code-quality.agent.md @@ -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: ['vscode/extensions', 'execute/testFailure', 'execute/getTerminalOutput', 'execute/getTaskOutput', 'execute/runInTerminal', 'execute/runTests', 'read', 'edit/createFile', 'edit/editFiles', 'search', '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 . + +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. diff --git a/.github/agents/mysql-mariadb.agent.md b/.github/agents/mysql-mariadb.agent.md new file mode 100644 index 0000000..ee4a602 --- /dev/null +++ b/.github/agents/mysql-mariadb.agent.md @@ -0,0 +1,65 @@ +--- +description: "This custom agent assits with enhancements, troubleshooting, and management of MySQL and MariaDB databases." +name: "MySQL/ MariaDB Database Administrator" +tools: ['vscode/extensions', 'execute/testFailure', 'execute/getTerminalOutput', 'execute/getTaskOutput', 'execute/runInTerminal', 'execute/runTests', 'read', 'edit/createFile', 'edit/editFiles', 'search', '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: +- **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 + + + +## 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. +- `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 +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. \ No newline at end of file diff --git a/.github/agents/php-devloper.agent.md b/.github/agents/php-devloper.agent.md new file mode 100644 index 0000000..4153ea3 --- /dev/null +++ b/.github/agents/php-devloper.agent.md @@ -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: ['vscode/extensions', 'execute/testFailure', 'execute/getTerminalOutput', 'execute/getTaskOutput', 'execute/runInTerminal', 'execute/runTests', 'read', 'edit/createFile', 'edit/editFiles', 'search', '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. diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..34d2af3 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,257 @@ +# Intropage Cacti Plugin Development Guide + +## Project Overview + +This is a Cacti plugin that provides a customizable dashboard/intropage for displaying system metrics, graphs, and monitoring data. The plugin uses a modular panel system where panels collect, display, and trend various Cacti statistics. + +## Architecture + +### Core Components + +1. **Panel Library System** (`panellib/*.php`) - Modular panel definitions organized by category (system, poller, graphs, alerts, etc.) +2. **Hook System** (`setup.php`) - Registers plugin hooks via `api_plugin_register_hook()` to integrate with Cacti core +3. **Database Layer** (`include/database.php`) - Manages plugin-specific tables for panels, dashboards, trends, and user preferences +4. **Display Engine** (`display.php`) - Renders panels on console or dedicated tab with AJAX updates +5. **Poller Integration** (`poller_intropage.php`) - CLI script for background data collection + +### Key Data Flow + +``` +Panel Registration → Panel Definition (DB) → User Authorization → Data Collection (Poller) → Display/Render +``` + +1. Panel libraries register panels via `register_()` functions +2. Panels stored in `plugin_intropage_panel_definition` table +3. User permissions in `plugin_intropage_user_auth` (JSON-encoded) +4. Poller collects data, stores in `plugin_intropage_panel_data` +5. Frontend fetches via AJAX, displays with alarm colors (red/yellow/green/grey) + +## Critical Coding Patterns + +### Panel Library Registration + +Every panel library file (`panellib/*.php`) must have a registration function: + +```php +function register_() { + global $registry; + + $registry['category_name'] = array( + 'name' => __('Display Name', 'intropage'), + 'description' => __('Description', 'intropage') + ); + + $panels = array( + 'panel_id' => array( + 'name' => __('Panel Name', 'intropage'), + 'description' => __('Panel description', 'intropage'), + 'class' => 'category_name', + 'level' => PANEL_SYSTEM, // or PANEL_USER + 'refresh' => 3600, // seconds between updates + 'trefresh' => false, // or seconds for trends + 'force' => true, // allow manual reload + 'width' => 'quarter-panel', // or 'half-panel', 'full-panel' + 'height' => 'normal', // or 'double', 'triple' + 'height_fixed' => false, // prevent user resizing + 'priority' => 10, // display order + 'alarm' => 'grey', // default: grey/green/yellow/red + 'requires' => 'plugin_name', // optional dependency (space-separated) + 'update_func' => 'function_name', // data collection function + 'details_func' => 'detail_function', // or false + 'trends_func' => 'trends_function' // or false + ) + ); + + return $panels; +} +``` + +**Critical**: Function name MUST be `register_` + basename of file (e.g., `system.php` → `register_system()`). + +### Panel Data Collection Functions + +Update functions receive panel metadata and user_id, return data array: + +```php +function panel_update_function($panel, $user_id) { + $result = array( + 'name' => $panel['definition']['name'], + 'alarm' => 'green', // Set based on thresholds + 'data' => '', // HTML content + ); + + // Collect data with proper user device filtering + $allowed_devices = intropage_get_allowed_devices($user_id); + + // Query using prepared statements + $data = db_fetch_assoc_prepared('SELECT ... + WHERE host_id IN (' . $allowed_devices . ')'); + + // Build HTML output + $result['data'] = '
...
'; + + // Save to database + save_panel_result($result, $user_id); + + return $result; +} +``` + +### Database Conventions + +**Always use prepared statements:** + +```php +// Fetch single value +$value = db_fetch_cell_prepared('SELECT column FROM table WHERE id = ?', array($id)); + +// Fetch single row +$row = db_fetch_row_prepared('SELECT * FROM table WHERE id = ?', array($id)); + +// Fetch multiple rows +$rows = db_fetch_assoc_prepared('SELECT * FROM table WHERE user_id = ?', array($user_id)); + +// Execute without return +db_execute_prepared('UPDATE table SET col = ? WHERE id = ?', array($val, $id)); +``` + +**User filtering pattern**: Most queries need `WHERE user_id IN (0, ?)` to include both system-level (user_id=0) and user-specific data. + +### Internationalization (i18n) + +**All user-facing strings MUST use `__()`:** + +```php +__('Text to translate', 'intropage') +__('Format with %s parameter', $value, 'intropage') +__esc('Text needing HTML escaping', 'intropage') +``` + +The third parameter `'intropage'` is the text domain and is **required** for all translations. + +Translation files: `locales/po/*.po` → compiled to `locales/LC_MESSAGES/*.mo` + +### Hook Registration Pattern + +In `setup.php`, all hooks use this pattern: + +```php +api_plugin_register_hook('intropage', 'hook_name', 'callback_function', 'file_path.php'); +api_plugin_register_realm('intropage', 'file.php', 'Description', 1); +``` + +Common hooks: `config_settings`, `top_header_tabs`, `console_after`, `page_head`, `graph_buttons`, `poller_bottom`, `user_admin_tab` + +### User Permissions + +Permissions stored as JSON in `plugin_intropage_user_auth.permissions`: + +```php +// Check single panel permission +if (is_panel_allowed($panel_id, $user_id)) { + // User has access +} + +// Get all allowed panels +$panels = get_allowed_panels($user_id); + +// User group permissions merge with individual permissions (OR logic) +``` + +### Panel Display Lifecycle + +1. `initialize_panel_library()` - Load all panel definitions from `panellib/*.php` +2. `update_registered_panels()` - Sync panel metadata to database +3. `get_panel($panel_id, $user_id)` - Fetch panel data + metadata +4. `get_panel_data()` - Retrieve cached panel content +5. Frontend calls `/intropage.php?action=reload&panel_id=X` for AJAX updates + +### Session and State Management + +```php +$_SESSION['sess_user_id'] // Current user +$_SESSION['dashboard_id'] // Active dashboard (user can have multiple) +$login_opts // 1=default, 2=console, 3=graphs, 4=intropage tab +``` + +## Development Workflows + +### Adding a New Panel + +1. Choose appropriate category file in `panellib/` or create new one +2. Add panel definition to `register_*()` function return array +3. Implement `update_func` to collect data +4. Optionally implement `details_func` for modal view +5. Test by reloading panel library: Console → Settings → Intropage → Force Panel Reload +6. Grant permissions: Console → Users → (edit) → Intropage tab + +### Testing Changes + +- **Manual reload**: Click refresh icon on panel (if `'force' => true`) +- **Poller testing**: Run `php -q poller_intropage.php --debug --force` +- **Database inspection**: Check `plugin_intropage_panel_data` for cached content +- **Frontend**: Check browser console for AJAX errors + +### Common Pitfalls + +1. **Forgot `__()` wrapper**: Strings won't translate +2. **Missing user_id filter**: Shows all data instead of user-authorized devices +3. **Wrong function name**: Must match `register_` pattern +4. **SQL injection**: Always use prepared statements with placeholders +5. **Session conflicts**: Call `session_write_close()` before long operations to unblock other requests +6. **Panel not appearing**: Check `requires` field - dependent plugin may not be installed + +## File Organization + +``` +setup.php - Plugin hooks, install/uninstall +intropage.php - Main entry point (standalone tab mode) +display.php - Rendering logic +poller_intropage.php - Background data collection (CLI) +include/ + functions.php - Core utilities, panel management + database.php - Schema setup/teardown + settings.php - Admin UI configuration + tab.php - Tab integration hooks + variables.php - Configuration arrays +panellib/ - Panel libraries (modular) + system.php - System info panels + poller.php - Poller statistics + graphs.php - Graph management + thold.php - Threshold/alert panels + mactrack.php - MacTrack plugin integration +locales/ - Translation files (gettext) +themes/ - CSS for different Cacti themes +``` + +## External Dependencies + +- **Cacti Core**: Uses Cacti's plugin API, database abstraction, user auth system +- **Optional Plugins**: thold (thresholds), mactrack (MAC tracking), syslog (syslog panels) +- **Frontend**: C3.js/D3.js for charts, jQuery for AJAX +- **PHP**: Requires gettext extension for translations + +## Key Constants + +```php +PANEL_SYSTEM = 0; // System-wide panel (user_id = 0) +PANEL_USER = 1; // Per-user panel data +``` + +## Security Considerations + +1. All user input validated with `get_filter_request_var()` or `get_nfilter_request_var()` +2. Output escaped with `html_escape()` or `__esc()` +3. Realm permissions: `api_user_realm_auth('intropage.php')` gates access +4. Panel permissions: `is_panel_allowed()` checks user/group authorization +5. Device filtering: `intropage_get_allowed_devices()` enforces Cacti device permissions + +## Debugging + +Set Cacti log verbosity: Console → Configuration → Settings → General → Log Level + +Check logs: +- Cacti log: `tail -f /path/to/cacti/log/cacti.log | grep -i intropage` +- Poller debug: `php -q poller_intropage.php --debug` + +Enable panel force reload for immediate testing (set `'force' => true` in panel definition). diff --git a/.github/workflows/plugin-ci-workflow.yml b/.github/workflows/plugin-ci-workflow.yml new file mode 100644 index 0000000..43e5337 --- /dev/null +++ b/.github/workflows/plugin-ci-workflow.yml @@ -0,0 +1,198 @@ +# +-------------------------------------------------------------------------+ +# | Copyright (C) 2004-2025 The Cacti Group | +# | | +# | This program is free software; you can redistribute it and/or | +# | modify it under the terms of the GNU General Public License | +# | as published by the Free Software Foundation; either version 2 | +# | of the License, or (at your option) any later version. | +# | | +# | This program is distributed in the hope that it will be useful, | +# | but WITHOUT ANY WARRANTY; without even the implied warranty of | +# | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | +# | GNU General Public License for more details. | +# +-------------------------------------------------------------------------+ +# | Cacti: The Complete RRDtool-based Graphing Solution | +# +-------------------------------------------------------------------------+ +# | This code is designed, written, and maintained by the Cacti Group. See | +# | about.php and/or the AUTHORS file for specific developer information. | +# +-------------------------------------------------------------------------+ +# | http://www.cacti.net/ | +# +-------------------------------------------------------------------------+ + +name: Plugin Integration Tests + +on: + push: + branches: + - main + - develop + pull_request: + branches: + - main + - develop + +jobs: + integration-test: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + php: ['8.1', '8.2', '8.3'] + os: [ubuntu-latest] + + services: + mysql: + image: mysql:8.0 + env: + MYSQL_ROOT_PASSWORD: cactiroot + MYSQL_DATABASE: cacti + MYSQL_USER: cactiuser + MYSQL_PASSWORD: cactiuser + ports: + - 3306:3306 + options: >- + --health-cmd="mysqladmin ping" + --health-interval=10s + --health-timeout=5s + --health-retries=3 + + name: PHP ${{ matrix.php }} Integration Test on ${{ matrix.os }} + + steps: + - name: Checkout Cacti + uses: actions/checkout@v4 + with: + repository: Cacti/cacti + path: cacti + + - name: Checkout Intropage Plugin + uses: actions/checkout@v4 + with: + path: cacti/plugins/intropage + + - name: Install PHP ${{ matrix.php }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: intl, mysql, gd, ldap, gmp, xml, curl, json, mbstring + ini-values: "post_max_size=256M, max_execution_time=60, date.timezone=America/New_York" + + - name: Check PHP version + run: php -v + + + - name: Run apt-get update + run: sudo apt-get update + + - name: Install System Dependencies + run: sudo apt-get install -y apache2 snmp snmpd rrdtool fping libapache2-mod-php${{ matrix.php }} + + - name: Start SNMPD Agent and Test + run: | + sudo systemctl start snmpd + sudo snmpwalk -c public -v2c -On localhost .1.3.6.1.2.1.1 + + - name: Setup Permissions + run: | + sudo chown -R www-data:runner ${{ github.workspace }}/cacti + sudo find ${{ github.workspace }}/cacti -type d -exec chmod 775 {} \; + sudo find ${{ github.workspace }}/cacti -type f -exec chmod 664 {} \; + sudo chmod +x ${{ github.workspace }}/cacti/cmd.php + sudo chmod +x ${{ github.workspace }}/cacti/poller.php + + - name: Create MySQL Config + run: | + echo -e "[client]\nuser = root\npassword = cactiroot\nhost = 127.0.0.1\n" > ~/.my.cnf + cat ~/.my.cnf + + - name: Initialize Cacti Database + env: + MYSQL_AUTH_USR: '--defaults-file=~/.my.cnf' + run: | + mysql $MYSQL_AUTH_USR -e 'CREATE DATABASE IF NOT EXISTS cacti;' + mysql $MYSQL_AUTH_USR -e "CREATE USER IF NOT EXISTS 'cactiuser'@'localhost' IDENTIFIED BY 'cactiuser';" + mysql $MYSQL_AUTH_USR -e "GRANT ALL PRIVILEGES ON cacti.* TO 'cactiuser'@'localhost';" + mysql $MYSQL_AUTH_USR -e "GRANT SELECT ON mysql.time_zone_name TO 'cactiuser'@'localhost';" + mysql $MYSQL_AUTH_USR -e "FLUSH PRIVILEGES;" + mysql $MYSQL_AUTH_USR cacti < ${{ github.workspace }}/cacti/cacti.sql + mysql $MYSQL_AUTH_USR -e "INSERT INTO settings (name, value) VALUES ('path_php_binary', '/usr/bin/php')" cacti + + - name: Validate composer files + run: | + cd ${{ github.workspace }}/cacti + if [ -f composer.json ]; then + composer validate --strict || true + fi + + - name: Install Composer Dependencies + run: | + cd ${{ github.workspace }}/cacti + if [ -f composer.json ]; then + sudo composer install --prefer-dist --no-progress + fi + + - name: Create Cacti config.php + run: | + cat ${{ github.workspace }}/cacti/include/config.php.dist | \ + sed -r "s/localhost/127.0.0.1/g" | \ + sed -r "s/'cacti'/'cacti'/g" | \ + sed -r "s/'cactiuser'/'cactiuser'/g" | \ + sed -r "s/'cactiuser'/'cactiuser'/g" > ${{ github.workspace }}/cacti/include/config.php + sudo chmod 664 ${{ github.workspace }}/cacti/include/config.php + + + - name: Configure Apache + run: | + cat << 'EOF' | sed 's#GITHUB_WORKSPACE#${{ github.workspace }}#g' > /tmp/cacti.conf + + ServerAdmin webmaster@localhost + DocumentRoot GITHUB_WORKSPACE/cacti + + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + EOF + sudo cp /tmp/cacti.conf /etc/apache2/sites-available/000-default.conf + sudo systemctl restart apache2 + + - name: Install Cacti via CLI + run: | + cd ${{ github.workspace }}/cacti + sudo php cli/install_cacti.php --accept-eula --install --force + + - name: Install Intropage Plugin + run: | + cd ${{ github.workspace }}/cacti + sudo php cli/plugin_manage.php --plugin=intropage --install --enable + + + - name: Check PHP Syntax for Plugin + run: | + cd ${{ github.workspace }}/cacti/plugins/intropage + if find . -name '*.php' -exec php -l {} 2>&1 \; | grep -iv 'no syntax errors detected'; then + echo "Syntax errors found!" + exit 1 + fi + + - name: Run intropage poller + run: | + cd ${{ github.workspace }}/cacti + sudo php cli/poller_intropage.php + + + - name: View Cacti Logs + if: always() + run: | + if [ -f ${{ github.workspace }}/cacti/log/cacti.log ]; then + echo "=== Cacti Log ===" + sudo cat ${{ github.workspace }}/cacti/log/cacti.log + fi + + diff --git a/.gitignore b/.gitignore index 6621d40..d7e4874 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,5 @@ # | http://www.cacti.net/ | # +-------------------------------------------------------------------------+ -.git* locales/po/*.mo diff --git a/CHANGELOG.md b/CHANGELOG.md index 93bec7b..4e97819 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ * feature#335: Add CPU cores/processes information * feature#341: Add info about disabled notify admin * feature#350: Add poller host errors (Cacti 1.3+) +* Add CI workflow and Custom Agents --- 4.0.4 ---