Skip to content
This repository has been archived by the owner on Feb 27, 2020. It is now read-only.

[Reviewer: EM] Don't run Ralf if there is no Ralf hostname. #276

Merged
merged 2 commits into from
Jun 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions ralf.root/usr/share/clearwater/infrastructure/scripts/ralf.monit
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,22 @@

. /etc/clearwater/config

# Set up the monit configuration for ralf with the right IP addresses and ports
cat > /etc/monit/conf.d/ralf.monit <<EOF
if [ -z "$ralf_hostname" ]; then

if [ -f /etc/monit/conf.d/ralf.monit ]; then
rm /etc/monit/conf.d/ralf.monit

# Force monit to reload its configuration
reload clearwater-monit || true

# Stop ralf if it was running
service ralf stop
fi

else
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

else branch has incorrect indentation.


# Set up the monit configuration for ralf with the right IP addresses and ports
cat > /etc/monit/conf.d/ralf.monit <<EOF
# Check the Ralf process.
# Monitor the service's PID file and memory use.
Expand Down Expand Up @@ -44,7 +58,10 @@ check program poll_ralf with path "/usr/share/clearwater/bin/poll_ralf.sh"
# Aborting generates a core file and triggers diagnostic collection.
if status != 0 for 2 cycles then exec "/bin/bash -c '/usr/share/clearwater/bin/issue-alarm monit 2000.3; /etc/init.d/ralf abort'"
EOF
chmod 0644 /etc/monit/conf.d/ralf.monit

# Force monit to reload its configuration
reload clearwater-monit || true
chmod 0644 /etc/monit/conf.d/ralf.monit

# Force monit to reload its configuration
reload clearwater-monit || true

fi
9 changes: 8 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,13 @@ int main(int argc, char**argv)
}
}

// Check we've been provided with a hostname
if (options.ralf_hostname == "")
{
TRC_ERROR("No Ralf hostname provided - exiting");
return 1;
}

// Parse the session-stores argument.
std::string session_store_location;
std::vector<std::string> remote_session_stores_locations;
Expand Down Expand Up @@ -775,7 +782,7 @@ int main(int argc, char**argv)
std::string chronos_callback_addr = "127.0.0.1:" + port_str;
int http_af = AF_INET;

if (options.chronos_hostname == "" || options.ralf_hostname == "")
if (options.chronos_hostname == "")
{
// If we are using a local chronos cluster, we want Chronos to call back to
// its local Ralf instance so that we can handle Ralfs failing without missing
Expand Down