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
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCalled 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<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) booleancompareLinuxAccountPassword(User.Name username, String password) Compares to the password list on the server.longcopyHomeDirectory(User.Name username, AoservDaemonConnector toConnector) Copies a home directory.createVirtualServer(String virtualServer) destroyVirtualServer(String virtualServer) voiddumpMysqlDatabase(int pkey, boolean gzip, AoservDaemonConnector.DumpSizeCallback onDumpSize, StreamableOutput masterOut) voiddumpPostgresDatabase(int pkey, boolean gzip, AoservDaemonConnector.DumpSizeCallback onDumpSize, StreamableOutput masterOut) Gets a 3ware RAID report.voidgetAwstatsFile(String siteName, String path, String queryString, StreamableOutput out) intAllocates a connection to the server.getConnection(int maxConnections) Allocates a connection to the server.intstatic AoservDaemonConnectorgetConnector(HostAddress hostname, InetAddress localIp, Port port, String protocol, UnprotectedKey key, int poolSize, long maxConnectionAge, String trustStore, String trustStorePassword) Gets the defaultAoservConnectoras defined in theclient.propertiesresource.longgetCronTable(User.Name username) Gets a cron table.longGets the total size of a mounted filesystem in bytes.longGets 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.intgetHttpdServerConcurrency(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.intlongGets a MD mismatch report.Gets a /proc/mdstat report.Gets a meminfo report.voidgetMrtgFile(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.intgetPort()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.longGets the current system time.longlongGets the UPS status.intgetVirtualServerStatus(String virtualServer) Gets the list of servers configured to auto-start in /etc/xen/auto.voidgrantDaemonAccess(long key, int command, String param1, String param2, String param3, String param4) booleanisProcmailManual(int lsa) Determines if the inbox is in manual procmail mode.pauseVirtualServer(String virtualServer) voidprintConnectionStatsHtml(Appendable out, boolean isXhtml) rebootVirtualServer(String virtualServer) voidremoveEmailList(PosixPath listPath) Deletes the contents of an email list.voidvoidvoidrestartMysql(int mysqlServer) voidrestartPostgres(int pkey) voidvoidvoidsetAutoresponderContent(PosixPath path, String content, int uid, int gid) voidsetCronTable(User.Name username, String cronTable) Sets a cron table.voidsetEmailListFile(PosixPath path, String file, int uid, int gid, int mode) Sets the file used by an email list.voidsetEncryptedLinuxAccountPassword(User.Name username, String encryptedPassword, Integer changedDate) Sets the encrypted password for a Linux account.voidsetLinuxServerAccountPassword(User.Name username, String plainPassword) Sets the password for aLinuxServerAccount.voidsetMysqlUserPassword(int mysqlServer, User.Name username, String password) Sets the password for aMysqlServerUser.voidsetPostgresUserPassword(int pkey, String password) Sets the password for aPostgresServerUser.shutdownVirtualServer(String virtualServer) voidvoidvoidstartDistro(boolean includeUser) Starts a distribution verification.startJvm(int httpdSite) Starts a Java VM.voidstartMysql(int mysqlServer) voidstartPostgresql(int pkey) voidstartXfs()voidvoidvoidstopCron()stopJvm(int httpdSite) Stops a Java VM.voidstopMysql(int mysqlServer) voidstopPostgresql(int pkey) voidstopXfs()voidstopXvfb()toString()unpauseVirtualServer(String virtualServer) voidupdateVirtualDiskLastVerified(String virtualServerName, String device, long lastVerified) Updates the record of when a virtual disk was last verified.longverifyVirtualDisk(String virtualServerName, String device) Begins verification of a virtual disk, returns the Unix time in seconds since Epoch.voidvoidvoidvoidvoidvoidvoidvoidvoid
-
Method Details
-
getConcurrency
public int getConcurrency() -
getConnection
Allocates a connection to the server. These connections must later be released with thereleaseConnectionmethod. 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 thereleaseConnectionmethod. 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 defaultAoservConnectoras defined in theclient.propertiesresource. Each possible protocol is tried, in order, until a successful connection is made. If no connection is made, anIOExceptionis 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:
IOExceptionSQLException
-
dumpMysqlDatabase
public void dumpMysqlDatabase(int pkey, boolean gzip, AoservDaemonConnector.DumpSizeCallback onDumpSize, StreamableOutput masterOut) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
dumpPostgresDatabase
public void dumpPostgresDatabase(int pkey, boolean gzip, AoservDaemonConnector.DumpSizeCallback onDumpSize, StreamableOutput masterOut) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getAutoresponderContent
- Throws:
IOExceptionSQLException
-
getCronTable
Gets a cron table.- Parameters:
username- the username to copy the home directory of- Returns:
- the cron table
- Throws:
IOExceptionSQLException
-
getNetDeviceBondingReport
Gets a bonding report.- Parameters:
pkey- the unique ID of the net_device- Returns:
- the report
- Throws:
IOExceptionSQLException
-
getNetDeviceStatisticsReport
Gets a statistics report.- Parameters:
pkey- the unique ID of the net_device- Returns:
- the report
- Throws:
IOExceptionSQLException
-
isProcmailManual
Determines if the inbox is in manual procmail mode.- Parameters:
lsa- the pkey of the LinuxServerAccount- Throws:
IOExceptionSQLException
-
getDiskDeviceTotalSize
Gets the total size of a mounted filesystem in bytes.- Throws:
IOExceptionSQLException
-
getDiskDeviceUsedSize
Gets the used size of a mounted filesystem in bytes.- Throws:
IOExceptionSQLException
-
getEmailListFile
Gets the file used by an email list.- Throws:
IOExceptionSQLException
-
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:
IOExceptionSQLException
-
getImapFolderSizes
public long[] getImapFolderSizes(User.Name username, String[] folderNames) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getInboxAttributes
- Throws:
IOExceptionSQLException
-
getMrtgFile
- Throws:
IOExceptionSQLException
-
getMysqlMasterStatus
- Throws:
IOExceptionSQLException
-
getMysqlSlaveStatus
public MysqlReplication.SlaveStatus getMysqlSlaveStatus(PosixPath failoverRoot, int nestedOperatingSystemVersion, Server.Name serverName, Port port) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getMysqlTableStatus
public List<Database.TableStatus> getMysqlTableStatus(PosixPath failoverRoot, int nestedOperatingSystemVersion, Server.Name serverName, Port port, Database.Name databaseName) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
checkMysqlTables
public List<Database.CheckTableResult> checkMysqlTables(PosixPath failoverRoot, int nestedOperatingSystemVersion, Server.Name serverName, Port port, Database.Name databaseName, List<TableName> tableNames) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getAwstatsFile
public void getAwstatsFile(String siteName, String path, String queryString, StreamableOutput out) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
compareLinuxAccountPassword
public boolean compareLinuxAccountPassword(User.Name username, String password) throws IOException, SQLException Compares to the password list on the server.- Throws:
IOExceptionSQLException
-
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:
IOExceptionSQLException
-
getPostgresUserPassword
Gets the password for a PostgreSQL user as found in pg_shadow or pg_authid table.- Throws:
IOExceptionSQLException
-
grantDaemonAccess
public void grantDaemonAccess(long key, int command, String param1, String param2, String param3, String param4) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
removeEmailList
Deletes the contents of an email list.- Throws:
IOExceptionSQLException
-
restartApache
- Throws:
IOExceptionSQLException
-
restartCron
- Throws:
IOExceptionSQLException
-
restartMysql
- Throws:
IOExceptionSQLException
-
restartPostgres
- Throws:
IOExceptionSQLException
-
restartXfs
- Throws:
IOExceptionSQLException
-
restartXvfb
- Throws:
IOExceptionSQLException
-
setAutoresponderContent
public void setAutoresponderContent(PosixPath path, String content, int uid, int gid) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
setCronTable
Sets a cron table.- Parameters:
username- the username to copy the home directory ofcronTable- the new cron table- Throws:
IOExceptionSQLException
-
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:
IOExceptionSQLException
-
setEncryptedLinuxAccountPassword
public void setEncryptedLinuxAccountPassword(User.Name username, String encryptedPassword, Integer changedDate) throws IOException, SQLException Sets the encrypted password for a Linux account.- Throws:
IOExceptionSQLException
-
setLinuxServerAccountPassword
public void setLinuxServerAccountPassword(User.Name username, String plainPassword) throws IOException, SQLException Sets the password for aLinuxServerAccount.- Throws:
IOExceptionSQLException
-
setMysqlUserPassword
public void setMysqlUserPassword(int mysqlServer, User.Name username, String password) throws IOException, SQLException Sets the password for aMysqlServerUser.- Throws:
IOExceptionSQLException
-
setPostgresUserPassword
Sets the password for aPostgresServerUser.- Throws:
IOExceptionSQLException
-
startApache
- Throws:
IOExceptionSQLException
-
startCron
- Throws:
IOExceptionSQLException
-
startDistro
Starts a distribution verification.- Throws:
IOExceptionSQLException
-
startJvm
Starts a Java VM.- Throws:
IOExceptionSQLException
-
startMysql
- Throws:
IOExceptionSQLException
-
startPostgresql
- Throws:
IOExceptionSQLException
-
startXfs
- Throws:
IOExceptionSQLException
-
startXvfb
- Throws:
IOExceptionSQLException
-
stopApache
- Throws:
IOExceptionSQLException
-
stopCron
- Throws:
IOExceptionSQLException
-
stopJvm
Stops a Java VM.- Throws:
IOExceptionSQLException
-
stopMysql
- Throws:
IOExceptionSQLException
-
stopPostgresql
- Throws:
IOExceptionSQLException
-
stopXfs
- Throws:
IOExceptionSQLException
-
stopXvfb
- Throws:
IOExceptionSQLException
-
waitForHttpdSiteRebuild
- Throws:
IOExceptionSQLException
-
waitForLinuxAccountRebuild
- Throws:
IOExceptionSQLException
-
waitForMysqlDatabaseRebuild
- Throws:
IOExceptionSQLException
-
waitForMysqlDbUserRebuild
- Throws:
IOExceptionSQLException
-
waitForMysqlServerRebuild
- Throws:
IOExceptionSQLException
-
waitForMysqlUserRebuild
- Throws:
IOExceptionSQLException
-
waitForPostgresDatabaseRebuild
- Throws:
IOExceptionSQLException
-
waitForPostgresServerRebuild
- Throws:
IOExceptionSQLException
-
waitForPostgresUserRebuild
- Throws:
IOExceptionSQLException
-
get3wareRaidReport
Gets a 3ware RAID report.- Returns:
- the report
- Throws:
IOExceptionSQLException
-
getUpsStatus
Gets the UPS status.- Returns:
- the report
- Throws:
IOExceptionSQLException
-
getMdStatReport
Gets a /proc/mdstat report.- Returns:
- the report
- Throws:
IOExceptionSQLException
-
getMdMismatchReport
Gets a MD mismatch report.- Returns:
- the report
- Throws:
IOExceptionSQLException
-
getDrbdReport
Gets a DRBD report.- Returns:
- the report
- Throws:
IOExceptionSQLException
-
getFailoverFileReplicationActivity
public Tuple2<Long,String> getFailoverFileReplicationActivity(int replication) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getLvmReport
Gets a LVM report.- Returns:
- the report
- Throws:
IOExceptionSQLException
-
getHddTempReport
Gets a hard drive temperature report.- Returns:
- the report
- Throws:
IOExceptionSQLException
-
getHddModelReport
Gets a hard drive model report.- Returns:
- the report
- Throws:
IOExceptionSQLException
-
getFilesystemsCsvReport
Gets a filesystems CSV report.- Returns:
- the report
- Throws:
IOExceptionSQLException
-
getLoadAvgReport
Gets a load average report.- Returns:
- the report
- Throws:
IOExceptionSQLException
-
getMemInfoReport
Gets a meminfo report.- Returns:
- the report
- Throws:
IOExceptionSQLException
-
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:
IOExceptionSQLException
-
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:
IOExceptionSQLException
-
checkSslCertificate
public List<Certificate.Check> checkSslCertificate(int sslCertificate, boolean allowCached) throws IOException, SQLException - Throws:
IOExceptionSQLException
-
getSystemTimeMillis
Gets the current system time.- Returns:
- the report
- Throws:
IOExceptionSQLException
-
getXenAutoStartLinks
Gets the list of servers configured to auto-start in /etc/xen/auto.- Throws:
IOExceptionSQLException
-
createVirtualServer
- Throws:
IOExceptionSQLException
-
rebootVirtualServer
- Throws:
IOExceptionSQLException
-
shutdownVirtualServer
- Throws:
IOExceptionSQLException
-
destroyVirtualServer
- Throws:
IOExceptionSQLException
-
pauseVirtualServer
- Throws:
IOExceptionSQLException
-
unpauseVirtualServer
- Throws:
IOExceptionSQLException
-
getVirtualServerStatus
- Throws:
IOExceptionSQLException
-
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:
IOExceptionSQLException
-
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:
IOExceptionSQLException
-
getHttpdServerConcurrency
Gets the current concurrency for a HTTP server.- Returns:
- the concurrency
- Throws:
IOExceptionSQLException
-
