Skip to main content

CLI commands

All command need to be running from user www-data (exept some)

We strongly do not recommend using other commands than the ones listed. This may damage your system

Command must start from sudo -u www-data php artisan      

sudo -u www-data php artisan YOUR_COMMAND
Example
sudo -u www-data php artisan grusher:checker geo_count_all

In most cases, there is no need to use these commands as most of them are executed automatically by the system.

Go to Grusher installation path

cd /var/www/html/

and use next commands:

GRUSHER

Asterisk

Script you can see here https://github.com/gviabcua/grusher_asterisk

grusher:asterisk_get call_new {JSON DATA FROM SCRIPT}                Get info about new call
grusher:asterisk_get call_to_operator {JSON DATA FROM SCRIPT}        Send notify to operator via WS
grusher:asterisk_get call_answer {JSON DATA FROM SCRIPT}             Operator is answered
grusher:asterisk_get call_end {JSON DATA FROM SCRIPT}                Call was ended
grusher:asterisk_get call_end_permanent {JSON DATA FROM SCRIPT}      Call was ended
grusher:asterisk_get call_to_operator_custom {JSON DATA FROM SCRIPT} Send custom operator information
grusher:asterisk_get send_file_rec_url {JSON DATA FROM SCRIPT}       Save or update the call recording URL
grusher:asterisk_get del_invalid_call {JSON DATA FROM SCRIPT}        Delete an invalid call record

grusher:asterisk_get  ai --type=analize_list --hour=3                Auto processing calls with AI (from build_352)
grusher:asterisk_get  ai --type=analize_ai_rec_id --id=1587452       Processing call with AI by record id (from build_352)
Billing
billing:users sync                                Sync billing user via internal logic (all data)
billing:users sync_address                        Sync billing user via internal logic (address only)
billing:users sync_users                          Sync billing user via internal logic (users only)
Checker
grusher:checker create_topology                         Rebuild topology cache (from build 329)

grusher:checker geo_count_all                           Count fiber length & polygon square without data
grusher:checker geo_recount_all                         Recount all fiber length & polygon square

grusher:checker get_pon_iface_onu_load_epon             Count ONU load in iface EPON to cache
grusher:checker get_pon_iface_onu_load_gpon             Count ONU load in iface GPON to cache
grusher:checker onu_counters                            Count ONUs data to cache
grusher:checker work_with_new_onu                       Getting data about new ONUs
grusher:checker onu_mass_down_all                       Getting data ONUs problem like LOS, POWER-OFF to cache

grusher:checker ips                                     Getting data about generators

grusher:checker tasks_future                            Creating future tasks
Data Base Optimisation
php artisan grusher:db-optimize-all --check-only           CHECK ALL Tables                 (from build_351)
php artisan grusher:db-optimize-all --analyze-only         ANALYZE ALL Tables               (from build_351)
php artisan grusher:db-optimize-all                        ANALYZE & OPTIMIZE ALL Tables    (from build_351)
Device Discovering  
grusher:devicediscovering --ip_network=192.168.1.0/24           Discovering new devices in subnetwork
Fixer     
grusher:fixer allow_access                                Disable global IP filtering
grusher:fixer user_password_reset --user=admin            Reset password for frontend user

grusher:fixer user_permission_set_all --user=admin        Set all permission for user "admin"
grusher:fixer user_permission_unset_all --user=admin      Disable all permission for user "admin"
grusher:fixer user_permission_set_default --user=admin    Set default permission for user "admin"

grusher:fixer user_permission_recovery                    Run recovery missing user permissions
Geocoder

Updating geo via Visicom or Nominatim

grusher:geocoder update_polygon_empty                 Update building polygons if no
grusher:geocoder update_polygon_full                  Update building polygons for all

grusher:geocoder update_geo                           Update geo position if no lat/lon
grusher:geocoder update_geo_full                      Update geo position for all
grusher:geocoder update_building_ID                   Update geo for building with id = ID
Get device status / Get devicestatus subnetwork
grusher:getdevicestatus                                            Get status of all devices in database

