Know the state of the Management Server

Wednesday, 19 October 2016

Author: Bo Andersen

Product News

When developing an application or service that is capable of monitoring XProtect, the StatusViewer sample gives you the state of cameras and recording servers, but it does not give you the state of the Management Server service. This means the system might be working, streaming video and recording, but new users are unable to log in and use the system.

To remedy this, Milestone has a new class: VideoOS.Platform.SDK.Util.ServerMonitor

You can use the class in this way.

------------------------------------------------------------------------------------------------------

VideoOS.Platform.SDK.Environment.Initialize(); 
Uri u = new UriBuilder(textBoxUri.Text).Uri;
sm = new VideoOS.Platform.SDK.Util.ServerMonitor(u, textBoxUser.Text, textBoxPassword.Text, checkBoxWindowsUser.Checked);
sm.Init();
sm.ConnectionStateChangedEvent += sm_ConnectionStateChangedEvent;
.
void sm_ConnectionStateChangedEvent(object sender, VideoOS.Platform.SDK.Config.ConnectionStateChangedEventArgs e)

{
    MessageBox.Show(e.ConnectionState.ToString());
}
.

// Any time you can query -
MessageBox.Show(sm.IsConnected.ToString());

------------------------------------------------------------------------------------------------------

The ServerMonitor.IsConnected will tell you if the Management Server is running. IsConnected is ‘false’ if:

  • The server is powered off, lost network or is in other ways unreachable.
  • The Management Server’s IIS service is off.
  • The Management Server service is off.

Note: If used in an XProtect Corporate or XProtect Expert older than the 2016 version, you will get the state of the connection with the Management Server IIS. In XProtect Corporate 2016 or newer, or in XProtect Expert 2016 or newer, you will also get the state of the Management Server service.

If used in an XProtect Enterprise, XProtect Professional or XProtect Express, IsConnected is ‘false’ if the Image Server service cannot be reached. This means that you can use the ServerMonitor universally even though these systems are one server system where the login and the retrieval of data is on the same server.