Skip to content

Commit

Permalink
Add heartbeat log to munki
Browse files Browse the repository at this point in the history
Differential Revision: D61227682

fbshipit-source-id: d433509e146a594885ea844acb7a1a138546e69a
  • Loading branch information
Jeewon Chae authored and facebook-github-bot committed Aug 14, 2024
1 parent b86d7f2 commit 93071b0
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions itchef/cookbooks/cpe_munki/files/default/munki_preflight.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

MUNKI_PAUSE_TRIGGER = "/Users/Shared/.pause_munki"
MUNKI_PAUSE_RECEIPT = "/Library/CPE/tags/.munki_has_been_paused"
HEARTBEAT = "/opt/facebook/bin/heartbeat"


def check_munki_pause() -> None:
Expand Down Expand Up @@ -52,8 +53,23 @@ def check_munki_pause() -> None:
print(f"Unable to clear pause receipt: {e}")


def send_heartbeat() -> None:
cmd = [
HEARTBEAT,
"--tag",
"munki_runs",
"-token_file",
"/Library/CPE/var/heartbeat_token.txt",
"&>/dev/null",
]
proc = subprocess.run(cmd, stdout=subprocess.PIPE)


def main() -> None:

print("Gathering run data...")
if os.path.exists(HEARTBEAT):
send_heartbeat()
# Verify munki pause
check_munki_pause()
print("Preflight completed successfully.")
Expand Down

0 comments on commit 93071b0

Please sign in to comment.