grusher:getdevicestatussubnetwork                                  Like previous command
grusher:getdevicestatussubnetwork --ip_network=192.168.1.0/24      For IP subnetwork
grusher:getdevicestatussubnetwork --ip_network=notinsubnetworks    For IP what added without Grusher subnetwork (manual)
Get server load
grusher:getserverload --data="{JSON_SCRIPT_DATA}"        Send server load to WS
Gevents 
grusher:gevents update_all                     Updating main event data
House keeper
grusher:housekeeper --type=clean_main_history                 Cleaning main history, building trends
grusher:housekeeper --type=clean_onus_history                 Cleaning ONUs history, building trends
grusher:housekeeper --type=clean_database                     Cleaning database
ML
ml:analyze-metrics       Analyze system and device metrics
ml:analyze-onu           Analyze ONU signal anomalies
ml:analyze-sfp           Analyze SFP signal anomalies
ml:analyze-ports         Analyze Ethernet port anomalies
ml:analyze-onu-traffic   Analyze ONU traffic anomalies

ml:train-metrics         Train the system and device metrics model
ml:train-onu             Train the ONU signal model
ml:train-sfp             Train the SFP signal model
ml:train-ports           Train the Ethernet port model
ml:train-onu-traffic     Train the ONU traffic model
Notify
grusher:notify                   Sending messaged in manual mode
Poller
grusher:poller --type=onu_signals                    Getting signals from all ONUs
grusher:poller --type=onu_signals_critical           Getting signals from critical ONUs
grusher:poller --type=onu_monitoring                 Monitoring critical ONUs state
grusher:poller --type=onu_monitoring_all             Monitoring critical ONUs state
grusher:poller --type=get_onu_iface_metrics          Monitoring ONUs traffic

grusher:poller --type=get_ports_metrics              Monitoring port traffic
               --device_ip=192.168.1.1               - with current IP
               --speed=1                             - with port speed

grusher:poller --type=ports_monitoring               Monitoring port states
               --device_ip=192.168.1.1               - with current IP

grusher:poller --type=get_onus                       Update ONU list on all OLT
grusher:poller --type=get_onus_autoreg               Is same but without ZTE, HUAWEI, NOKIA
grusher:poller --type=get_unregistered_onus          Search for unregistered ONUs

grusher:poller --type=get_fdb                        Get MAC addresse from devices
grusher:poller --type=get_vlans_list_to_db           Get global VLAN list from devices
grusher:poller --type=get_iferror                    Get global ports errors from devices
grusher:poller --type=get_all_device_ports_states    Get all info from ports
grusher:poller --type=get_sfp_power                  Get data from devices SFP modules
grusher:poller --type=do_backups                     Get devices backups

grusher:poller --type=get_metrics                    Get metrics like CPU, RAM etc

grusher:poller --type=routing_discovery              Discovering routing like BGP, OSPF, LLDP, ARP, ROUTE etc
grusher:poller --type=routing_monitoring             Monitoring BGP, OSPF

grusher:poller --type=personal_cron                  Run command for some device(s) or ONU(s)
               --command=COMMAND                     COMMAND is get_metrics, get_ports_metrics, device_monitoring
                                                                fdb, metric, sfp, onu_list, onu_signals, onu_monitoring
               --device_ips=IPS                      IPS like "192.168.1.1,192.168.1.2"
               --onus_list=ONUS                      ONUS like "ZTEGC1234567,ZTEGC2345678"
 Updater
grusher:updater system               Update Grusher to current build (set version)
grusher:updater system_dev           Update Grusher to current development build (set version)

grusher:updater device_base          Update Grusher device database
grusher:updater languages            Update Grusher translation
grusher:updater mac_vendors          Update MAC/Vendors from maclookup.app
grusher:updater current_version      Show the installed Grusher version and build
grusher:updater asn_base             Update the ASN database
grusher:updater mac_vendors          Update the MAC vendor database


netcontrol:apidocs --assets        Generate OpenAPI specification and local API viewers
Web socket
websockets:run                    Start websocket server of default port
websockets:run --port=1234        Start websocket server of custom port

SYSTEM

Database

Checking if database migration is OK. If errors - write to support

