rConfig - CLI Commands
rConfig V7 has a number of very useful CLI commands built-in. The commands are useful if;
- You prefer to use CLI for your configuration management tasks
- You want to extend an Infrastructure as Code platform such as Ansible, or Chef
- You have custom scripts that you would like to run against rConfig
You need to be logged in as root user to run these commands, and you need to be in the rConfig ‘current’ directory.
cd /var/www/html/rconfig7/current
Running the following will output all available Laravel commands but you will also see all rConfig command options. Try to stick to using the rConfig commands unless you have a good knowledge of Laravel.
php artisan
rconfig rconfig:append-compliance-report-data Append report result summary data to a saved compliance report rconfig:archive-logs Will archive x amount of activity log rows or days rconfig:clear-all Clear all cache and config elements for Laravel, NPM and other dependencies rconfig:clear-horizon Clear Horizon Queue History rconfig:config-summaries-sync Sync Config Summaries rconfig:download-api Download api configurations for one or multiple api connections via the CLI rconfig:download-category Download configurations for one or multiple Command Group of devices rconfig:download-device Download configurations for one or multiple devices via the CLI rconfig:download-tag Download configurations for devices with one or multiple tags rconfig:download-task Download configurations for devices with one or multiple tasks rconfig:integration-zabbix In Development: Command to sync Zabbix devices to rConfig via API integration. rconfig:list-categories List all Command Group IDs and names in rConfig rconfig:list-devices List all tag IDs and names in rConfig rconfig:list-snippets List all Snippets in rConfig rconfig:list-tags List all tag IDs and names in rConfig rconfig:list-tasks List all task IDs and names in rConfig rconfig:purge-configs Purge configs older than X days rconfig:purge-failedconfigs Purge failed configs for some or all devices rconfig:report-lastDownload Output report of all devices latest downloaded configs rconfig:run-policy-compliance Send a policy assignment job to the queue rconfig:search-configs Search all config files for a given string rconfig:send-snippet Send a snippet to one or multiple devices via the CLI rconfig:snippet-task Send snippets to devices with one or multiple tasks rconfig:sweep-tftp-dir Sweeps the TFTP directory for files, attempts to match filename to device ID and uploads them to the correct device directory rconfig:sync-search Sync search models with laravel scout rconfig:sync-tasks Sync the schedule of the app with the schedule monitor rconfig:test-script Test BYOC scripts from the command line rconfig:tftp-server Toggle rConfig TFTP on or off rconfig:update-rbac-data Command to update permissions table with new permissions rconfig:update-snippet-roles Update all snippets to ensure they at least have admin have roles attached to them.
All above commands must be run from within the rConfig7 directory, and must be run in the following format.
php artisan rconfig:clear-all
rconfig:append-compliance-report-data
Command Summary
Appends report result summary data to a saved compliance report. This job runs automatically for any new compliance jobs post V7.2.6, but you can run it manually if you need to update a report. You must run this command if you have a compliance report that is missing data, or if you have a report that was created before V7.2.6.
Command Use
php artisan rconfig:append-compliance-report-data
Command Parameters
# Append summary data to a specific compliance report by its IDphp artisan rconfig:append-compliance-report-data 123
# Append summary data to all compliance reportsphp artisan rconfig:append-compliance-report-data
Command Output
rConfig command starting: rconfig:append-compliance-report-data {reportId?}
Dispatching AppendReportDataJob to append data to report: 6c35be97-c725-4f52-b60c-3df6646dec49 ............................................................................................................................................................................... SUCCESS This may take some time. Please do not close this window, or you may need to start the process again. Processing... .......................................................................................................................................................... WORKING Completed dispatching AppendReportDataJob to append data to report: 6c35be97-c725-4f52-b60c-3df6646dec49 ..................................................................................................................................................................... SUCCESS
rConfig Command Completed for all compliance report
rconfig:archive-logs
Command Summary
Archives logs from the logs table.
Command Use
php artisan rconfig:archive-logs --days=7
Command Parameters
#move logs entries older than 7 days to the activity_log_archives tablephp artisan rconfig:archive-logs --days=7#move logs entries older than 7 records to the activity_log_archives tablephp artisan rconfig:archive-logs --rows=7
Command Output
10 logs entries sent to activity log archive table!
rconfig:clear-all
Command Summary
Clear out cached information, reset permissions and generally fix broke-stuff across the application.
Command Use
php artisan rconfig:clear-all
Command Output
------ Begin rConfig Laravel Clear Out! ------Configuration cache cleared!Configuration cached successfully!Application cache cleared!Compiled views cleared!Route cache cleared!Broadcasting queue restart signal.
No config updates to processesDo not run Composer as root/super user! See https://getcomposer.org/root for details> Illuminate\Foundation\ComposerScripts::postAutoloadDump> @php artisan package:discover --ansiGenerated optimized autoload files containing 5419 classes------ End rConfig Laravel Clear Out! ------
rconfig:clear-horizon
Command Summary
Clear out Horizon Queue system
Command Use
php artisan rconfig:clear-horizon
Command Output
All failed jobs deleted successfully.Broadcasting queue restart signal.each individual failed job flushedfailed_jobs flushed
rconfig:config-summaries-sync
Command Summary
Sync Config Count Summaries to the database for faster load times in the UI. This is hard coded to run on a daily basis at 3AM as a scheduled task. See KB artisan (https://portal.rconfig.com/support-center/kb-articles/view/important-post-update-command-for-rconfig-version-723)[https://portal.rconfig.com/support-center/kb-articles/view/important-post-update-command-for-rconfig-version-723]
Command Use
php artisan rconfig:config-summaries-sync
Command Output
Config count sync started! 18/18 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%Config count sync completed!
rconfig:sync-search
Command Summary
Use this command if you are searching for items from the database, such as devices, Command Groups etc.. and you are not getting the full or correct results. Sync database tables with the internal search engine.
Command Use
php artisan rconfig:sync-search
Command Output
Syncing search models...Search models synced.
Download Commands
rconfig:download-category
Command Summary
Run commands on all devices within the specific Command Groups. You can send multiple category IDs as parameters.
Command Use
php artisan rconfig:download-category 1 2
Command Output
Start rconfig:download-category IDs:1Start device download for router1 ID:1001Config downloaded for router1 with command: "show clock" was successfulConfig downloaded for router1 with command: "show version" was successfulConfig downloaded for router1 with command: "show run" was successfulStart device download for router2 ID:1002Config downloaded for router2 with command: "show clock" was successfulConfig downloaded for router2 with command: "show version" was successfulConfig downloaded for router2 with command: "show run" was successfulStart device download for router3 ID:1003Config downloaded for router3 with command: "show clock" was successfulConfig downloaded for router3 with command: "show version" was successfulConfig downloaded for router3 with command: "show run" was successfulStart device download for router4 ID:1004Config downloaded for router4 with command: "show clock" was successfulConfig downloaded for router4 with command: "show version" was successfulConfig downloaded for router4 with command: "show run" was successfulStart device download for router5 ID:1005No config data returned for router5 - ID:1005. Check your logs for more informationEnd rconfig:download-category
rconfig:download-device
Command Summary
Download configurations for given devices. You can send multiple device IDs as parameters.
Command Use
php artisan rconfig:download-device 1002 1003
Command Options
Adding the -d
switch to the above command will cause verbose debugging output for both Telnet and SSH.
Adding the -i
Search for devices by integration_host_id, which is unique to devices that have been imported via the Device Sync integration i.e. Zabbix
php artisan rconfig:download-device 1002 1003 -d
Command Output
Start rconfig:download-device IDs:1002 1003Start device download for router2 ID:1002Config downloaded for router2 with command: "show clock" was successfulConfig downloaded for router2 with command: "show version" was successfulConfig downloaded for router2 with command: "show run" was successfulStart device download for router3 ID:1003Config downloaded for router3 with command: "show clock" was successfulConfig downloaded for router3 with command: "show version" was successfulConfig downloaded for router3 with command: "show run" was successfulEnd rconfig:download-device
rconfig:download-api
Command Summary
Download configurations for given API Collections. You can send multiple API collection IDs as parameters.
Command Use
php artisan rconfig:download-api 500000 500001
Command Options
Adding the -d
switch to the above command will cause verbose debugging output for API connectivity.
php artisan rconfig:download-device 500000 500001 -d
Command Output
Start rconfig:download-device IDs:500000 500001Start device download for router2 ID:500000Config downloaded for Api1 with command: "/users" was successfulStart device download for router3 ID:500001Config downloaded for Api2 with command: "/products" was successfulEnd rconfig:download-device
rconfig:download-tag
Command Summary
Run commands on all devices within the specific tags. You can send multiple Tag IDs as parameters.
Command Use
php artisan rconfig:download-tag 1001
Command Output
Start rconfig:download-tag IDs:1001Start device download for router1 ID:1001Config downloaded for router1 with command: "show clock" was successfulConfig downloaded for router1 with command: "show version" was successfulConfig downloaded for router1 with command: "show run" was successfulEnd rconfig:download-tag
rconfig:download-task
Command Summary
Run commands on all devices within the specific task ID. You can send multiple Task IDs as parameters.
Command Use
php artisan rconfig:download-task 555555 666666
Command Output
This operation can take some time, depending on how many devices are configured for this task!!!Start rconfig:download-task IDs:555555 666666Start device download for router1 ID:1001Config downloaded for router1 with command: "show clock" was successfulConfig downloaded for router1 with command: "show version" was successfulConfig downloaded for router1 with command: "show run" was successfulStart device download for router2 ID:1002Config downloaded for router2 with command: "show clock" was successfulConfig downloaded for router2 with command: "show version" was successfulConfig downloaded for router2 with command: "show run" was successfulEnd rconfig:download-taskStart device download for router2 ID:1002Config downloaded for router2 with command: "show clock" was successfulConfig downloaded for router2 with command: "show version" was successfulConfig downloaded for router2 with command: "show run" was successfulEnd rconfig:download-task
rconfig:fix-latest-config-version
Command Summary
Fixes the latest_version field in the configs table, if there are any duplicate version or other anomalies. Ideally, this is only used on the advice of rConfig support.
Command Use
php artisan rconfig:fix-latest-config-version
rconfig:integration-netbox
Command Summary
Command to sync Netbox devices to rConfig via API integration. All information related to Netbox integration is available in the Netbox Integration section.
Command Use
php artisan rconfig:integration-netbox
rconfig:integration-zabbix
Command Summary
Command to sync Zabbix devices to rConfig via API integration. All information related to Zabbix integration is available in the Zabbix Integration section.
Command Use
php artisan rconfig:integration-zabbix
Command Output
##List Commands
rconfig:list-categories
Command Summary
Lists all configured device Command Groups. The ID is required when running rconfig:download-categories
.
Command Use
php artisan rconfig:list-categories
Command Output
Results for Categories List:+------+---------------+| ID | CATEGORY NAME |+------+---------------+| 1 | Routers || 2 | Switches || 3 | Firewalls || 1010 | devcategory10 |+------+---------------+
rconfig:list-devices
Command Summary
Lists all configured devices. The ID is required when running rconfig:download-device
.
Command Use
php artisan rconfig:list-devices
Command Output
Results for Devices List:+------+-------------+-----------+| ID | DEVICE NAME | DEVICE IP |+------+-------------+-----------+| 1001 | router1 | 10.0.0.5 || 1002 | router2 | 10.0.0.5 || 1003 | router3 | 10.0.0.5 || 1004 | router4 | 10.0.0.5 || 1005 | router5 | 10.0.0.50 |+------+-------------+-----------+
rconfig:list-snippets
Command Summary
Lists all configured command snippets. The ID is required when running rconfig:send-snippet
.
Command Use
php artisan rconfig:list-snippets
Command Output
Results for Snippets List:+------+--------------------------------+------------------------------------+---------------------------------------------+| ID | NAME | DESCRIPTION | SNIPPET |+------+--------------------------------+------------------------------------+---------------------------------------------+| 1 | Set Standard SNMP | Standard SNMP Community and Server | conf t || | | | snmp-server host 1.1.1.1 TESTCOMMUNITY10 || | | | exit || | | | wr mem || | | | exit || 2 | Set Standard SNMP | Standard SNMP Community and Server | conf t || | | | snmp-server host 1.1.1.1 TESTCOMMUNITY20 || | | | exit || | | | wr mem || | | | exit || 3 | Set Standard SNMP | Standard SNMP Community and Server | conf t || | | | snmp-server host 1.1.1.1 TESTCOMMUNITY30 || | | | exit || | | | wr mem || | | | exit || 1000 | Remove all test SNMP Standards | Standard SNMP Community and Server | conf t || | | | no snmp-server host 1.1.1.1 TESTCOMMUNITY10 || | | | no snmp-server host 1.1.1.1 TESTCOMMUNITY20 || | | | no snmp-server host 1.1.1.1 TESTCOMMUNITY30 || | | | exit || | | | wr mem || | | | exit |+------+--------------------------------+------------------------------------+---------------------------------------------+
rconfig:list-tags
Command Summary
Lists all configured tags. The ID is required when running rconfig:download-tag
.
Command Use
php artisan rconfig:list-tags
Command Output
Results for Tags List:+------+----------+| ID | TAGNAME |+------+----------+| 1 | Routers || 2 | Switches || 1001 | devtag1 || 1002 | devtag2 || 1003 | devtag3 || 1010 | devtag10 |+------+----------+
rconfig:list-tasks
Command Summary
Lists all configured tags. The ID is required when running rconfig:download-task
.
Command Use
php artisan rconfig:list-tasks
Command Output
Results for Tasks List:+--------+----------+----------------------+| ID | NAME | DESCRIPTION |+--------+----------+----------------------+| 555555 | DevTask1 | DevTask1 Description || 666666 | DevTask2 | DevTask2 Description || 777777 | DevTask3 | DevTask3 Description |+--------+----------+----------------------+
rconfig::purge-configs
Command Summary
Purge configs older than X days
Command Use
php artisan rconfig:purge-configs
Command Parameters
#Configs files older than X days will be purgedphp artisan rconfig:purge-configs 30
Command Output
Do you wish to continue? (yes|no)[no] (yes/no) [yes]: > yes
Nothing to purge! Thanks!0 Configurations purged for last 30 days!
rconfig::purge-failedconfigs
Command Summary
Clear all failed or invalid configs for many or all devices
Command Use
php artisan rconfig:purge-failedconfigs
Command Parameters
#some or one devices IDsphp artisan rconfig:purge-failedconfigs 1001 1002 1003#All devices will be checked and cleared for invalid config filesphp artisan rconfig:purge-failedconfigs --all
Command Output
php artisan rconfig:purge-failedconfigs --all3 invalid or failed configurations purged!
rconfig:report-lastDownload
Command Summary
CLI based report of all devices latest downloaded configs
Command Use
php artisan rconfig:report-lastDownload
Command Output
Results for Latest Configs List:+----+-----------+-------------+----------+---------+-----------+--------------+| ID | DEVICE ID | DEVICE_NAME | CATEGORY | COMMAND | FILE SZIE | CREATED DATE |+----+-----------+-------------+----------+---------+-----------+--------------+
rconfig:run-policy-compliance
Command Summary
CLI based report of all devices latest downloaded configs
Command Use
php artisan rconfig:run-policy-compliance 1
Command Parameters
# One or many policy assignment IDsphp artisan rconfig:run-policy-compliance 1
Command Output
Starting policy compliance for policy assignment ID (1).Total compliance jobs: 7
100/100 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Completed: Please check the queue manager for detailed information on the Jobs status. https://v6dev1.rconfig.com/horizon/dashboardCompleted: Please check Policy Compliance Reports for information on configuration compliance. https://v6dev1.rconfig.com/policy/reports
rconfig:search-configs
Command Summary
Search configuration files for given text across a given category of devices.
####Options:
{Category : The Category of devices to search.}
{SearchString : The search string. If searching multiple words, wrap in double-quotes.}
{--lines=0 : Number of lines to display before/ after matches.}
Command Use
php artisan rconfig:search-configs Routers snmp
Command Output
.....
-::/var/www/html/rconfig5/storage/app/rconfig/data/Routers/router4/2020/Jun/06/showrun_1320.txt::-151 snmp-server host 1.1.1.1 TESTCOMMUNITY10152 snmp-server host 1.1.1.1 TESTCOMMUNITY30
-::/var/www/html/rconfig5/storage/app/rconfig/data/Routers/router4/2020/Jun/06/SetStandardSNMP_1320.txt::-2 router1(config)#snmp-server host 1.1.1.1 TESTCOMMUNITY30
-::/var/www/html/rconfig5/storage/app/rconfig/data/Routers/router4/2020/Jun/06/showrun_1321.txt::-151 snmp-server host 1.1.1.1 TESTCOMMUNITY10152 snmp-server host 1.1.1.1 TESTCOMMUNITY30
-::/var/www/html/rconfig5/storage/app/rconfig/data/Routers/router4/2020/Jun/07/showrun_000.txt::-151 snmp-server host 1.1.1.1 TESTCOMMUNITY10152 snmp-server host 1.1.1.1 TESTCOMMUNITY30.....
Duration: 161msLine Count: 5666Match Count: 2710File Count: 1478
rconfig:send-snippet
Command Summary
Send a specific command snippet to a given set of devices. Requires
snippetid
deviceid
- One or multiple
Command Use
php artisan rconfig:send-snippet 5 21 22
Command Output
Start rconfig:send-snippet Snippet ID: 1 Device IDs:1001 1002Start snippet send for router1 ID:1001conf tEnter configuration commands, one per line. End with CNTL/Z.router1(config)#snmp-server host 1.1.1.1 TESTCOMMUNITY10router1(config)# exitrouter1#wr memBuilding configuration...
Send snippet for router1 with snippet: "Set Standard SNMP" was successfulStart snippet send for router2 ID:1002conf tEnter configuration commands, one per line. End with CNTL/Z.router1(config)#snmp-server host 1.1.1.1 TESTCOMMUNITY10router1(config)# exitrouter1#wr memBuilding configuration...
Send snippet for router2 with snippet: "Set Standard SNMP" was successfulEnd rconfig:send-snippet
rconfig:snippet-task
Command Summary
Send snippets to devices with one or multiple tasks
taskid
Adding the -d
switch to the above command will cause verbose debugging output for both Telnet and SSH.
Command Use
php artisan rconfig:snippet-task 123456
Command Output
Start rconfig:send-snippet Snippet Task ID: 123456Start snippet send for router1 ID:1001conf tEnter configuration commands, one per line. End with CNTL/Z.router1(config)#snmp-server host 1.1.1.1 TESTCOMMUNITY10router1(config)# exitrouter1#wr memBuilding configuration...
Send snippet for router1 with snippet: "Set Standard SNMP" was successfulStart snippet send for router2 ID:1002conf tEnter configuration commands, one per line. End with CNTL/Z.router1(config)#snmp-server host 1.1.1.1 TESTCOMMUNITY10router1(config)# exitrouter1#wr memBuilding configuration...
Send snippet for router2 with snippet: "Set Standard SNMP" was successfulEnd rconfig:send-snippet
rconfig:sweep-tftp-dir
Command Summary
Sweeps the TFTP directory for files, attempts to match filename to device ID and uploads them to the correct device directory
Command Use
php artisan rconfig:sweep-tftp-dir
Command Output
rconfig:sync-search
Command Summary
Sync search models with laravel scout
Command Use
php artisan rconfig:sync-search
Command Output
rconfig:sync-tasks
Command Summary
Sync the schedule of the app with the schedule monitor
Command Use
php artisan rconfig:sync-tasks
Command Output
rconfig:test-script
Command Summary
Test BYOC scripts from the command line. See the BYOC section for more information.
Command Use
php artisan rconfig:test-script
Command Output
rconfig:tftp-server
Command Summary
Toggle rConfig TFTP on or off
Command Use
php artisan rconfig:tftp-server on/off
rconfig:update-rbac-data
Command Summary
Command to update permissions table with new permissions
Command Use
php artisan rconfig:update-rbac-data
Command Output
rconfig:update-snippet-roles
Command Summary
Update all snippets to ensure they at least have admin have roles attached to them.
Command Use
php artisan rconfig:update-snippet-roles
Command Output