Update sijapi.15s.py
This commit is contained in:
parent
322fa46819
commit
e6f9aa8f70
1 changed files with 17 additions and 11 deletions
|
@ -1,13 +1,21 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# <swiftbar.title>tailscaled2</swiftbar.title>
|
# <swiftbar.title>sijapi</swiftbar.title>
|
||||||
# <swiftbar.author>SIJ (Updated)</swiftbar.author>
|
# <swiftbar.author>sij.law</swiftbar.author>
|
||||||
# <swiftbar.author.github>ioflux</swiftbar.author.github>
|
# <swiftbar.author.github>sij.ai</swiftbar.author.github>
|
||||||
# <swiftbar.desc>Monitors Tailscale, VPN, and server status across multiple servers.</swiftbar.desc>
|
# <swiftbar.desc>Monitors Tailscale, VPN, and sijapi server and Postgres status across multiple servers.</swiftbar.desc>
|
||||||
# <swiftbar.hideRunInTerminal>true</swiftbar.hideRunInTerminal>
|
# <swiftbar.hideRunInTerminal>true</swiftbar.hideRunInTerminal>
|
||||||
# <swiftbar.hideDisablePlugin>true</swiftbar.hideDisablePlugin>
|
# <swiftbar.hideDisablePlugin>false</swiftbar.hideDisablePlugin>
|
||||||
# <swiftbar.hideSwiftBar>true</swiftbar.hideSwiftBar>
|
# <swiftbar.hideSwiftBar>false</swiftbar.hideSwiftBar>
|
||||||
# <swiftbar.refreshEveryNSeconds>15</swiftbar.refreshEveryNSeconds>
|
# <swiftbar.refreshEveryNSeconds>15</swiftbar.refreshEveryNSeconds>
|
||||||
|
|
||||||
|
# STEP 1: Update this path to point to your sijapi directory:
|
||||||
|
sijapi_dir = '/Users/sij/workshop/sijapi'
|
||||||
|
|
||||||
|
# STEP 2: Ensure ./sijapi/config/sys.yaml exists in your sijapi directory and contains your correct configuration. You can work off the template provided at sys.yaml-example.
|
||||||
|
config_yaml = f'{sijapi_dir}/sijapi/config/sys.yaml'
|
||||||
|
|
||||||
|
# STEP 3: Install 'vitals' (https://sij.ai/sij/vitals) in your server(s) PATH(s).
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import json
|
import json
|
||||||
import yaml
|
import yaml
|
||||||
|
@ -29,11 +37,6 @@ for old_script in glob.glob(os.path.join(temp_dir, 'swiftbar_vpn_*.sh')):
|
||||||
except OSError:
|
except OSError:
|
||||||
pass # Ignore errors in cleanup
|
pass # Ignore errors in cleanup
|
||||||
|
|
||||||
# STEP 1: Update this path to point to your sijapi directory:
|
|
||||||
sijapi_dir = '/Users/sij/workshop/sijapi'
|
|
||||||
|
|
||||||
# STEP 2: Ensure ./sijapi/config/api.yaml exists in your sijapi directory and contains your correct configuration. You can work off the template provided at api.yaml-example.
|
|
||||||
config_yaml = f'{sijapi_dir}/sijapi/config/api.yaml'
|
|
||||||
with open(config_yaml, 'r') as stream:
|
with open(config_yaml, 'r') as stream:
|
||||||
config = yaml.safe_load(stream)
|
config = yaml.safe_load(stream)
|
||||||
servers = config['POOL']
|
servers = config['POOL']
|
||||||
|
@ -210,6 +213,9 @@ for server_info in server_infos:
|
||||||
postgres_symbol = '◆' if server_info['postgres_ok'] else '◇'
|
postgres_symbol = '◆' if server_info['postgres_ok'] else '◇'
|
||||||
print(f"{health_symbol} Health {postgres_symbol} Postgres")
|
print(f"{health_symbol} Health {postgres_symbol} Postgres")
|
||||||
vpn_path = server_info['vpn_path']
|
vpn_path = server_info['vpn_path']
|
||||||
|
print()
|
||||||
|
print('---')
|
||||||
|
print()
|
||||||
|
|
||||||
print()
|
print()
|
||||||
print('---')
|
print('---')
|
||||||
|
|
Loading…
Reference in a new issue