Loading...
Searching...
No Matches
ServerMonitor.idl
/* SPDX-License-Identifier: BSD-3-Clause */
/*
* Copyright 2010 Raritan Inc. All rights reserved.
*/
#include <Event.idl>
#include <UserEvent.idl>
/** Server Monitor */
module servermon {
/** Server Monitor Interface */
interface ServerMonitor {
/**
* Server Reachability State
*/
enumeration ServerReachability {
WAITING, ///< Waiting for reliable connection
REACHABLE, ///< Server is up and running
UNREACHABLE, ///< No response from server
ERROR ///< Error pinging server (e.g. DNS lookup failure)
};
/**
* Server Power Control State
*/
enumeration ServerPowerState {
UNKNOWN, ///< Power state currently not known
ON, ///< Server power target is on
OFF, ///< Server power target is off
SHUTTING_DOWN ///< Server is being manually shut down
};
/**
* Server Power Control Result
*/
enumeration ServerPowerControlResult {
NO_ERROR, ///< No error, operation may still be in progress
SHUTDOWN_CMD_FAILED, ///< Error issuing the shutdown command to the server
SWITCHING_OFF_FAILED, ///< Switching the outlet or outlet group off failed
SWITCHING_ON_FAILED, ///< Switching the outlet or outlet group on failed
POWER_CHECK_TIMEOUT ///< Checking if power is off timed out
};
/**
* Methods of checking power state
*/
enumeration ServerPowerCheckMethod {
TIMER, ///< Server is assumed to be off after a time interval
POWER_DROP ///< Server is off if power consumption dropped
};
/**
* Settings for controlling and checking power state of the server
*/
structure ServerPowerSettings {
boolean enabled; ///< Power control for this server enabled
Object target; ///< Target for power control, Outlet or OutletGroup
ServerPowerCheckMethod powerCheck; ///< Method to check server's power state
double powerThreshold; ///< Active power below this threshold means server is off (in Watt)
int timeout; ///< Seconds the power check takes before it ends / times out
string shutdownCmd; ///< Shutdown command to send to the server
string username; ///< Login used to issue shutdown command to the server
string password; ///< Password for the login, write-only, not set if empty
int sshPort; ///< SSH port of the server
};
/**
* Server Reachability Settings
*/
[sparse_in]
structure ServerSettings {
string host; ///< Server hostname/IP address
boolean enabled; ///< Pinging enabled
int pingInterval; ///< Wait time after successful ping
int retryInterval; ///< Wait time after unsuccessful ping
int activationCount; ///< Minimum number of successful pings to enable feature
int failureCount; ///< Number of unsuccessful pings to consider server down
int resumeDelay; ///< Wait time before resuming pinging
int resumeCount; ///< Number of resumes before going back to WAITING state
ServerPowerSettings powerSettings; ///< Settings for controlling the power state of the server
};
/**
* Server Reachability Status
*/
structure ServerStatus {
ServerPowerState powerState; ///< Power control state
ServerPowerControlResult lastPowerControlResult; ///< Last result of a power control operation
ServerReachability reachable; ///< Reachability state
time lastRequest; ///< UNIX timestamp (UTC) of last request sent
time lastResponse; ///< UNIX timestamp (UTC) of last response received
int requests; ///< Number of requests sent
int responses; ///< Number of responses received
int failures; ///< Number of consecutive failed pings
int resumes; ///< Number of resumes
};
/**
* Event: ServerPowerState has changed
*/
valueobject ServerPowerStateEvent extends idl.Event {
int id; ///< id of the server entry
string host; ///< Server hostname/IP address
ServerPowerState oldPowerState; ///< Old power state
ServerPowerState newPowerState; ///< New power state
};
/**
* Event: A power control operation was initiated
*/
valueobject ServerPowerControlInitiatedEvent extends event.UserEvent {
int id; ///< id of the server
string host; ///< Server hostname/IP address
boolean on; ///< True if server shall be switched on, false otherwise
};
/**
* Event: A power control operation was completed
*/
valueobject ServerPowerControlCompletedEvent extends idl.Event {
int id; ///< id of the server
string host; ///< Server hostname/IP address
ServerPowerControlResult result; ///< Result of the power control operation
};
/**
* Event: Reachability status for a monitored server has changed or
* server continues to be unreachable
*/
valueobject ServerReachabilityEvent extends idl.Event {
int id; ///< id of the server entry
string host; ///< Server hostname/IP address
ServerReachability reachable; ///< Current Reachability state
};
/**
* A new server entry was added
*/
valueobject ServerAddedEvent extends event.UserEvent {
int id; ///< id of the added server entry
ServerSettings settings; ///< Settings of the added server
};
/**
* A server entry was changed
*/
valueobject ServerSettingsChangedEvent extends event.UserEvent {
int id; ///< id of the server entry
ServerSettings oldSettings; ///< Settings before change
ServerSettings newSettings; ///< Settings after change
};
/**
* A server entry was deleted
*/
valueobject ServerDeletedEvent extends event.UserEvent {
int id; ///< id of the deleted server entry
};
/**
* Server Entry
*/
structure Server {
ServerSettings settings; ///< Server settings
ServerStatus status; ///< Server status
};
constant int ERR_NO_SUCH_ID = 1; ///< No such ID
constant int ERR_INVALID_SETTINGS = 2; ///< Invalid settings
constant int ERR_DUPLICATE_HOSTNAME = 3; ///< Duplicate hostname
constant int ERR_MAX_SERVERS_REACHED = 4; ///< Maximum number of server entries
/**
* Add a new server entry.
*
* @param id New entry id, automatically assigned
* @param settings New server settings
*
* @return 0 if OK
* @return 2 if the settings are invalid
* @return 3 if an entry for the given hostname exists
* @return 4 if the maximum number of servers is reached
*
* @note The ServerSettings structure can be "sparse"; fields missing in
* the JSON representation will be set to default values.
*/
int addServer(out int id, in ServerSettings settings);
/**
* Modify an existing server entry.
*
* @param id Entry id
* @param settings New settings
*
* @return 0 if OK
* @return 1 if the entry does not exist
* @return 2 if the settings are invalid
* @return 3 if an entry for the given hostname exists
*
* @note The ServerSettings structure can be "sparse"; fields missing in
* the JSON representation will remain unchanged.
*/
int modifyServer(in int id, in ServerSettings settings);
/**
* Delete a server entry.
*
* @param id Entry id
*
* @return 0 if OK
* @return 1 if the entry does not exist
*/
int deleteServer(in int id);
/**
* Retrieve a server entry (settings and status).
*
* @param server Server settings and status
* @param id Entry id
*
* @return 0 if OK
* @return 1 if the entry does not exist
*/
int getServer(out Server server, in int id);
/**
* Retrieve a list of server entries (settings and status).
*
* @return Server list
*/
map<int, Server> listServers();
/**
* Control the power state of the outlets the server uses.
* Attempting to switch the power off will issue a graceful shutdown of
* the server beforehand.
*
* @param id Entry id
* @param on Switch power on if true, off if false
*
* @return 0 if OK
* @return 1 if the entry does not exist
* @return 2 if the settings are invalid
*/
int powerControl(in int id, in boolean on);
};
}
servermon::ServerMonitor
Server Monitor Interface.
Definition ServerMonitor.idl:13
servermon::ServerMonitor::ServerPowerState
ServerPowerState
Server Power Control State.
Definition ServerMonitor.idl:28
servermon::ServerMonitor::OFF
@ OFF
Server power target is off.
Definition ServerMonitor.idl:31
servermon::ServerMonitor::SHUTTING_DOWN
@ SHUTTING_DOWN
Server is being manually shut down.
Definition ServerMonitor.idl:32
servermon::ServerMonitor::UNKNOWN
@ UNKNOWN
Power state currently not known.
Definition ServerMonitor.idl:29
servermon::ServerMonitor::ON
@ ON
Server power target is on.
Definition ServerMonitor.idl:30
servermon::ServerMonitor::ServerReachability
ServerReachability
Server Reachability State.
Definition ServerMonitor.idl:18
servermon::ServerMonitor::REACHABLE
@ REACHABLE
Server is up and running.
Definition ServerMonitor.idl:20
servermon::ServerMonitor::WAITING
@ WAITING
Waiting for reliable connection.
Definition ServerMonitor.idl:19
servermon::ServerMonitor::ERROR
@ ERROR
Error pinging server (e.g. DNS lookup failure)
Definition ServerMonitor.idl:22
servermon::ServerMonitor::UNREACHABLE
@ UNREACHABLE
No response from server.
Definition ServerMonitor.idl:21
servermon::ServerMonitor::deleteServer
int deleteServer(in int id)
Delete a server entry.
servermon::ServerMonitor::modifyServer
int modifyServer(in int id, in ServerSettings settings)
Modify an existing server entry.
servermon::ServerMonitor::ERR_MAX_SERVERS_REACHED
constant int ERR_MAX_SERVERS_REACHED
Maximum number of server entries.
Definition ServerMonitor.idl:173
servermon::ServerMonitor::ERR_DUPLICATE_HOSTNAME
constant int ERR_DUPLICATE_HOSTNAME
Duplicate hostname.
Definition ServerMonitor.idl:172
servermon::ServerMonitor::ServerPowerControlResult
ServerPowerControlResult
Server Power Control Result.
Definition ServerMonitor.idl:38
servermon::ServerMonitor::SWITCHING_ON_FAILED
@ SWITCHING_ON_FAILED
Switching the outlet or outlet group on failed.
Definition ServerMonitor.idl:42
servermon::ServerMonitor::SWITCHING_OFF_FAILED
@ SWITCHING_OFF_FAILED
Switching the outlet or outlet group off failed.
Definition ServerMonitor.idl:41
servermon::ServerMonitor::SHUTDOWN_CMD_FAILED
@ SHUTDOWN_CMD_FAILED
Error issuing the shutdown command to the server.
Definition ServerMonitor.idl:40
servermon::ServerMonitor::POWER_CHECK_TIMEOUT
@ POWER_CHECK_TIMEOUT
Checking if power is off timed out.
Definition ServerMonitor.idl:43
servermon::ServerMonitor::NO_ERROR
@ NO_ERROR
No error, operation may still be in progress.
Definition ServerMonitor.idl:39
servermon::ServerMonitor::ERR_NO_SUCH_ID
constant int ERR_NO_SUCH_ID
No such ID.
Definition ServerMonitor.idl:170
servermon::ServerMonitor::ServerPowerCheckMethod
ServerPowerCheckMethod
Methods of checking power state.
Definition ServerMonitor.idl:49
servermon::ServerMonitor::POWER_DROP
@ POWER_DROP
Server is off if power consumption dropped.
Definition ServerMonitor.idl:51
servermon::ServerMonitor::TIMER
@ TIMER
Server is assumed to be off after a time interval.
Definition ServerMonitor.idl:50
servermon::ServerMonitor::powerControl
int powerControl(in int id, in boolean on)
Control the power state of the outlets the server uses.
servermon::ServerMonitor::getServer
int getServer(out Server server, in int id)
Retrieve a server entry (settings and status).
servermon::ServerMonitor::listServers
map< int, Server > listServers()
Retrieve a list of server entries (settings and status).
servermon::ServerMonitor::addServer
int addServer(out int id, in ServerSettings settings)
Add a new server entry.
servermon::ServerMonitor::ERR_INVALID_SETTINGS
constant int ERR_INVALID_SETTINGS
Invalid settings.
Definition ServerMonitor.idl:171
idl
Basic IDL definitions.
Definition Event.idl:10
servermon
Server Monitor.
Definition ServerMonitor.idl:10
idl::Event
Common base for all events.
Definition Event.idl:13
servermon::ServerMonitor::ServerAddedEvent
A new server entry was added.
Definition ServerMonitor.idl:141
servermon::ServerMonitor::ServerAddedEvent::settings
ServerSettings settings
Settings of the added server.
Definition ServerMonitor.idl:143
servermon::ServerMonitor::ServerAddedEvent::id
int id
id of the added server entry
Definition ServerMonitor.idl:142
servermon::ServerMonitor::ServerDeletedEvent
A server entry was deleted.
Definition ServerMonitor.idl:158
servermon::ServerMonitor::ServerDeletedEvent::id
int id
id of the deleted server entry
Definition ServerMonitor.idl:159
servermon::ServerMonitor::ServerPowerControlCompletedEvent
Event: A power control operation was completed.
Definition ServerMonitor.idl:122
servermon::ServerMonitor::ServerPowerControlCompletedEvent::result
ServerPowerControlResult result
Result of the power control operation.
Definition ServerMonitor.idl:125
servermon::ServerMonitor::ServerPowerControlCompletedEvent::id
int id
id of the server
Definition ServerMonitor.idl:123
servermon::ServerMonitor::ServerPowerControlCompletedEvent::host
string host
Server hostname/IP address.
Definition ServerMonitor.idl:124
servermon::ServerMonitor::ServerPowerControlInitiatedEvent
Event: A power control operation was initiated.
Definition ServerMonitor.idl:113
servermon::ServerMonitor::ServerPowerControlInitiatedEvent::id
int id
id of the server
Definition ServerMonitor.idl:114
servermon::ServerMonitor::ServerPowerControlInitiatedEvent::on
boolean on
True if server shall be switched on, false otherwise.
Definition ServerMonitor.idl:116
servermon::ServerMonitor::ServerPowerControlInitiatedEvent::host
string host
Server hostname/IP address.
Definition ServerMonitor.idl:115
servermon::ServerMonitor::ServerPowerSettings
Settings for controlling and checking power state of the server.
Definition ServerMonitor.idl:57
servermon::ServerMonitor::ServerPowerSettings::powerCheck
ServerPowerCheckMethod powerCheck
Method to check server's power state.
Definition ServerMonitor.idl:60
servermon::ServerMonitor::ServerPowerSettings::username
string username
Login used to issue shutdown command to the server.
Definition ServerMonitor.idl:64
servermon::ServerMonitor::ServerPowerSettings::sshPort
int sshPort
SSH port of the server.
Definition ServerMonitor.idl:66
servermon::ServerMonitor::ServerPowerSettings::powerThreshold
double powerThreshold
Active power below this threshold means server is off (in Watt)
Definition ServerMonitor.idl:61
servermon::ServerMonitor::ServerPowerSettings::password
string password
Password for the login, write-only, not set if empty.
Definition ServerMonitor.idl:65
servermon::ServerMonitor::ServerPowerSettings::target
Object target
Target for power control, Outlet or OutletGroup.
Definition ServerMonitor.idl:59
servermon::ServerMonitor::ServerPowerSettings::timeout
int timeout
Seconds the power check takes before it ends / times out.
Definition ServerMonitor.idl:62
servermon::ServerMonitor::ServerPowerSettings::enabled
boolean enabled
Power control for this server enabled.
Definition ServerMonitor.idl:58
servermon::ServerMonitor::ServerPowerSettings::shutdownCmd
string shutdownCmd
Shutdown command to send to the server.
Definition ServerMonitor.idl:63
servermon::ServerMonitor::ServerPowerStateEvent
Event: ServerPowerState has changed.
Definition ServerMonitor.idl:103
servermon::ServerMonitor::ServerPowerStateEvent::id
int id
id of the server entry
Definition ServerMonitor.idl:104
servermon::ServerMonitor::ServerPowerStateEvent::oldPowerState
ServerPowerState oldPowerState
Old power state.
Definition ServerMonitor.idl:106
servermon::ServerMonitor::ServerPowerStateEvent::host
string host
Server hostname/IP address.
Definition ServerMonitor.idl:105
servermon::ServerMonitor::ServerPowerStateEvent::newPowerState
ServerPowerState newPowerState
New power state.
Definition ServerMonitor.idl:107
servermon::ServerMonitor::ServerReachabilityEvent
Event: Reachability status for a monitored server has changed or server continues to be unreachable.
Definition ServerMonitor.idl:132
servermon::ServerMonitor::ServerReachabilityEvent::reachable
ServerReachability reachable
Current Reachability state.
Definition ServerMonitor.idl:135
servermon::ServerMonitor::ServerReachabilityEvent::host
string host
Server hostname/IP address.
Definition ServerMonitor.idl:134
servermon::ServerMonitor::ServerReachabilityEvent::id
int id
id of the server entry
Definition ServerMonitor.idl:133
servermon::ServerMonitor::ServerSettingsChangedEvent
A server entry was changed.
Definition ServerMonitor.idl:149
servermon::ServerMonitor::ServerSettingsChangedEvent::newSettings
ServerSettings newSettings
Settings after change.
Definition ServerMonitor.idl:152
servermon::ServerMonitor::ServerSettingsChangedEvent::oldSettings
ServerSettings oldSettings
Settings before change.
Definition ServerMonitor.idl:151
servermon::ServerMonitor::ServerSettingsChangedEvent::id
int id
id of the server entry
Definition ServerMonitor.idl:150
servermon::ServerMonitor::ServerSettings
Server Reachability Settings.
Definition ServerMonitor.idl:73
servermon::ServerMonitor::ServerSettings::enabled
boolean enabled
Pinging enabled.
Definition ServerMonitor.idl:75
servermon::ServerMonitor::ServerSettings::pingInterval
int pingInterval
Wait time after successful ping.
Definition ServerMonitor.idl:76
servermon::ServerMonitor::ServerSettings::activationCount
int activationCount
Minimum number of successful pings to enable feature.
Definition ServerMonitor.idl:78
servermon::ServerMonitor::ServerSettings::powerSettings
ServerPowerSettings powerSettings
Settings for controlling the power state of the server.
Definition ServerMonitor.idl:82
servermon::ServerMonitor::ServerSettings::retryInterval
int retryInterval
Wait time after unsuccessful ping.
Definition ServerMonitor.idl:77
servermon::ServerMonitor::ServerSettings::resumeDelay
int resumeDelay
Wait time before resuming pinging.
Definition ServerMonitor.idl:80
servermon::ServerMonitor::ServerSettings::resumeCount
int resumeCount
Number of resumes before going back to WAITING state.
Definition ServerMonitor.idl:81
servermon::ServerMonitor::ServerSettings::failureCount
int failureCount
Number of unsuccessful pings to consider server down.
Definition ServerMonitor.idl:79
servermon::ServerMonitor::ServerSettings::host
string host
Server hostname/IP address.
Definition ServerMonitor.idl:74
servermon::ServerMonitor::ServerStatus
Server Reachability Status.
Definition ServerMonitor.idl:88
servermon::ServerMonitor::ServerStatus::lastResponse
time lastResponse
UNIX timestamp (UTC) of last response received.
Definition ServerMonitor.idl:93
servermon::ServerMonitor::ServerStatus::failures
int failures
Number of consecutive failed pings.
Definition ServerMonitor.idl:96
servermon::ServerMonitor::ServerStatus::powerState
ServerPowerState powerState
Power control state.
Definition ServerMonitor.idl:89
servermon::ServerMonitor::ServerStatus::resumes
int resumes
Number of resumes.
Definition ServerMonitor.idl:97
servermon::ServerMonitor::ServerStatus::reachable
ServerReachability reachable
Reachability state.
Definition ServerMonitor.idl:91
servermon::ServerMonitor::ServerStatus::responses
int responses
Number of responses received.
Definition ServerMonitor.idl:95
servermon::ServerMonitor::ServerStatus::lastPowerControlResult
ServerPowerControlResult lastPowerControlResult
Last result of a power control operation.
Definition ServerMonitor.idl:90
servermon::ServerMonitor::ServerStatus::requests
int requests
Number of requests sent.
Definition ServerMonitor.idl:94
servermon::ServerMonitor::ServerStatus::lastRequest
time lastRequest
UNIX timestamp (UTC) of last request sent.
Definition ServerMonitor.idl:92
servermon::ServerMonitor::Server
Server Entry.
Definition ServerMonitor.idl:165
servermon::ServerMonitor::Server::settings
ServerSettings settings
Server settings.
Definition ServerMonitor.idl:166
servermon::ServerMonitor::Server::status
ServerStatus status
Server status.
Definition ServerMonitor.idl:167