Skip to content

rConfig - CLI Commands

10 mins V7 Pro V6 Core

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.

Terminal window
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.

Terminal window
php artisan
Terminal window
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.

Terminal window
php artisan rconfig:clear-all

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.

Terminal window
php artisan rconfig:append-compliance-report-data
Terminal window
# Append summary data to a specific compliance report by its ID
php artisan rconfig:append-compliance-report-data 123
# Append summary data to all compliance reports
php artisan rconfig:append-compliance-report-data
Terminal window
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

Archives logs from the logs table.

Terminal window
php artisan rconfig:archive-logs --days=7
Terminal window
#move logs entries older than 7 days to the activity_log_archives table
php artisan rconfig:archive-logs --days=7
#move logs entries older than 7 records to the activity_log_archives table
php artisan rconfig:archive-logs --rows=7
Terminal window
10 logs entries sent to activity log archive table!

Clear out cached information, reset permissions and generally fix broke-stuff across the application.

Terminal window
php artisan rconfig:clear-all
Terminal window
------ 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 processes
Do not run Composer as root/super user! See https://getcomposer.org/root for details
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Generated optimized autoload files containing 5419 classes
------ End rConfig Laravel Clear Out! ------

Clear out Horizon Queue system

Terminal window
php artisan rconfig:clear-horizon
Terminal window
All failed jobs deleted successfully.
Broadcasting queue restart signal.
each individual failed job flushed
failed_jobs flushed

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]

Terminal window
php artisan rconfig:config-summaries-sync
Terminal window
Config count sync started!
18/18 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Config count sync completed!

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.

Terminal window
php artisan rconfig:sync-search
Terminal window
Syncing search models...
Search models synced.

Run commands on all devices within the specific Command Groups. You can send multiple category IDs as parameters.

Terminal window
php artisan rconfig:download-category 1 2
Terminal window
Start rconfig:download-category IDs:1
Start device download for router1 ID:1001
Config downloaded for router1 with command: "show clock" was successful
Config downloaded for router1 with command: "show version" was successful
Config downloaded for router1 with command: "show run" was successful
Start device download for router2 ID:1002
Config downloaded for router2 with command: "show clock" was successful
Config downloaded for router2 with command: "show version" was successful
Config downloaded for router2 with command: "show run" was successful
Start device download for router3 ID:1003
Config downloaded for router3 with command: "show clock" was successful
Config downloaded for router3 with command: "show version" was successful
Config downloaded for router3 with command: "show run" was successful
Start device download for router4 ID:1004
Config downloaded for router4 with command: "show clock" was successful
Config downloaded for router4 with command: "show version" was successful
Config downloaded for router4 with command: "show run" was successful
Start device download for router5 ID:1005
No config data returned for router5 - ID:1005. Check your logs for more information
End rconfig:download-category

Download configurations for given devices. You can send multiple device IDs as parameters.

Terminal window
php artisan rconfig:download-device 1002 1003

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

Terminal window
php artisan rconfig:download-device 1002 1003 -d
Terminal window
Start rconfig:download-device IDs:1002 1003
Start device download for router2 ID:1002
Config downloaded for router2 with command: "show clock" was successful
Config downloaded for router2 with command: "show version" was successful
Config downloaded for router2 with command: "show run" was successful
Start device download for router3 ID:1003
Config downloaded for router3 with command: "show clock" was successful
Config downloaded for router3 with command: "show version" was successful
Config downloaded for router3 with command: "show run" was successful
End rconfig:download-device

Download configurations for given API Collections. You can send multiple API collection IDs as parameters.

Terminal window
php artisan rconfig:download-api 500000 500001

Adding the -d switch to the above command will cause verbose debugging output for API connectivity.

Terminal window
php artisan rconfig:download-device 500000 500001 -d
Terminal window
Start rconfig:download-device IDs:500000 500001
Start device download for router2 ID:500000
Config downloaded for Api1 with command: "/users" was successful
Start device download for router3 ID:500001
Config downloaded for Api2 with command: "/products" was successful
End rconfig:download-device

Run commands on all devices within the specific tags. You can send multiple Tag IDs as parameters.

