Class AoservDaemonConnector
java.lang.Object
com.aoindustries.aoserv.daemon.client.AoservDaemonConnector
A
AoservDaemonConnector
provides the
connections between a client and a server-control daemon.- Author:
- AO Industries, Inc.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Called once the dump size is known and before the stream is written to. -
Method Summary
Modifier and TypeMethodDescriptioncheckMysqlTables
(PosixPath failoverRoot, int nestedOperatingSystemVersion, Server.Name serverName, Port port, Database.Name databaseName, List<? extends TableName> tableNames) checkPort
(InetAddress ipAddress, Port port, String appProtocol, String monitoringParameters) Checks a port from the server point of view.checkSmtpBlacklist
(InetAddress sourceIp, InetAddress connectIp) Checks for a SMTP blacklist from the server point of view.checkSslCertificate
(int sslCertificate, boolean allowCached) boolean
compareLinuxAccountPassword
(User.Name username, String password) Compares to the password list on the server.long
copyHomeDirectory
(User.Name username, AoservDaemonConnector toConnector) Copies a home directory.createVirtualServer
(String virtualServer) destroyVirtualServer
(String virtualServer) void
dumpMysqlDatabase
(int pkey, boolean gzip, AoservDaemonConnector.DumpSizeCallback onDumpSize, StreamableOutput masterOut) void
dumpPostgresDatabase
(int pkey, boolean gzip, AoservDaemonConnector.DumpSizeCallback onDumpSize, StreamableOutput masterOut) Gets a 3ware RAID report.void
getAwstatsFile
(String siteName, String path, String queryString, StreamableOutput out) int
Allocates a connection to the server.getConnection
(int maxConnections) Allocates a connection to the server.int
static AoservDaemonConnector
getConnector
(HostAddress hostname, InetAddress localIp, Port port, String protocol, UnprotectedKey key, int poolSize, long maxConnectionAge, String trustStore, String trustStorePassword) Gets the defaultAoservConnector
as defined in theclient.properties
resource.long
getCronTable
(User.Name username) Gets a cron table.long
Gets the total size of a mounted filesystem in bytes.long
Gets the used size of a mounted filesystem in bytes.Gets a DRBD report.getEmailListFile
(PosixPath path) Gets the file used by an email list.getEncryptedLinuxAccountPassword
(User.Name username) Gets the encrypted password for a linux account as found in the /etc/shadow file.getEncryptedMysqlUserPassword
(int mysqlServer, User.Name username) Gets the encrypted password for a MySQL user as found in user table.getFailoverFileReplicationActivity
(int replication) Gets a filesystems CSV report.Gets a hard drive model report.Gets a hard drive temperature report.Gets the hostname that is connected to.int
getHttpdServerConcurrency
(int httpdServer) Gets the current concurrency for a HTTP server.long[]
getImapFolderSizes
(User.Name username, String[] folderNames) getInboxAttributes
(User.Name username) Gets a load average report.Gets the local IP address that connections are established from.String[]
Gets a LVM report.int
long
Gets a MD mismatch report.Gets a /proc/mdstat report.Gets a meminfo report.void
getMrtgFile
(String filename, StreamableOutput out) getMysqlMasterStatus
(int mysqlServer) getMysqlSlaveStatus
(PosixPath failoverRoot, int nestedOperatingSystemVersion, Server.Name serverName, Port port) getMysqlTableStatus
(PosixPath failoverRoot, int nestedOperatingSystemVersion, Server.Name serverName, Port port, Database.Name databaseName) getNetDeviceBondingReport
(int pkey) Gets a bonding report.getNetDeviceStatisticsReport
(int pkey) Gets a statistics report.int
getPort()
Gets the port that is connected to.getPostgresUserPassword
(int pkey) Gets the password for a PostgreSQL user as found in pg_shadow or pg_authid table.long
Gets the current system time.long
long
Gets the UPS status.int
getVirtualServerStatus
(String virtualServer) Gets the list of servers configured to auto-start in /etc/xen/auto.void
grantDaemonAccess
(long key, int command, String param1, String param2, String param3, String param4) boolean
isProcmailManual
(int lsa) Determines if the inbox is in manual procmail mode.pauseVirtualServer
(String virtualServer) void
printConnectionStatsHtml
(Appendable out, boolean isXhtml) rebootVirtualServer
(String virtualServer) void
removeEmailList
(PosixPath listPath) Deletes the contents of an email list.void
void
void
restartMysql
(int mysqlServer) void
restartPostgres
(int pkey) void
void
void
setAutoresponderContent
(PosixPath path, String content, int uid, int gid) void
setCronTable
(User.Name username, String cronTable) Sets a cron table.void
setEmailListFile
(PosixPath path, String file, int uid, int gid, int mode) Sets the file used by an email list.void
setEncryptedLinuxAccountPassword
(User.Name username, String encryptedPassword, Integer changedDate) Sets the encrypted password for a Linux account.void
setLinuxServerAccountPassword
(User.Name username, String plainPassword) Sets the password for aLinuxServerAccount
.void
setMysqlUserPassword
(int mysqlServer, User.Name username, String password) Sets the password for aMysqlServerUser
.void
setPostgresUserPassword
(int pkey, String password) Sets the password for aPostgresServerUser
.shutdownVirtualServer
(String virtualServer) void
void
void
startDistro
(boolean includeUser) Starts a distribution verification.startJvm
(int httpdSite) Starts a Java VM.void
startMysql
(int mysqlServer) void
startPostgresql
(int pkey) void
startXfs()
void
void
void
stopCron()
stopJvm
(int httpdSite) Stops a Java VM.void
stopMysql
(int mysqlServer) void
stopPostgresql
(int pkey) void
stopXfs()
void
stopXvfb()
toString()
unpauseVirtualServer
(String virtualServer) void
updateVirtualDiskLastVerified
(String virtualServerName, String device, long lastVerified) Updates the record of when a virtual disk was last verified.long
verifyVirtualDisk
(String virtualServerName, String device) Begins verification of a virtual disk, returns the Unix time in seconds since Epoch.void
void
void
void
void
void
void
void
void
-
Method Details
-
getConcurrency
public int getConcurrency() -
getConnection
Allocates a connection to the server. These connections must later be released with thereleaseConnection
method. Connection pooling is obtained this way. These connections may be over any protocol, so they may only be used for one client/server exchange at a time.- Throws:
IOException
-
getConnection
Allocates a connection to the server. These connections must later be released with thereleaseConnection
method. Connection pooling is obtained this way. These connections may be over any protocol, so they may only be used for one client/server exchange at a time.- Throws:
IOException
-
getConnectionCount
public int getConnectionCount() -
getConnector
public static AoservDaemonConnector getConnector(HostAddress hostname, InetAddress localIp, Port port, String protocol, UnprotectedKey key, int poolSize, long maxConnectionAge, String trustStore, String trustStorePassword) Gets the defaultAoservConnector
as defined in theclient.properties
resource. Each possible protocol is tried, in order, until a successful connection is made. If no connection is made, anIOException
is thrown. -
getConnects
public long getConnects() -
getHostname
Gets the hostname that is connected to. -
getLocalIp
Gets the local IP address that connections are established from. -
getMaxConcurrency
public int getMaxConcurrency() -
getMaxConnectionAge
public long getMaxConnectionAge() -
getPoolSize
public int getPoolSize() -
getPort
Gets the port that is connected to. -
getTotalTime
public long getTotalTime() -
getTransactionCount
public long getTransactionCount() -
printConnectionStatsHtml
- Throws:
IOException
-
toString
-
copyHomeDirectory
public long copyHomeDirectory(User.Name username, AoservDaemonConnector toConnector) throws IOException, SQLException Copies a home directory.- Parameters:
username
- the username to copy the home directory oftoConnector
- the connector to send the data to- Returns:
- the number of bytes transferred
- Throws:
IOException
SQLException
-
dumpMysqlDatabase
public void dumpMysqlDatabase(int pkey, boolean gzip, AoservDaemonConnector.DumpSizeCallback onDumpSize, StreamableOutput masterOut) throws IOException, SQLException - Throws:
IOException
SQLException
-
dumpPostgresDatabase
public void dumpPostgresDatabase(int pkey, boolean gzip, AoservDaemonConnector.DumpSizeCallback onDumpSize, StreamableOutput masterOut) throws IOException, SQLException - Throws:
IOException
SQLException
-
getAutoresponderContent
- Throws:
IOException
SQLException
-
getCronTable
Gets a cron table.- Parameters:
username
- the username to copy the home directory of- Returns:
- the cron table
- Throws:
IOException
SQLException
-
getNetDeviceBondingReport
Gets a bonding report.- Parameters:
pkey
- the unique ID of the net_device- Returns:
- the report
- Throws:
IOException
SQLException
-
getNetDeviceStatisticsReport
Gets a statistics report.- Parameters:
pkey
- the unique ID of the net_device- Returns:
- the report
- Throws:
IOException
SQLException
-
isProcmailManual
Determines if the inbox is in manual procmail mode.- Parameters:
lsa
- the pkey of the LinuxServerAccount- Throws:
IOException
SQLException
-
getDiskDeviceTotalSize
Gets the total size of a mounted filesystem in bytes.- Throws:
IOException
SQLException
-
getDiskDeviceUsedSize
Gets the used size of a mounted filesystem in bytes.- Throws:
IOException
SQLException
-
getEmailListFile
Gets the file used by an email list.- Throws:
IOException
SQLException
-
getEncryptedLinuxAccountPassword
public Tuple2<String,Integer> getEncryptedLinuxAccountPassword(User.Name username) throws IOException, SQLException Gets the encrypted password for a linux account as found in the /etc/shadow file.- Throws:
IOException
SQLException
-
getImapFolderSizes
public long[] getImapFolderSizes(User.Name username, String[] folderNames) throws IOException, SQLException - Throws:
IOException
SQLException
-
getInboxAttributes
- Throws:
IOException
SQLException
-
getMrtgFile
- Throws:
IOException
SQLException
-
getMysqlMasterStatus
- Throws:
IOException
SQLException
-
getMysqlSlaveStatus
public MysqlReplication.SlaveStatus getMysqlSlaveStatus(PosixPath failoverRoot, int nestedOperatingSystemVersion, Server.Name serverName, Port port) throws IOException, SQLException - Throws:
IOException
SQLException
-
getMysqlTableStatus
public List<Database.TableStatus> getMysqlTableStatus(PosixPath failoverRoot, int nestedOperatingSystemVersion, Server.Name serverName, Port port, Database.Name databaseName) throws IOException, SQLException - Throws:
IOException
SQLException
-
checkMysqlTables
public List<Database.CheckTableResult> checkMysqlTables(PosixPath failoverRoot, int nestedOperatingSystemVersion, Server.Name serverName, Port port, Database.Name databaseName, List<? extends TableName> tableNames) throws IOException, SQLException - Throws:
IOException
SQLException
-
getAwstatsFile
public void getAwstatsFile(String siteName, String path, String queryString, StreamableOutput out) throws IOException, SQLException - Throws:
IOException
SQLException
-
compareLinuxAccountPassword
public boolean compareLinuxAccountPassword(User.Name username, String password) throws IOException, SQLException Compares to the password list on the server.- Throws:
IOException
SQLException
-
getEncryptedMysqlUserPassword
public String getEncryptedMysqlUserPassword(int mysqlServer, User.Name username) throws IOException, SQLException Gets the encrypted password for a MySQL user as found in user table.- Throws:
IOException
SQLException
-
getPostgresUserPassword
Gets the password for a PostgreSQL user as found in pg_shadow or pg_authid table.- Throws:
IOException
SQLException
-
grantDaemonAccess
public void grantDaemonAccess(long key, int command, String param1, String param2, String param3, String param4) throws IOException, SQLException - Throws:
IOException
SQLException
-
removeEmailList
Deletes the contents of an email list.- Throws:
IOException
SQLException
-
restartApache
- Throws:
IOException
SQLException
-
restartCron
- Throws:
IOException
SQLException
-
restartMysql
- Throws:
IOException
SQLException
-
restartPostgres
- Throws:
IOException
SQLException
-
restartXfs
- Throws:
IOException
SQLException
-
restartXvfb
- Throws:
IOException
SQLException
-
setAutoresponderContent
public void setAutoresponderContent(PosixPath path, String content, int uid, int gid) throws IOException, SQLException - Throws:
IOException
SQLException
-
setCronTable
Sets a cron table.- Parameters:
username
- the username to copy the home directory ofcronTable
- the new cron table- Throws:
IOException
SQLException
-
setEmailListFile
public void setEmailListFile(PosixPath path, String file, int uid, int gid, int mode) throws IOException, SQLException Sets the file used by an email list.- Throws:
IOException
SQLException
-
setEncryptedLinuxAccountPassword
public void setEncryptedLinuxAccountPassword(User.Name username, String encryptedPassword, Integer changedDate) throws IOException, SQLException Sets the encrypted password for a Linux account.- Throws:
IOException
SQLException
-
setLinuxServerAccountPassword
public void setLinuxServerAccountPassword(User.Name username, String plainPassword) throws IOException, SQLException Sets the password for aLinuxServerAccount
.- Throws:
IOException
SQLException
-
setMysqlUserPassword
public void setMysqlUserPassword(int mysqlServer, User.Name username, String password) throws IOException, SQLException Sets the password for aMysqlServerUser
.- Throws:
IOException
SQLException
-
setPostgresUserPassword
Sets the password for aPostgresServerUser
.- Throws:
IOException
SQLException
-
startApache
- Throws:
IOException
SQLException
-
startCron
- Throws:
IOException
SQLException
-
startDistro
Starts a distribution verification.- Throws:
IOException
SQLException
-
startJvm
Starts a Java VM.- Throws:
IOException
SQLException
-
startMysql
- Throws:
IOException
SQLException
-
startPostgresql
- Throws:
IOException
SQLException
-
startXfs
- Throws:
IOException
SQLException
-
startXvfb
- Throws:
IOException
SQLException
-
stopApache
- Throws:
IOException
SQLException
-
stopCron
- Throws:
IOException
SQLException
-
stopJvm
Stops a Java VM.- Throws:
IOException
SQLException
-
stopMysql
- Throws:
IOException
SQLException
-
stopPostgresql
- Throws:
IOException
SQLException
-
stopXfs
- Throws:
IOException
SQLException
-
stopXvfb
- Throws:
IOException
SQLException
-
waitForHttpdSiteRebuild
- Throws:
IOException
SQLException
-
waitForLinuxAccountRebuild
- Throws:
IOException
SQLException
-
waitForMysqlDatabaseRebuild
- Throws:
IOException
SQLException
-
waitForMysqlDbUserRebuild
- Throws:
IOException
SQLException
-
waitForMysqlServerRebuild
- Throws:
IOException
SQLException
-
waitForMysqlUserRebuild
- Throws:
IOException
SQLException
-
waitForPostgresDatabaseRebuild
- Throws:
IOException
SQLException
-
waitForPostgresServerRebuild
- Throws:
IOException
SQLException
-
waitForPostgresUserRebuild
- Throws:
IOException
SQLException
-
get3wareRaidReport
Gets a 3ware RAID report.- Returns:
- the report
- Throws:
IOException
SQLException
-
getUpsStatus
Gets the UPS status.- Returns:
- the report
- Throws:
IOException
SQLException
-
getMdStatReport
Gets a /proc/mdstat report.- Returns:
- the report
- Throws:
IOException
SQLException
-
getMdMismatchReport
Gets a MD mismatch report.- Returns:
- the report
- Throws:
IOException
SQLException
-
getDrbdReport
Gets a DRBD report.- Returns:
- the report
- Throws:
IOException
SQLException
-
getFailoverFileReplicationActivity
public Tuple2<Long,String> getFailoverFileReplicationActivity(int replication) throws IOException, SQLException - Throws:
IOException
SQLException
-
getLvmReport
Gets a LVM report.- Returns:
- the report
- Throws:
IOException
SQLException
-
getHddTempReport
Gets a hard drive temperature report.- Returns:
- the report
- Throws:
IOException
SQLException
-
getHddModelReport
Gets a hard drive model report.- Returns:
- the report
- Throws:
IOException
SQLException
-
getFilesystemsCsvReport
Gets a filesystems CSV report.- Returns:
- the report
- Throws:
IOException
SQLException
-
getLoadAvgReport
Gets a load average report.- Returns:
- the report
- Throws:
IOException
SQLException
-
getMemInfoReport
Gets a meminfo report.- Returns:
- the report
- Throws:
IOException
SQLException
-
checkPort
public String checkPort(InetAddress ipAddress, Port port, String appProtocol, String monitoringParameters) throws IOException, SQLException Checks a port from the server point of view.- Returns:
- the result
- Throws:
IOException
SQLException
-
checkSmtpBlacklist
public String checkSmtpBlacklist(InetAddress sourceIp, InetAddress connectIp) throws IOException, SQLException Checks for a SMTP blacklist from the server point of view.- Returns:
- the status line
- Throws:
IOException
SQLException
-
checkSslCertificate
public List<Certificate.Check> checkSslCertificate(int sslCertificate, boolean allowCached) throws IOException, SQLException - Throws:
IOException
SQLException
-
getSystemTimeMillis
Gets the current system time.- Returns:
- the report
- Throws:
IOException
SQLException
-
getXenAutoStartLinks
Gets the list of servers configured to auto-start in /etc/xen/auto.- Throws:
IOException
SQLException
-
createVirtualServer
- Throws:
IOException
SQLException
-
rebootVirtualServer
- Throws:
IOException
SQLException
-
shutdownVirtualServer
- Throws:
IOException
SQLException
-
destroyVirtualServer
- Throws:
IOException
SQLException
-
pauseVirtualServer
- Throws:
IOException
SQLException
-
unpauseVirtualServer
- Throws:
IOException
SQLException
-
getVirtualServerStatus
- Throws:
IOException
SQLException
-
verifyVirtualDisk
public long verifyVirtualDisk(String virtualServerName, String device) throws IOException, SQLException Begins verification of a virtual disk, returns the Unix time in seconds since Epoch.- Throws:
IOException
SQLException
-
updateVirtualDiskLastVerified
public void updateVirtualDiskLastVerified(String virtualServerName, String device, long lastVerified) throws IOException, SQLException Updates the record of when a virtual disk was last verified.- Throws:
IOException
SQLException
-
getHttpdServerConcurrency
Gets the current concurrency for a HTTP server.- Returns:
- the concurrency
- Throws:
IOException
SQLException
-