winter:up
Cache
cache:clear                      Clear memory cache
view:clear                       Clear theme/files cache
route:clear                      Clear routes cache
Grusher backup
smallbackup:db                     Backup current or default database.
smallbackup:plugins                Backup current plugins.
smallbackup:storage                Backup current or default CMS storage resource.
smallbackup:theme                  Backup current or default theme.
backup:run                         Run the configured system backup
backup:clean                       Remove backups older than the configured retention period
backup:list                        Display all available backups
backup:monitor                     Check the health of configured backups
Schedule

To test you can use this command as is. For production this command must running from sudo or root via CRON. Details

schedule:run                       Run the scheduled commands
Third party components

Copy all data from Userside maps and upload it to Grusher map with ability to edit data

grusher:import_export us2grusher                        New map will be created
                                  --map_id=7            Update data of map with ID = 7, else new map will be created
                                  --with_address        Bind nodes to the address book using the UserSide location text
                                  --force_address       Rewrite the node address even when it is already set
                                  --with_schemes        Copy node commutation, updating nodes what not changed in Grusher
                                  --skip_fiber_match    Do not match scheme cable blocks to Grusher fibers by label
                                  --forcerenew          Rewrite all nodes
                                  --force_schemes       Same thing, old name of --forcerenew

Logic

Always            Pulls the UserSide node list and fiber list first, then writes nodes and cables.
                  A node or a cable from a previous run is found by grusher_node_id / grusher_fiber_id
                  and updated in place. If the record was moved to another map or deleted, a new one
                  is created - foreign records are never resurrected.

--map_id=N        Reuses map N. Without it a new map "UserSide Imported map - <date>" is created
                  and the whole network is cloned into it.

--with_address    Reads the UserSide node name (the part before "#") and falls back to the location
                  field. Drops the service words (vul., prov., bud., r-n, obl.), splits on commas and
                  brackets, then looks up the settlement, the street inside that settlement and the
                  house on that street. The house number is taken only after a matched street, so
                  floor and entrance notes ("48 p.4 (8 etazh)") do not end up as a building.
                  District and region are filled from the found record. If the house is not found the
                  node is bound to the street, if the street is not found - to the settlement.
                  Nodes that already have a building, street or city are left as is.

--force_address   Rewrites the address of such nodes as well.

--with_schemes    Fetches the node scheme from UserSide and lays it out as Grusher commutation.
                  A scheme untouched in Grusher since the last import is refreshed on every run.
                  A scheme edited by hand is kept as is - until you pass --forcerenew.

Fiber matching    On by default. Ties a cable block on the scheme to a Grusher fiber by its label:
                  exact match first, then containment, then word overlap. One cable never lands on two
                  blocks, and when exactly one cable enters the node it is taken without matching.
                  This is what links schemes to each other, so tracing a core can cross node borders.
                  Empty start_node_id / end_node_id of a cable are filled from UserSide in any case,
                  even with --skip_fiber_match.

--skip_fiber_match  Turns the label matching off. Cable blocks are imported unlinked.

Examples

grusher:import_export us2grusher
    Full clone of the UserSide network into a brand new map, no addresses, no schemes.

grusher:import_export us2grusher --map_id=7
    Refresh nodes and cables of map 7 in place.

grusher:import_export us2grusher --map_id=7 --with_address
    Same, plus bind every node without an address to the address book.

grusher:import_export us2grusher --map_id=7 --with_address --force_address
    Same, but rewrite the addresses that are already set.

grusher:import_export us2grusher --map_id=7 --with_schemes
    Refresh map 7 and pull commutation schemes, keeping the ones edited in Grusher.

grusher:import_export us2grusher --map_id=7 --with_schemes --forcerenew
    Pull the schemes and overwrite even the hand edited ones. Custom edits are lost.

grusher:import_export us2grusher --map_id=7 --with_schemes --skip_fiber_match
    Pull the schemes but leave cable blocks unlinked - use it when the labels on the
    UserSide pictures do not follow the node names and the matching gives wrong pairs.

grusher:import_export us2grusher --map_id=7 --with_address --with_schemes --forcerenew
    Everything at once: nodes, cables, addresses and schemes rewritten from UserSide.