Terminal window
php artisan rconfig:download-tag 1001
Terminal window
Start rconfig:download-tag IDs:1001
Start device download for router1 ID:1001
Config downloaded for router1 with command: "show clock" was successful
Config downloaded for router1 with command: "show version" was successful
Config downloaded for router1 with command: "show run" was successful
End rconfig:download-tag

Run commands on all devices within the specific task ID. You can send multiple Task IDs as parameters.

Terminal window
php artisan rconfig:download-task 555555 666666
Terminal window
This operation can take some time, depending on how many devices are configured for this task!!!
Start rconfig:download-task IDs:555555 666666
Start device download for router1 ID:1001
Config downloaded for router1 with command: "show clock" was successful
Config downloaded for router1 with command: "show version" was successful
Config downloaded for router1 with command: "show run" was successful
Start device download for router2 ID:1002
Config downloaded for router2 with command: "show clock" was successful
Config downloaded for router2 with command: "show version" was successful
Config downloaded for router2 with command: "show run" was successful
End rconfig:download-task
Start device download for router2 ID:1002
Config downloaded for router2 with command: "show clock" was successful
Config downloaded for router2 with command: "show version" was successful
Config downloaded for router2 with command: "show run" was successful
End rconfig:download-task

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.

Terminal window
php artisan rconfig:fix-latest-config-version

Command to sync Netbox devices to rConfig via API integration. All information related to Netbox integration is available in the Netbox Integration section.

Terminal window
php artisan rconfig:integration-netbox

Command to sync Zabbix devices to rConfig via API integration. All information related to Zabbix integration is available in the Zabbix Integration section.

Terminal window
php artisan rconfig:integration-zabbix

##List Commands

Lists all configured device Command Groups. The ID is required when running rconfig:download-categories.

Terminal window
php artisan rconfig:list-categories
Terminal window
Results for Categories List:
+------+---------------+
| ID | CATEGORY NAME |
+------+---------------+
| 1 | Routers |
| 2 | Switches |
| 3 | Firewalls |
| 1010 | devcategory10 |
+------+---------------+

Lists all configured devices. The ID is required when running rconfig:download-device.

Terminal window
php artisan rconfig:list-devices
Terminal window
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 |
+------+-------------+-----------+

Lists all configured command snippets. The ID is required when running rconfig:send-snippet.

Terminal window
php artisan rconfig:list-snippets
Terminal window
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 |
+------+--------------------------------+------------------------------------+---------------------------------------------+

Lists all configured tags. The ID is required when running rconfig:download-tag.

Terminal window
php artisan rconfig:list-tags
Terminal window
Results for Tags List:
+------+----------+
| ID | TAGNAME |
+------+----------+
| 1 | Routers |
| 2 | Switches |
| 1001 | devtag1 |
| 1002 | devtag2 |
| 1003 | devtag3 |
| 1010 | devtag10 |
+------+----------+

Lists all configured tags. The ID is required when running rconfig:download-task.

Terminal window
php artisan rconfig:list-tasks
Terminal window
Results for Tasks List:
+--------+----------+----------------------+
| ID | NAME | DESCRIPTION |
+--------+----------+----------------------+
| 555555 | DevTask1 | DevTask1 Description |
| 666666 | DevTask2 | DevTask2 Description |
| 777777 | DevTask3 | DevTask3 Description |
+--------+----------+----------------------+

Purge configs older than X days

Terminal window
php artisan rconfig:purge-configs
Terminal window
#Configs files older than X days will be purged
php artisan rconfig:purge-configs 30
Terminal window
Do you wish to continue? (yes|no)[no] (yes/no) [yes]:
> yes
Nothing to purge! Thanks!
0 Configurations purged for last 30 days!

Clear all failed or invalid configs for many or all devices

Terminal window
php artisan rconfig:purge-failedconfigs
Terminal window
#some or one devices IDs
php artisan rconfig:purge-failedconfigs 1001 1002 1003
#All devices will be checked and cleared for invalid config files
php artisan rconfig:purge-failedconfigs --all
Terminal window
php artisan rconfig:purge-failedconfigs --all
3 invalid or failed configurations purged!

