- java.lang.Object
-
- com.aoindustries.aoserv.client.AOServObject<K,T>
-
- com.aoindustries.aoserv.client.CachedObject<Integer,V>
-
- com.aoindustries.aoserv.client.CachedObjectIntegerKey<Server>
-
- com.aoindustries.aoserv.client.linux.Server
-
- All Implemented Interfaces:
Streamable,StreamReadable,StreamWritable,Row,DtoFactory<LinuxServer>,AOServReadable,AOServStreamable,AOServWritable,SingleTableObject<Integer,Server>
public final class Server extends CachedObjectIntegerKey<Server> implements DtoFactory<LinuxServer>
AServerstores the details about a server that runs the AOServ distribution.- Author:
- AO Industries, Inc.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classServer.DaemonAccessstatic classServer.DrbdReportstatic classServer.FilesystemReportstatic classServer.LvmReportstatic classServer.MdMismatchReportThe results of the most recent weekly RAID check.static classServer.RaidLevel
-
Field Summary
Fields Modifier and Type Field Description static StringCOLUMN_HOSTNAME_name-
Fields inherited from class com.aoindustries.aoserv.client.CachedObjectIntegerKey
pkey
-
Fields inherited from class com.aoindustries.aoserv.client.CachedObject
table
-
Fields inherited from class com.aoindustries.aoserv.client.AOServObject
USE_ARRAY_OF_DOMAIN, USE_SQL_DATA, USE_SQL_DATA_WRITE
-
-
Constructor Summary
Constructors Constructor Description Server()
-
Method Summary
-
Methods inherited from class com.aoindustries.aoserv.client.CachedObjectIntegerKey
equals, getKey, getPkey, hashCode
-
Methods inherited from class com.aoindustries.aoserv.client.CachedObject
getTable, setTable
-
Methods inherited from class com.aoindustries.aoserv.client.AOServObject
compare, compare, compare, compare, compareIgnoreCaseConsistentWithEquals, compareTo, compareTo, compareTo, getAccountingCode, getColumn, getColumns, getColumns, getDomainLabel, getDomainLabels, getDomainName, getDto, getEmail, getGecos, getGroupId, getHashedKey, getHashedPassword, getHostname, getInetAddress, getLinuxID, getLinuxUserName, getMacAddress, getMySQLDatabaseName, getMySQLServerName, getMysqlUserName, getPort, getPostgresDatabaseName, getPostgresServerName, getPostgresUserId, getTableSchema, getTimeMillis, getTimeMillis, getUnixPath, getUserId, read, toString, write
-
-
-
-
Field Detail
-
COLUMN_HOSTNAME_name
public static final String COLUMN_HOSTNAME_name
- See Also:
- Constant Field Values
-
-
Method Detail
-
getColumnImpl
protected Object getColumnImpl(int i)
- Specified by:
getColumnImplin classAOServObject<Integer,Server>
-
getServer_pkey
public int getServer_pkey()
-
getHost
public Host getHost() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getHostname
public DomainName getHostname()
Gets the unique, fully-qualified hostname for this server. Should be resolvable in DNS to ease maintenance.
-
getDaemonBind_id
public Integer getDaemonBind_id()
-
getDaemonBind
public Bind getDaemonBind() throws IOException, SQLException
Gets the port information to bind to.- Throws:
IOExceptionSQLException
-
getPoolSize
public int getPoolSize()
-
getDistroHour
public int getDistroHour()
-
getLastDistroTime
public UnmodifiableTimestamp getLastDistroTime()
-
getFailoverServer_server_pkey
public Integer getFailoverServer_server_pkey()
-
getFailoverServer
public Server getFailoverServer() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getDaemonDeviceId_name
public String getDaemonDeviceId_name()
-
getDaemonDeviceId
public DeviceId getDaemonDeviceId() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getDaemonConnectBind_id
public Integer getDaemonConnectBind_id()
-
getDaemonConnectBind
public Bind getDaemonConnectBind() throws IOException, SQLException
Gets the port information to connect to.- Throws:
IOExceptionSQLException
-
getTimeZone_name
public String getTimeZone_name()
-
getTimeZone
public TimeZone getTimeZone() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getJilterBind_id
public Integer getJilterBind_id()
-
getJilterBind
public Bind getJilterBind() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getRestrictOutboundEmail
public boolean getRestrictOutboundEmail()
-
getDaemonConnectAddress
public HostAddress getDaemonConnectAddress()
Gets the address that should be connected to in order to reach this server. This overrides both getDaemonConnectBind and getDaemonBind.- See Also:
getDaemonConnectBind(),getDaemonBind()
-
getFailoverBatchSize
public int getFailoverBatchSize()
Gets the number of filesystem entries sent per batch during failover replications.
-
getMonitoringLoadLow
public float getMonitoringLoadLow()
Gets the 5-minute load average that is considered a low-priority alert orNaNif no alert allowed at this level.
-
getMonitoringLoadMedium
public float getMonitoringLoadMedium()
Gets the 5-minute load average that is considered a medium-priority alert orNaNif no alert allowed at this level.
-
getMonitoringLoadHigh
public float getMonitoringLoadHigh()
Gets the 5-minute load average that is considered a high-priority alert orNaNif no alert allowed at this level.
-
getMonitoringLoadCritical
public float getMonitoringLoadCritical()
Gets the 5-minute load average that is considered a critical-priority alert orNaNif no alert allowed at this level. This is the level that will alert people 24x7.
-
getUidMin
public LinuxId getUidMin()
Gets the min value for automatic uid selection in useradd.
-
getGidMin
public LinuxId getGidMin()
Gets the min value for automatic gid selection in groupadd.
-
getUidMax
public LinuxId getUidMax()
Gets the max value for automatic uid selection in useradd.
-
getGidMax
public LinuxId getGidMax()
Gets the max value for automatic gid selection in groupadd.
-
getLastUid
public LinuxId getLastUid()
Gets the last value for automatic uid selection in useradd, if any.
-
getLastGid
public LinuxId getLastGid()
Gets the last value for automatic gid selection in groupadd, if any.
-
getSftpUmask
public long getSftpUmask()
Gets the optional umask for the sftp-server or-1for none.
-
init
public void init(ResultSet result) throws SQLException
Description copied from class:AOServObjectInitializes this object from the raw database contents.- Specified by:
initin classAOServObject<Integer,Server>- Parameters:
result- theResultSetcontaining the row to copy into this object- Throws:
SQLException
-
read
public void read(StreamableInput in, AoservProtocol.Version protocolVersion) throws IOException
- Specified by:
readin interfaceAOServReadable- Specified by:
readin interfaceAOServStreamable- Specified by:
readin classAOServObject<Integer,Server>- Throws:
IOException
-
write
public void write(StreamableOutput out, AoservProtocol.Version protocolVersion) throws IOException
- Specified by:
writein interfaceAOServStreamable- Specified by:
writein interfaceAOServWritable- Specified by:
writein classAOServObject<Integer,Server>- Throws:
IOException
-
addCvsRepository
public int addCvsRepository(PosixPath path, UserServer lsa, GroupServer lsg, long mode) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
addEmailDomain
public int addEmailDomain(DomainName domain, Package packageObject) throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
addEmailPipe
public int addEmailPipe(String command, Package packageObject) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
addHttpdJBossSite
public int addHttpdJBossSite(String siteName, Package packageObj, User siteUser, Group siteGroup, Email serverAdmin, boolean useApache, IpAddress ipAddress, DomainName primaryHttpHostname, DomainName[] altHttpHostnames, Version jBossVersion) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
addHttpdSharedTomcat
public int addHttpdSharedTomcat(String name, Version version, UserServer lsa, GroupServer lsg) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
addHttpdTomcatSharedSite
public int addHttpdTomcatSharedSite(String siteName, Package packageObj, User siteUser, Group siteGroup, Email serverAdmin, boolean useApache, IpAddress ipAddress, DomainName primaryHttpHostname, DomainName[] altHttpHostnames, String sharedTomcatName) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
addHttpdTomcatStdSite
public int addHttpdTomcatStdSite(String siteName, Package packageObj, User jvmUser, Group jvmGroup, Email serverAdmin, boolean useApache, IpAddress ipAddress, DomainName primaryHttpHostname, DomainName[] altHttpHostnames, Version tomcatVersion) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
addSystemGroup
public int addSystemGroup(Group.Name groupName, int gid) throws IOException, SQLException
Adds a new system group. This is for the AOServ Daemon to register newly installed local system groups, such as those added through routine RPM installation. The master will check that the requested group matches expected settings.- Throws:
IOExceptionSQLException
-
addSystemUser
public int addSystemUser(User.Name username, int uid, int gid, User.Gecos fullName, User.Gecos officeLocation, User.Gecos officePhone, User.Gecos homePhone, PosixPath home, PosixPath shell) throws IOException, SQLException
Adds a new system user. This is for the AOServ Daemon to register newly installed local system users, such as those added through routine RPM installation. The master will check that the requested user matches expected settings.- Throws:
IOExceptionSQLException
-
getAOServerDaemonHosts
public List<DaemonAcl> getAOServerDaemonHosts() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getBackupPartitions
public List<BackupPartition> getBackupPartitions() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getBackupPartitionForPath
public BackupPartition getBackupPartitionForPath(String path) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getBlackholeEmailAddresses
public List<BlackholeAddress> getBlackholeEmailAddresses() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getCvsRepository
public CvsRepository getCvsRepository(PosixPath path) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getCvsRepositories
public List<CvsRepository> getCvsRepositories() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getDaemonIPAddress
public IpAddress getDaemonIPAddress() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getCyrusImapdServer
public CyrusImapdServer getCyrusImapdServer() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getEmailAddresses
public List<Address> getEmailAddresses() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getEmailDomain
public Domain getEmailDomain(DomainName domain) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getEmailDomains
public List<Domain> getEmailDomains() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getEmailForwarding
public List<Forwarding> getEmailForwarding() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getEmailList
public List getEmailList(PosixPath path) throws IOException, SQLException
Rename to getEmailList when all uses updated.- Throws:
IOExceptionSQLException
-
getEmailListAddresses
public List<ListAddress> getEmailListAddresses() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getEmailPipeAddresses
public List<PipeAddress> getEmailPipeAddresses() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getEmailPipes
public List<Pipe> getEmailPipes() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getEmailSmtpRelay
public SmtpRelay getEmailSmtpRelay(Package pk, HostAddress host) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getEmailSmtpRelays
public List<SmtpRelay> getEmailSmtpRelays() throws IOException, SQLException
Gets all of the smtp relays settings that apply to either all servers or this server specifically.- Throws:
IOExceptionSQLException
-
getFTPGuestUsers
public List<GuestUser> getFTPGuestUsers() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getHttpdServers
public List<HttpdServer> getHttpdServers() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getHttpdSharedTomcats
public List<SharedTomcat> getHttpdSharedTomcats() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getHttpdSharedTomcat
public SharedTomcat getHttpdSharedTomcat(String jvmName) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getHttpdSite
public Site getHttpdSite(String siteName) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getHttpdSites
public List<Site> getHttpdSites() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getLinuxAccAddresses
public List<InboxAddress> getLinuxAccAddresses() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getLinuxAccounts
public List<User> getLinuxAccounts() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getLinuxGroups
public List<Group> getLinuxGroups() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getLinuxServerAccount
public UserServer getLinuxServerAccount(User.Name username) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getLinuxServerAccount
public UserServer getLinuxServerAccount(LinuxId uid) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getLinuxServerAccounts
public List<UserServer> getLinuxServerAccounts() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getLinuxServerGroup
public GroupServer getLinuxServerGroup(LinuxId gid) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getLinuxServerGroup
public GroupServer getLinuxServerGroup(Group.Name groupName) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getLinuxServerGroups
public List<GroupServer> getLinuxServerGroups() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getMajordomoServers
public List<MajordomoServer> getMajordomoServers() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getMrtgFile
public void getMrtgFile(String filename, OutputStream out) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getMySQLServer
public Server getMySQLServer(Server.Name name) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getMySQLServers
public List<Server> getMySQLServers() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getPreferredMySQLServer
public Server getPreferredMySQLServer() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getNestedServers
public List<Server> getNestedServers() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getPostgresServer
public Server getPostgresServer(Server.Name name) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getPostgresServers
public List<Server> getPostgresServers() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getPreferredPostgresServer
public Server getPreferredPostgresServer() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getPrimaryIPAddress
public IpAddress getPrimaryIPAddress() throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
getPrivateFTPServers
public List<PrivateServer> getPrivateFTPServers() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getSendmailServers
public List<SendmailServer> getSendmailServers() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getSslCertificates
public List<Certificate> getSslCertificates() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getSystemEmailAliases
public List<SystemAlias> getSystemEmailAliases() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getTableID
public Table.TableID getTableID()
- Specified by:
getTableIDin classAOServObject<Integer,Server>
-
isEmailDomainAvailable
public boolean isEmailDomainAvailable(DomainName domain) throws SQLException, IOException
- Throws:
SQLExceptionIOException
-
isHomeUsed
public boolean isHomeUsed(PosixPath directory) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
isMySQLServerNameAvailable
public boolean isMySQLServerNameAvailable(Server.Name name) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
isPostgresServerNameAvailable
public boolean isPostgresServerNameAvailable(Server.Name name) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
restartApache
public void restartApache() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
restartCron
public void restartCron() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
restartXfs
public void restartXfs() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
restartXvfb
public void restartXvfb() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
setLastDistroTime
public void setLastDistroTime(Timestamp distroTime) throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
startApache
public void startApache() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
startCron
public void startCron() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
startDistro
public void startDistro(boolean includeUser) throws IOException, SQLException- Throws:
IOExceptionSQLException
-
startXfs
public void startXfs() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
startXvfb
public void startXvfb() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
stopApache
public void stopApache() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
stopCron
public void stopCron() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
stopXfs
public void stopXfs() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
stopXvfb
public void stopXvfb() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
toStringImpl
public String toStringImpl()
Description copied from class:AOServObjectAOServObject.toString()implementation that is allowed to throw exceptions.Implementation Note:
This default implementation callsAOServObject.toString()on the key (fromAOServObject.getKey()). When the key isnull, uses the default implementation fromObject.toString().- Overrides:
toStringImplin classCachedObjectIntegerKey<Server>
-
waitForHttpdSiteRebuild
public void waitForHttpdSiteRebuild() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
waitForLinuxAccountRebuild
public void waitForLinuxAccountRebuild() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
waitForMySQLDatabaseRebuild
public void waitForMySQLDatabaseRebuild() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
waitForMySQLDBUserRebuild
public void waitForMySQLDBUserRebuild() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
waitForMySQLServerRebuild
public void waitForMySQLServerRebuild() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
waitForMySQLUserRebuild
public void waitForMySQLUserRebuild() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
waitForPostgresDatabaseRebuild
public void waitForPostgresDatabaseRebuild() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
waitForPostgresServerRebuild
public void waitForPostgresServerRebuild() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
waitForPostgresUserRebuild
public void waitForPostgresUserRebuild() throws IOException, SQLException- Throws:
IOExceptionSQLException
-
get3wareRaidReport
public String get3wareRaidReport() throws IOException, SQLException
Gets the 3ware RAID report.- Throws:
IOExceptionSQLException
-
getMdStatReport
public String getMdStatReport() throws IOException, SQLException
Gets the /proc/mdstat report.- Throws:
IOExceptionSQLException
-
getMdMismatchReport
public List<Server.MdMismatchReport> getMdMismatchReport() throws IOException, SQLException, ParseException
Gets the MD mismatch report.- Throws:
IOExceptionSQLExceptionParseException
-
parseMdMismatchReport
public static List<Server.MdMismatchReport> parseMdMismatchReport(String mismatchReport) throws ParseException
Parses a MD mismatch report.- Throws:
ParseException
-
getDrbdReport
public List<Server.DrbdReport> getDrbdReport() throws IOException, SQLException, ParseException
Gets the DRBD report.- Throws:
IOExceptionSQLExceptionParseException
-
parseDrbdReport
public static List<Server.DrbdReport> parseDrbdReport(String drbdReport) throws ParseException
Parses a DRBD report.- Throws:
ParseException
-
getLvmReport
public Server.LvmReport getLvmReport() throws IOException, SQLException, ParseException
Gets the LVM report.- Throws:
IOExceptionSQLExceptionParseException
-
getHddTempReport
public String getHddTempReport() throws IOException, SQLException
Gets the hard drive temperature report.- Throws:
IOExceptionSQLException
-
getHddModelReport
public Map<String,String> getHddModelReport() throws IOException, SQLException, ParseException
Gets the model of each hard drive on the server. The key is the device name and the value is the model name.- Throws:
IOExceptionSQLExceptionParseException
-
getFilesystemsCsvReport
@Deprecated public String getFilesystemsCsvReport() throws IOException, SQLException
Deprecated.UsegetFilesystemsCsvReport()instead to let the API parse the report.Gets the filesystem states report.- Throws:
IOExceptionSQLException
-
getFilesystemsReport
public Map<String,Server.FilesystemReport> getFilesystemsReport() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
getLoadAvgReport
public String getLoadAvgReport() throws IOException, SQLException
Gets the output of /proc/loadavg- Throws:
IOExceptionSQLException
-
getMemInfoReport
public String getMemInfoReport() throws IOException, SQLException
Gets the output of /proc/meminfo- Throws:
IOExceptionSQLException
-
checkPort
public String checkPort(InetAddress ipAddress, Port port, String appProtocol, URIParameters monitoringParameters) throws IOException, SQLException
Checks a port from the daemon's point of view. This is required for monitoring of private and loopback IPs.- Throws:
IOExceptionSQLException
-
getSystemTimeMillis
public long getSystemTimeMillis() throws IOException, SQLExceptionGets the current system time in milliseconds.- Throws:
IOExceptionSQLException
-
getFailoverMySQLReplications
public List<MysqlReplication> getFailoverMySQLReplications() throws IOException, SQLException
- Throws:
IOExceptionSQLException
-
checkSmtpBlacklist
public String checkSmtpBlacklist(InetAddress sourceIp, InetAddress connectIp) throws IOException, SQLException
Gets the status line of a SMTP server from the server from the provided source IP.- Throws:
IOExceptionSQLException
-
getUpsStatus
public String getUpsStatus() throws IOException, SQLException
Gets UPS status report- Throws:
IOExceptionSQLException
-
getDto
public LinuxServer getDto()
- Specified by:
getDtoin interfaceDtoFactory<LinuxServer>
-
-