code: public static void checkHealth() throws ConfigurationException
      {
          Keyspace keyspace;
          try
          {
              keyspace = Keyspace.open(Keyspace.SYSTEM_KS);
          }
          catch (AssertionError err)
          {
              // this happens when a user switches from OPP to RP.
              ConfigurationException ex = new ConfigurationException("Could not read system keyspace!");
              ex.initCause(err);
              throw ex;
          }
          ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(LOCAL_CF);
  
          String req = "SELECT cluster_name FROM system.%s WHERE key='%s'";
          UntypedResultSet result = executeInternal(String.format(req, LOCAL_CF, LOCAL_KEY));
  
          if (result.isEmpty() || !result.one().has("cluster_name"))
          {
              // this is a brand new node
              if (!cfs.getSSTables().isEmpty())
                  throw new ConfigurationException("Found system keyspace files, but they couldn't be loaded!");
  
              // no system files.  this is a new node.
              req = "INSERT INTO system.%s (key, cluster_name) VALUES ('%s', ?)";
              executeInternal(String.format(req, LOCAL_CF, LOCAL_KEY), DatabaseDescriptor.getClusterName());
              return;
          }
  
          String savedClusterName = result.one().getString("cluster_name");
          if (!DatabaseDescriptor.getClusterName().equals(savedClusterName))
              throw new ConfigurationException("Saved cluster name " + savedClusterName + " != configured name " + DatabaseDescriptor.getClusterName());
      }
docs: One of three things will happen if you try to read the system keyspace:
  1. files are present and you can read them: great
  2. no files are there: great (new node is assumed)
  3. files are present but you can't read them: bad
  @throws ConfigurationException