I would like to monitor a DPE ( like a dpConnect) for when the system is shutting down so that I can inform a web service.
We can write all sorts of code to monitor the event timer, but that means that the project is running check code every second. There must be an internal datapoint which signals a shutdown is started.
Todd Malone
What DPE to monitor to know a regular shutdown is triggered?
- tmalone
- Posts:192
- Joined: Mon Nov 22, 2010 11:21 pm
What DPE to monitor to know a regular shutdown is triggered?
- mkoller
- Posts:741
- Joined: Fri Sep 17, 2010 9:03 am
Re: What DPE to monitor to know a regular shutdown is triggered?
Shutting down the project is initiated by Pmon.
What you can do is using the SNMP Trap information from pmon.
oid_projectStopNotification "1.3.6.1.4.1.13828.2.1.9.5"
And you need the config entry sendManagerStateChange = "Yes" in the pmon section
What you can do is using the SNMP Trap information from pmon.
oid_projectStopNotification "1.3.6.1.4.1.13828.2.1.9.5"
And you need the config entry sendManagerStateChange = "Yes" in the pmon section
- tmalone
- Posts:192
- Joined: Mon Nov 22, 2010 11:21 pm
Re: What DPE to monitor to know a regular shutdown is triggered?
wow, that is very cool. You could use that from other packages like many IT systems have.
While this is probably the most elegant way, our customers don't always order the SNMP driver to be able to setup a trap for that.
There is not an internal datapoint that gets set to "" or something special as the system shuts down? Is there a time DPE that gets written to for the "uptime" calculation?
While this is probably the most elegant way, our customers don't always order the SNMP driver to be able to setup a trap for that.
There is not an internal datapoint that gets set to "" or something special as the system shuts down? Is there a time DPE that gets written to for the "uptime" calculation?
- agruber
- Posts:147
- Joined: Tue Sep 07, 2010 2:52 pm
Re: What DPE to monitor to know a regular shutdown is triggered?
If you want to use something else than SNMP you can also use crashaction scripts.
There is also a small example in the documentation. From there you can do whatever you are able to via a simple command from the OS. Like sending a mail or send something to a webservice.If a stopped/blocked manager is detected a possibly existing script in the directory /bin with the name crashAction and the extension .sh (for Linux) or .cmd (for Windows) is started.
- RudiKreiner
- Posts:198
- Joined: Mon May 16, 2011 2:10 pm
Re: What DPE to monitor to know a regular shutdown is triggered?
If you connect to _Connections.Driver.ManNums or _Connections.Ctrl.ManNums or the associated datapoint from some other manager class, you can see that managers are disappearing from the list, then you know that something is shutting down, but probably can't see exactly why.
And you have to understand and be able to depend on the order in which things get shut down, otherwise your manager that wants to react to a shutdown may be dead before you get any events from the datapoints above.
And you have to understand and be able to depend on the order in which things get shut down, otherwise your manager that wants to react to a shutdown may be dead before you get any events from the datapoints above.
- tmalone
- Posts:192
- Joined: Mon Nov 22, 2010 11:21 pm
Re: What DPE to monitor to know a regular shutdown is triggered?
This seems like a good place to start. I am not looking for any "catch all cases", just the case where the someone has stopped a project with Project Admin or PMON to inform a remote Web Service that we are not going to be a valid service end point.
Thanks for all of the input.
Thanks for all of the input.
- marcel@realsolutions.nu
- Posts:12
- Joined: Mon Aug 02, 2010 10:22 am
Re: What DPE to monitor to know a regular shutdown is triggered?
At a project I had more or less the same question....
I solved it this way (using the fact that a UI can run in silentMode AND that the UI calls the 'close' script of a panel at closing):
First created a simple panel called 'ProjectMonitorPanel', in the init script a set a DPE 'ProjectRunning' to true....
At the 'close' event of the panel I put a script that sets this DPE to false, and send a mail that the project is no longer running... (and the end of the script call the function 'PanelOff()' to exit the UI)
Then add a UI to the console that runs this panel in silentMode....
when I now stop the project this UI is of course stopped, but first the close-script is called, my DPE is set to false and a mail is sent...
BR, Marcel
I solved it this way (using the fact that a UI can run in silentMode AND that the UI calls the 'close' script of a panel at closing):
First created a simple panel called 'ProjectMonitorPanel', in the init script a set a DPE 'ProjectRunning' to true....
At the 'close' event of the panel I put a script that sets this DPE to false, and send a mail that the project is no longer running... (and the end of the script call the function 'PanelOff()' to exit the UI)
Then add a UI to the console that runs this panel in silentMode....
when I now stop the project this UI is of course stopped, but first the close-script is called, my DPE is set to false and a mail is sent...
BR, Marcel