CLI based report of all devices latest downloaded configs

Terminal window
php artisan rconfig:report-lastDownload
Terminal window
Results for Latest Configs List:
+----+-----------+-------------+----------+---------+-----------+--------------+
| ID | DEVICE ID | DEVICE_NAME | CATEGORY | COMMAND | FILE SZIE | CREATED DATE |
+----+-----------+-------------+----------+---------+-----------+--------------+

CLI based report of all devices latest downloaded configs

Terminal window
php artisan rconfig:run-policy-compliance 1
Terminal window
# One or many policy assignment IDs
php artisan rconfig:run-policy-compliance 1
Terminal window
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/dashboard
Completed: Please check Policy Compliance Reports for information on configuration compliance. https://v6dev1.rconfig.com/policy/reports

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.}

Terminal window
php artisan rconfig:search-configs Routers snmp
Terminal window
.....
-::/var/www/html/rconfig5/storage/app/rconfig/data/Routers/router4/2020/Jun/06/showrun_1320.txt::-
151 snmp-server host 1.1.1.1 TESTCOMMUNITY10
152 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 TESTCOMMUNITY10
152 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 TESTCOMMUNITY10
152 snmp-server host 1.1.1.1 TESTCOMMUNITY30
.....
Duration: 161ms
Line Count: 5666
Match Count: 2710
File Count: 1478

Send a specific command snippet to a given set of devices. Requires

snippetid

deviceid - One or multiple

Terminal window
php artisan rconfig:send-snippet 5 21 22
Terminal window
Start rconfig:send-snippet Snippet ID: 1 Device IDs:1001 1002
Start snippet send for router1 ID:1001
conf t
Enter configuration commands, one per line. End with CNTL/Z.
router1(config)#snmp-server host 1.1.1.1 TESTCOMMUNITY10
router1(config)# exit
router1#wr mem
Building configuration...
Send snippet for router1 with snippet: "Set Standard SNMP" was successful
Start snippet send for router2 ID:1002
conf t
Enter configuration commands, one per line. End with CNTL/Z.
router1(config)#snmp-server host 1.1.1.1 TESTCOMMUNITY10
router1(config)# exit
router1#wr mem
Building configuration...
Send snippet for router2 with snippet: "Set Standard SNMP" was successful
End rconfig:send-snippet

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.

Terminal window
php artisan rconfig:snippet-task 123456
Terminal window
Start rconfig:send-snippet Snippet Task ID: 123456
Start snippet send for router1 ID:1001
conf t
Enter configuration commands, one per line. End with CNTL/Z.
router1(config)#snmp-server host 1.1.1.1 TESTCOMMUNITY10
router1(config)# exit
router1#wr mem
Building configuration...
Send snippet for router1 with snippet: "Set Standard SNMP" was successful
Start snippet send for router2 ID:1002
conf t
Enter configuration commands, one per line. End with CNTL/Z.
router1(config)#snmp-server host 1.1.1.1 TESTCOMMUNITY10
router1(config)# exit
router1#wr mem
Building configuration...
Send snippet for router2 with snippet: "Set Standard SNMP" was successful
End rconfig:send-snippet

Sweeps the TFTP directory for files, attempts to match filename to device ID and uploads them to the correct device directory

Terminal window
php artisan rconfig:sweep-tftp-dir
Terminal window

Sync search models with laravel scout

Terminal window
php artisan rconfig:sync-search
Terminal window

Sync the schedule of the app with the schedule monitor

Terminal window
php artisan rconfig:sync-tasks
Terminal window

Test BYOC scripts from the command line. See the BYOC section for more information.

Terminal window
php artisan rconfig:test-script
Terminal window

Toggle rConfig TFTP on or off

Terminal window
php artisan rconfig:tftp-server on/off

Command to update permissions table with new permissions

Terminal window
php artisan rconfig:update-rbac-data
Terminal window

Update all snippets to ensure they at least have admin have roles attached to them.

Terminal window
php artisan rconfig:update-snippet-roles
Terminal window