Red light, Green Light, or rlgl in short, is a simple status monitor written in bash. Use it to monitor anything that can evaluate into a bash boolean expression.
Use config.yaml to list bash commands that evaluate to true or false (auto reloads on changes while running)
- title: "NS1"
checks:
- name: "ns1 - exists"
command: "ip netns list | grep -q '^ns1'"
- name: "ns1 - usb1 exists"
command: "ip netns exec ns1 ip addr show 2>/dev/null | grep -q usb1"
- name: "ns1 - usb1 is UP"
command: "ip netns exec ns1 ip addr show 2>/dev/null | grep usb1 | grep -q 'state UP'"
- title: "NS2"
checks:
- name: "ns2 - exists"
command: "ip netns list | grep -q '^ns2'"
- name: "ns2 - usb2 exists"
command: "ip netns exec ns2 ip addr show 2>/dev/null | grep -q usb2"
- name: "ns2 - usb2 is UP"
command: "ip netns exec ns2 ip addr show 2>/dev/null | grep usb2 | grep -q 'state UP'"Next run
./rlgl.sh
or in the above example with network namespaces
sudo ./rlgl.sh
since it needs to run ip netns exec.
and rlgl will show the current status.
A timer exists to make sure that the screen is not frozen.
The script can be started with different config files using the -c or --config option.
The polling intervals can be set globally in the config.yaml file or overridden for individual checks. The global polling interval is defined at the top of the configuration file, while each check can specify its own interval using the poll_interval key.
poll_interval: 10 # Global polling interval in seconds
- title: "NS1"
checks:
- name: "ns1 - exists"
command: "ip netns list | grep -q '^ns1'"
poll_interval: 5 # This check will run every 5 seconds
- name: "ns1 - usb1 exists"
command: "ip netns exec ns1 ip addr show 2>/dev/null | grep -q usb1"
poll_interval: 3.5 # You can even use decimal values
- name: "ns1 - usb1 is UP"
command: "ip netns exec ns1 ip addr show 2>/dev/null | grep usb1 | grep -q 'state UP'"