Community discussions

 
santong7
newbie
Topic Author
Posts: 40
Joined: Tue Jun 04, 2013 1:40 pm
Location: Heraklion Crete Greece
Contact:

Terminal Logon script

Fri Sep 06, 2019 10:52 pm

Dear community,
I have found an old script mostly useful for hotspots.
I need someone to help modifying the script to show capsman registered clients, and not hotspot authenticated users.
Is that possible ?
:local content
:local logcontenttemp ""
:local logcontent ""
:local counter
:local v 0
 
:set logcontenttemp "You are logged into: $[/system identity get name]"
:set logcontent ("$logcontent" ."$logcontenttemp" ."\n")
 
:set logcontenttemp "############### System Health ###############"
:set logcontent ("$logcontent" ."$logcontenttemp" ."\n")
 
:set logcontenttemp "Uptime:  $[/system resource get uptime] d:h:m:s"
:set logcontent ("$logcontent" ."$logcontenttemp" ." | ")
 
:set logcontenttemp "CPU: $[/system resource get cpu-load]%"
:set logcontent ("$logcontent" ."$logcontenttemp" ."\n")
 
:set logcontenttemp "RAM: $(([/system resource get total-memory]-[/system resource get free-memory])/1024)/$([/system resource get total-memory]/1024)M"
:set logcontent ("$logcontent" ."$logcontenttemp" ." | ")
 
##
#voltage and temp readout not available on x86, check for this before trying
#to record otherwise script will halt unexpectedly
##
 
:if ([/system resource get architecture-name]="x86") do={
  :set logcontenttemp "Voltage: NIL"
  :set logcontent ("$logcontent" ."$logcontenttemp" ." | ")
  :set logcontenttemp "Temp: NIL"
  :set logcontent ("$logcontent" ."$logcontenttemp" ."\n")
} else={
  :set logcontenttemp "Voltage: $[:pick [/system health get voltage] 0 2] v"
  :set logcontent ("$logcontent" ."$logcontenttemp" ." | ")
  :set logcontenttemp "Temp: $[ /system health get temperature]c"
  :set logcontent ("$logcontent" ."$logcontenttemp" ."\n")
}
 
:set logcontenttemp "############# User Auth Details #############"
:set logcontent ("$logcontent" ."$logcontenttemp" ."\n")
 
:foreach counter in=[/ip hotspot active find ] do={:set v ($v + 1)}
:set logcontenttemp "Users Connected: $v |"
:set v 0
:foreach counter in=[/ppp active find ] do={:set v ($v + 1)}
:set logcontenttemp ("$logcontenttemp" . " PPP online: $v")
:set logcontent ("$logcontent" ."$logcontenttemp" ."\n")
 
/system note set note="$logcontent"
Electrical & Data Communications Engineer - MTCNA

Who is online

Users browsing this forum: No registered users and 6 guests