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

Commit

Permalink
Merge pull request #276 from Metaswitch/ralf_hostname
Browse files Browse the repository at this point in the history
Don't run Ralf if there is no Ralf hostname.
  • Loading branch information
richardwhiuk committed Jun 13, 2017
2 parents 172f388 + a712cdc commit 9ab8d61
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
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

# 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 @@ -582,6 +582,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 @@ -787,7 +794,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

0 comments on commit 9ab8d61

Please sign in to comment.