From d927c5db24eea3ecfbcbd0289fd6fa77b067d857 Mon Sep 17 00:00:00 2001 From: Isaias Pina Date: Thu, 23 Nov 2017 17:44:36 -0600 Subject: [PATCH 1/2] Fix conf files Add conf.jobs file Fix lsattr and df conf files Fix dockerimages conf file Update grc.fish --- colourfiles/conf.df | 20 ++++++------ colourfiles/conf.dockerimages | 56 +++++++++++++++++++++++----------- colourfiles/conf.dockerinfo | 4 +-- colourfiles/conf.dockernetwork | 28 ++++++++--------- colourfiles/conf.dockerps | 51 ++++++++++++++++--------------- colourfiles/conf.jobs | 9 ++++++ colourfiles/conf.ls | 25 ++++++++------- colourfiles/conf.lsattr | 14 ++++++--- colourfiles/conf.lsblk | 20 +++++++----- colourfiles/conf.mount | 24 ++++++++++++--- colourfiles/conf.mount.old | 19 ------------ colourfiles/conf.mtr | 6 ++-- colourfiles/conf.ping | 51 +++++++++++++++---------------- colourfiles/conf.traceroute | 2 +- grc.fish | 6 ++-- 15 files changed, 183 insertions(+), 152 deletions(-) create mode 100644 colourfiles/conf.jobs delete mode 100644 colourfiles/conf.mount.old diff --git a/colourfiles/conf.df b/colourfiles/conf.df index 065e335..e00b800 100644 --- a/colourfiles/conf.df +++ b/colourfiles/conf.df @@ -1,7 +1,7 @@ # FS #regexp=^.*?\s -regexp=^(?!Filesystem).*?\s -colours=green +regexp=^(?!Filesystem)(\/[-\w\d.]+)+\s +colours=blue,bold blue ====== # Size 'K' regexp=\s\d*[.,]?\dKi?\s @@ -20,25 +20,25 @@ regexp=\s\d*[.,]?\dTi?\s colours=bold red ====== # Mounted on -regexp=/[-\w\d./]*$ -colours=bold green +regexp=\/$|(\/[-\w\d. ]+)+$ +colours=green,bold green ====== # Use 0-60% -regexp=[1-6][0-9]?%|0% +regexp=[ 1-6][0-9]?%|0% colours=green ====== # Use 70-90% regexp=[7-9][0-9]% colours=yellow ====== -# Use 90-95 -regexp=[9][0-5]% +# Use 90-97 +regexp=9[0-7]% colours=red ====== -# Use 95-100 -regexp=[9][5-9]%|100% +# Use 98-100 +regexp=9[8-9]%|100% colours=bold red - +====== # tmpfs lines regexp=^tmpfs.* colours=bright_black diff --git a/colourfiles/conf.dockerimages b/colourfiles/conf.dockerimages index 61bbb4a..a65782a 100644 --- a/colourfiles/conf.dockerimages +++ b/colourfiles/conf.dockerimages @@ -1,43 +1,63 @@ -# HEADERS -regexp=(?:\s|^)(REPOSITORY|TAG|IMAGE ID|CREATED|SIZE)(?:\s|$) -colours=default,underline -===== -# REPO, TAG -regexp=^([a-z]+\/?[^\s]+)\s+([^\s]+) -colours=default,bold white,cyan,bold black -======= # REPO, TAG, IMAGE ID regexp=^([a-z]+\/?[^\s]+)\s+([^\s]+)\s+(\w+) colours=default,bold white,bright_cyan,bright_black ===== # latest -regexp=\s+(latest)\s+ -colours=unchanged,cyan +regexp=(?<=\s)latest(?=\s+) +colours=dark cyan ===== # REPOSITORY (Image name) -regexp=^(?:([a-z\-_0-9]+)/)*([a-z\-_0-9]+)\s +regexp=^(?:(\S+)\/)*(\S+)\s colours=default,yellow,bright_white ===== # images without name regexp=^.*$ colours=bold red ===== +# images without tag +regexp=\s+()\s+ +colours=unchanged,bold red +===== # Size 'K' -regexp=\s\d*[\.,]?\d*\sKB? +regexp=(?<=\s)\d+[.,]?\d*\s?(KB?|B) colours=green ====== # Size 'M', 2 digits -regexp=\s\d{1,2}[\.,]?\d*\sMB? +regexp=(?<=\s)\d{1,2}[.,]?\d*\s?MB? colours=green ====== # Size 'M' 3+ digits -regexp=\s\d{3,4}[\.,]?\d*\sMB? +regexp=(?<=\s)\d{3,4}[.,]?\d*\s?MB? colours=yellow ====== # Size 'G' -regexp=\s\d*[\.,]?\d*\sGB? +regexp=(?<=\s)\d+[.,]?\d*\s?GB? colours=red +===== +# CREATED seconds/minutes +regexp=[\da-f]{12}\s+((?:About a|\d+) (?:seconds?|minutes?) ago) +colours=unchanged,on_green bold white ====== -# Date Ago -regexp=(?:\s{2}|^)(?:\w+\s)+ago -colours=cyan +# CREATED About a minute ago +regexp=\s+(About a minute ago)\s\w+ +colours=unchanged,on_green bold white +====== +# CREATED hours +regexp=\s+(\d+\shours\s\w+) +colours=unchanged,bright_green +====== +# CREATED days +regexp=\s+(\d+\sdays\s\w+) +colours=unchanged,green +====== +# CREATED weeks +regexp=\s+(\d+\sweeks\s\w+) +colours=unchanged,yellow +====== +# CREATED months +regexp=\s+(\d+\smonths\s\w+) +colours=unchanged,red +===== +# HEADERS +regexp=(?:\s|^)(REPOSITORY|TAG|IMAGE ID|CREATED|SIZE)(?:\s|$) +colours=default,underline diff --git a/colourfiles/conf.dockerinfo b/colourfiles/conf.dockerinfo index 06928a9..74b6a38 100644 --- a/colourfiles/conf.dockerinfo +++ b/colourfiles/conf.dockerinfo @@ -1,9 +1,9 @@ # Main Nodes -regexp=^(\S[^:]+):\s(.*)$ +regexp=^(\S[^:]+):\s?(.*)?$ colours=default,cyan ====== # Sub Nodes -regexp=^\s([^:]+):\s(.*)$ +regexp=^\s([^:]+):\s?(.*)?$ colours=default,magenta ====== # Warning diff --git a/colourfiles/conf.dockernetwork b/colourfiles/conf.dockernetwork index 042916a..8d09d82 100644 --- a/colourfiles/conf.dockernetwork +++ b/colourfiles/conf.dockernetwork @@ -1,23 +1,23 @@ # HEADERS -regexp=(?:\s|^)(NETWORK ID|NAME|DRIVER)(?:\s|$) +regexp=(?:\s|^)(NETWORK ID|NAME|DRIVER|SCOPE)(?:\s|$) colours=default,underline - # Line regexp=^(?!NETWORK)(\S+)\s+(\S+) -colours=default,green,bright_blue +colours=unchanged,bright_black,bright_blue - -# Bridge -regexp=bridge\s+$ -colours=cyan +# Driver BRIDGE +regexp=^\S+\s+\S+\s+(bridge) +colours=unchanged,bright_cyan - -# host -regexp=host\s+$ -colours=bright_cyan +# Driver HOST +regexp=^\S+\s+\S+\s+(host) +colours=unchanged,cyan - -# overlay -regexp=overlay\s+$ -colours=magenta +# Driver OVERLAY +regexp=^\S+\s+\S+\s+(overlay) +colours=unchanged,magenta - -# null -regexp=null\s+$ -colours=red +# Driver NULL +regexp=^\S+\s+\S+\s+(null) +colours=unchanged,on_red white diff --git a/colourfiles/conf.dockerps b/colourfiles/conf.dockerps index 1940484..e83ae3f 100644 --- a/colourfiles/conf.dockerps +++ b/colourfiles/conf.dockerps @@ -1,15 +1,18 @@ -# This is for docker ps and docker-compose ps -# Headers -regexp=(?:\s{2}|^)(CONTAINER ID|IMAGE|COMMAND|CREATED|STATUS|PORTS|NAMES|Name|Command|State|Ports)(?:\s|$) +# HEADERS +regexp=(?:\s|^)(CONTAINER ID|IMAGE|COMMAND|CREATED|STATUS|PORTS|NAMES)(?:\s|$) colours=default,underline ====== -# Commands (docker ps) -regexp=(?:\s{2}|^)(?:\s\")(.*)(?:\")(?:\s{2}|$) -colours=magenta -======= -# Date Ago (docker ps) -regexp=(?:\s{2}|^)(?:\w+\s)+ago -colours=cyan +# IMAGE NAME (as docker image) +regexp=\s{2,}(?:([a-z\-_0-9]+)\/)*([a-z\-_0-9]+)(:\S+)?\s{2,}\" +colours=unchanged,yellow,bright_white,cyan +====== +# IMAGE +regexp=^(?!CONTAINER)(\w+)\s+([^\s]+)\s+(".*")\s+(.*(?=(?:Up|Exited|Created|Restarting))) +colours=unchanged,bright_black,unchanged,bright_black,cyan +====== +# Statuses - Created +regexp=\sCreated\s +colours=blue ====== # Statuses # https://github.com/docker/docker/blob/e5a3f86e447dd659da3c2e759f3c088a0bfcfe3d/container/state.go#L40 @@ -17,18 +20,18 @@ colours=cyan regexp=(?:\s{2}|^)(?:Up|Restarting)(?:(?:\s[\w,\d,(,)]+)+)? colours=bold green ====== -# Exited -regexp=(?:\s{2}|^)(?:Exited|Exit|Dead|Removal In Progress)(?:(?:\s[\w,\d,(,)]+)+)? -colours=bold red -======= +# Statuses - Exited +regexp=Exited\s.(\d+).+?(?=\s{2,}) +colours=bold red,red +====== +# Statuses - Restarting +regexp=Restarting\s.(\d+).+?(?=\s{2,}) +colours=bold blue +====== # Ip Addresses / Ports -regexp=(?:\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(\:)?(\d{1,5}))?(->)?(\d{1,5})(\/)(\w+) -colours=blue,default,bright_green,default,bright_green,default,bright_blue -======= -# Name and command in docker-compose ps. -regexp=(?:\s{2}|^)(?:[a-z\-_0-9]+)(?:\s{2}|$)(?:\s+(.+?)\s{2,})? -colours=bold yellow,magenta -======= -# Container ID / Image ID and Image. Need to be together to override the "name" regex. -regexp=(?:\s{2}|^)([a-z0-9]+)\s{2,}((?:(?:[a-z\-_0-9\.]+)+(\/|:)?)+) -colours=default,cyan,default +regexp=(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(\:)?(\d{1,5}))?(?:->)?(\d{1,5}(\/)\w+) +colours=default,blue,default,bright_green,bright_blue,default +====== +# NAMES +regexp=(?:([a-z\-_0-9]+)\/)*([a-z\-_0-9]+)$ +colours=default,yellow,on_blue white diff --git a/colourfiles/conf.jobs b/colourfiles/conf.jobs new file mode 100644 index 0000000..888ef9a --- /dev/null +++ b/colourfiles/conf.jobs @@ -0,0 +1,9 @@ +# BASH +regexp=\[(\d+)\](.) +(\d+)?\s? +colour=unchanged, cyan, yellow, magenta +- +regexp=Running.* +colour=bold green +- +regexp=Stopped.* +colour=red diff --git a/colourfiles/conf.ls b/colourfiles/conf.ls index c303a53..bb61bca 100644 --- a/colourfiles/conf.ls +++ b/colourfiles/conf.ls @@ -5,15 +5,21 @@ # Example lines: # -rw-r--r-- 1 user staff 344M Mar 22 22:51 MVI_8735.m4v # -rw-r--r-- 1 user staff 360050327 Mar 22 22:51 MVI_8735.m4v +# -rw-r--r--. 1 user staff 1.0G Nov 23 16:13 testg +# -rw-r--r--. 1 user staff 1.0K Nov 23 16:13 testk +# -rw-r--r--. 1 user staff 1.0M Nov 23 16:13 testm +# -rw-r--r--. 1 user staff 1073741824 Nov 23 16:13 testg +# -rw-r--r--. 1 user staff 1024 Nov 23 16:13 testk +# -rw-r--r--. 1 user staff 1048576 Nov 23 16:13 testm # # The regexp uses lookahead to match a date following the size # size: 1M <= size < 10M -regexp=\s+(\d{7}|\d([,\.]\d+)?M)(?=\s[A-Z][a-z]{2}\s) +regexp=\s+(\d{7}|\d(?:[,.]?\d+)?[KM])(?=\s[A-Z][a-z]{2}\s) colours=green ======= # size: 10M <= size < 100M -regexp=\s+(\d{8}|\d\d([,\.]\d+)?M)(?=\s[A-Z][a-z]{2}\s) +regexp=\s+(\d{8}|\d\d(?:[,.]?\d+)?M)(?=\s[A-Z][a-z]{2}\s) colours=yellow ======= # size: 100M <= size < 1G @@ -21,24 +27,17 @@ regexp=\s+(\d{9}|\d{3}M)(?=\s[A-Z][a-z]{2}\s) colours=red ======= # size: 1G <= size -regexp=\s+(\d{10,}|[\d\.,]+G)(?=\s[A-Z][a-z]{2}\s) +regexp=\s+(\d{10,}|[\d.,]+G)(?=\s[A-Z][a-z]{2}\s) colours=bold red ======= # device major minor numbers regexp=\s(\d+),\s+(\d+)\s colours=default,bright_yellow ,yellow ======= -# time -regexp=(\s|^)[0-2]?\d(:[0-5]\d)(?=[\s,]|$) -colours=white +# Date-Time => G1=Month G2=Day G3=Hour G4=Minutes G5=Year +regexp=([A-Z][a-z]{2})\s([ 1-3]\d)\s(?:([0-2]?\d):([0-5]\d)(?=[\s,]|$)|\s*(\d{4})) +colours=unchanged,cyan,cyan,cyan,cyan,bold magenta ======= -# month -#regexp=\s[A-Z][a-z]{2}\s -#colours=yellow -#======= -#regexp=(?<=\d):(?=\d) -#colours=bold yellow -#======= # root regexp=\s(root|wheel)(?=\s|$) colours=unchanged,bold white on_red diff --git a/colourfiles/conf.lsattr b/colourfiles/conf.lsattr index d2f2102..ef5fcc1 100644 --- a/colourfiles/conf.lsattr +++ b/colourfiles/conf.lsattr @@ -1,7 +1,3 @@ -# Filename -regexp=\S+\s(\S+) -colours=bold -- # Normal regexp=[aAcCdDeijsStTu] colours=cyan @@ -12,8 +8,16 @@ colours=bright_green - # Read Only regexp=[EhINXZ] -colours=red +colours=bold red - # Separators regexp=[\-] colours=dark +- +# Error +regexp=(lsattr:) \w.* +colours=default, bold red +- +# Filename +regexp=(\/[-\w\d. ]+)+$ +colours=yellow,bold diff --git a/colourfiles/conf.lsblk b/colourfiles/conf.lsblk index 26aed32..bd096c1 100644 --- a/colourfiles/conf.lsblk +++ b/colourfiles/conf.lsblk @@ -11,23 +11,23 @@ regexp=\s+([├└─│]+|[\|\`\-]+)(\S+) colours=default,default,bright_cyan ====== # Type crypt -regexp=\scrypt\s +regexp=(?<=\s)crypt\b colours=on_magenta white ====== # Type disk -regexp=\sdisk\s +regexp=(?<=\s)disk\b colours=magenta ====== # Type lvm -regexp=\slvm\s +regexp=(?<=\s)lvm\b colours=bold cyan ====== # Type part -regexp=\spart\s +regexp=(?<=\s)part\b colours=cyan ====== # Type loop -regexp=\sloop\s +regexp=(?<=\s)loop\b colours=bright_red ====== # Size 'K' @@ -46,10 +46,14 @@ colours=red regexp=\s\d*[.,]?\dTi?\s colours=bold red ====== -# Mount -regexp=\s\/.*$ -colours=bold yellow +# Mount Path +regexp=(?<=\s)(\/[^\/ ]*)+$ +colours=yellow,bold yellow ====== # Mount [SWAP] regexp=\s\[(SWAP)\] colours=default,bright_magenta +====== +# UUID +regexp=(?<=\s)\b([0-9a-fA-F-]{4,}|[\w-]{38})\b +colours=default,dark cyan diff --git a/colourfiles/conf.mount b/colourfiles/conf.mount index c44cdb5..1a46641 100644 --- a/colourfiles/conf.mount +++ b/colourfiles/conf.mount @@ -3,9 +3,23 @@ regexp=^(.*) on (.*) type (.*) \((.*)\) colours=default,green,yellow,blue,magenta -===== -regexp=^cgroup.* -colours=bright_black -===== -regexp=^tmpfs.* +- +# Devices +regexp=^(\/[^\/ ]+)+ +colours=bold green, on_green black +- +# Mount Path +regexp=(?<=on )(\/[^\/ ]+)+ +colours=unchanged,underline yellow +- +# RW +regexp=(?<=\()rw +colours=bold red +- +# RO +regexp=(?<=\()ro +colours=bold green +- +# Like comment, leave at end always +regexp=^(cgroup|tmpfs).* colours=bright_black diff --git a/colourfiles/conf.mount.old b/colourfiles/conf.mount.old deleted file mode 100644 index ed316c2..0000000 --- a/colourfiles/conf.mount.old +++ /dev/null @@ -1,19 +0,0 @@ -#/full/path -regexp=\s/[-\w\d.]+(\s|/[-\w\d./]+) -colours=cyan -======= -#filesystem -regexp=^\w+\s -colours=yellow -======= -#type filesystem -#regexp=(?<=type)\s* -#colours=red -#======= -# /dev/sda -regexp=^(/dev/)?[s]d[a-f][0-9]*(?=[^\w\d]|$) -colours=bold green -======= -#mount options -regexp=(?<=[,(])[^,]*(?=[,)]) -colours=green diff --git a/colourfiles/conf.mtr b/colourfiles/conf.mtr index 02e0c5c..a694dce 100644 --- a/colourfiles/conf.mtr +++ b/colourfiles/conf.mtr @@ -2,9 +2,9 @@ regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} colours=green ======= -# % -regexp=[0-9]{1,2}\.\d{1}% -colours=yellow +# 0 Full Line | 1 Loss | 2 Snt | 3 Last | 4 Avg | 5 Best | 6 Worst | 7 stDev +regexp=(\d+\.\d%)\s+(\d+)\s+(\d+\.\d)\s+(\d+\.\d)\s+(\d+\.\d)\s+(\d+\.\d)\s+(\d+\.\d)$ +colours=unchanged,yellow,unchanged,unchanged,blue,green,red,unchanged ======= # unknow host regexp=\?\?\? diff --git a/colourfiles/conf.ping b/colourfiles/conf.ping index 91d131d..49d6902 100644 --- a/colourfiles/conf.ping +++ b/colourfiles/conf.ping @@ -1,52 +1,51 @@ -# name -regexp=(?:[fF]rom|PING)\s(\S+)\s -colours=default,blue +# IP +regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} +colours=bright_blue ======= # ipv6 number regexp=(([0-9a-fA-F]{1,4})?\:\:?[0-9a-fA-F]{1,4})+ colours=magenta ======= -# ip number, optional port -regexp=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(\:[0-9]{1,5})? -colours=bright_blue -======= -# icmp_[sr]eq=# -regexp=icmp_[sr]eq=(\d+) +# icmp_seq=## +regexp=icmp_seq=(\d+) colours=default,yellow ======= +# ttl=# +regexp=ttl=(\d+) +colours=default,magenta +======= +# name +regexp=(?:[fF]rom|PING)\s(\S+)\s +colours=default,blue +======= # time regexp=([0-9\.]+)\s?ms -colours=default,green +colours=green,bold green ======= # DUP regexp=DUP\! colours=red ======= -# Destination Host Unreachable -regexp=Destination Host Unreachable +# OK +regexp=0% packet loss +colours=green +======= +# Errors +regexp=(Destination Host Unreachable|100% packet loss) colours=red ======= # unknown host regexp=.+unknown\shost\s(.+) colours=red,bold red - -# statustics header -regexp=--- \S+ ping statistics --- -colours=bold +# statistics header +regexp=--- (\S+) ping statistics --- +colours=bold, bold blue - # last line min/avg/max/mdev -regexp=(min)/(avg)/(max)/(mdev) +regexp=rtt (min)/(avg)/(max)/(mdev) colours=default,bright_yellow,bright_blue,bright_red,bright_magenta - # last line values -regexp=\=\s([0-9\.\ mus]+)\/([0-9\. mus]+)\/([0-9\. mus]+)\/([0-9\. mus]+) +regexp=\=\s([0-9\.]+)\/([0-9\.]+)\/([0-9\.]+)\/([0-9\.]+) colours=default,bright_yellow,bright_blue,bright_red,bright_magenta -- -# these are good for nping -regexp=SENT|RCVD -colours=red -- -# nping -regexp=unreachable -colours=red - diff --git a/colourfiles/conf.traceroute b/colourfiles/conf.traceroute index f3bb03f..f18156a 100644 --- a/colourfiles/conf.traceroute +++ b/colourfiles/conf.traceroute @@ -1,6 +1,6 @@ # hostname regexp=\s\w+[\w\-\.]+\w+ -colours=bright_yellow +colours=bold white count=once - # ip number diff --git a/grc.fish b/grc.fish index 7f459a4..7230311 100644 --- a/grc.fish +++ b/grc.fish @@ -10,13 +10,11 @@ set -U grc_plugin_execs cat cvs df diff dig gcc g++ ls ifconfig \ make mount mtr netstat ping ps tail traceroute \ wdiff blkid du dnf docker docker-machine env id ip iostat \ last lsattr lsblk lspci lsmod lsof getfacl getsebool ulimit uptime nmap \ - fdisk findmnt free semanage sar ss sysctl systemctl stat showmount tune2fs \ - tcpdump tune2fs \ - vmstat w who + fdisk findmnt free semanage sar ss sysctl systemctl stat showmount \ + tcpdump tune2fs vmstat w who for executable in $grc_plugin_execs if type -q $executable alias $executable "grc $executable" end end - From cc1880e6d98ebbc6bd742adfc104be18301c86dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isaias=20Pi=C3=B1a?= Date: Thu, 7 Dec 2017 15:52:01 -0600 Subject: [PATCH 2/2] Update conf.sysctl --- colourfiles/conf.sysctl | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/colourfiles/conf.sysctl b/colourfiles/conf.sysctl index 0a9bdfa..b3accf8 100644 --- a/colourfiles/conf.sysctl +++ b/colourfiles/conf.sysctl @@ -1,9 +1,11 @@ -# Main -regexp=(\w+)\.(\S+) = (.+)$ -colours=default,bright_green,cyan,yellow +# Main & Last key +regexp=(\w+)\.(\S+) = ?(.+)?$ +colours=default,green,cyan,yellow - -# subcategory +# subcategories regexp=\w+\.(\S+(?=\.))\. -colours=unchanged,bright_cyan - - +colours=unchanged,magenta +- +# error +regexp=sysctl: permission denied on key '([^']+)' +colours=red,bold red