CLI Commands
10 mins
V6 ProV6 MSPV6 Core
Overview
rConfig v6 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
cd /var/www/html/rconfig6/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: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:download-category Download configurations for one or multiple categories 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:list-categories List all category 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
All above commands must be run from within the rConfig6 directory, and must be run in the following format.
php artisan rconfig:clear-all
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 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
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 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! ------
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 flushed
failed_jobs flushed
rconfig:sync-search
Command Summary
Use this command if you are searching for items from the database, such as devices, categories 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 categories. You can send multiple category IDs as parameters.
Command Use
php artisan rconfig:download-category 1 2
Command Output
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
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.
php artisan rconfig:download-device 1002 1003 -d
Command Output
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
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: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
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 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
rconfig:list-categories
Command Summary
Lists all configured device categories. 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 purged
php 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 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
Command Output
php artisan rconfig:purge-failedconfigs --all
3 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 IDs
php 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. http://v6dev1.rconfig.com/horizon/dashboard
Completed: Please check Policy Compliance Reports for information on configuration compliance. http://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 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
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 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
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: 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
- Overview
- rconfig:archive-logs
- rconfig:clear-all
- rconfig:clear-horizon
- rconfig:sync-search
- rconfig:download-category
- rconfig:download-device
- rconfig:download-tag
- rconfig:download-task
- rconfig:list-categories
- rconfig:list-devices
- rconfig:list-snippets
- rconfig:list-tags
- rconfig:list-tasks
- rconfig::purge-configs
- rconfig::purge-failedconfigs
- rconfig:report-lastDownload
- rconfig:run-policy-compliance
- rconfig:search-configs
- rconfig:send-snippet
- rconfig:snippet-task