From: Phelan-1, B. <Bri...@ks...> - 2003-05-06 20:30:12
|
Jesse, See this message posted previously by Tarus. Brian -----Original Message----- From: Jesse Mather [mailto:JM...@co...] Sent: Tuesday, May 06, 2003 2:00 PM To: di...@li... Subject: [opennms-discuss] Manually restarting Pollerd I have set up a couple of packages in poller-configuration.xml. I would like to be able to restart just the Pollerd service when I move an interface from one package to another. I have tried to use the opennms.sh stop <service id> command, but I'm not sure what "service id" refers to. -----Original Message----- From: Tarus Balog [mailto:ta...@so...] Sent: Wednesday, December 18, 2002 11:00 AM To: di...@op... Subject: [opennms-discuss] Starting and Stopping OpenNMS Processes Individually Gang: One of my clients (and like all of them, he is brilliant, friendly and attractive) has been experimenting with using JMX classes to start and stop OpenNMS processes. Note: The instructions included in this post are in no way supported or recommended. In fact, you should probably stop reading this right now and go and do something that won't break your OpenNMS system. For background, see: http://mx4j.sourceforge.net/docs/bk01ch03.html and focus on the HTTP Adaptor. Okay, I don't pretend to understand all of this yet, but the Manager class in OpenNMS, which is responsible for starting and stopping the OpenNMS processes, starts a "Managed Bean" server running on port 8181. The MBean server is then able to receive commands via HTTP on that port. As a demonstration, on your OpenNMS server bring up a browser and run: http://localhost:8181/server While nothing (probably) will be displayed in your browser, if you view the source you will see something like: <?xml version="1.0" encoding="UTF-8"?> <Server><MBean name="OpenNMS:Name=Collectd"></MBean><MBean name="OpenNMS:Name=Capsd"></MBean><MBean name="OpenNMS:Name=Actiond"></MBean><MBean name=":Name=HttpAdaptor"></MBean><MBean name=":Name=XSLTProcessor"></MBean><MBean name="OpenNMS:Name=Pollerd"></MBean><MBean name=":Name=HttpAdaptorMgmt"></MBean><MBean name="JMImplementation:type=MBeanServerDelegate"></MBean><MBean name="OpenNMS:Name=Trapd"></MBean><MBean name="OpenNMS:Name=Outaged"></MBean><MBean name="OpenNMS:Name=Notifd"></MBean><MBean name="OpenNMS:Name=Eventd"></MBean><MBean name="OpenNMS:Name=Threshd"></MBean><MBean name="OpenNMS:Name=Dhcpd"></MBean><MBean name="OpenNMS:Name=Rtcd"></MBean><MBean name="OpenNMS:Name=Discovery"></MBean><MBean name="OpenNMS:Name=FastExit"></MBean></Server> Each if the values in "name" represents a service that can be controlled by the MBean server. So, how do you use this to start and stop a service in OpenNMS? It is pretty simple: http://localhost:8181/invoke?objectname=OpenNMS%3AName=Collectd&operation=stop This URL will stop the service named "OpenNMS:Name=Collectd". View the source in order to see if the action was successful: <?xml version="1.0" encoding="UTF-8"?> <MBeanOperation><Operation objectname="OpenNMS:Name=Capsd" operation="invoke" result="success" return=""></Operation></MBeanOperation> Now, in order to restart Collectd, you have to do two steps: http://localhost:8181/invoke?objectname=OpenNMS%3AName=Collectd&operation=init and again check the source: <?xml version="1.0" encoding="UTF-8"?> <MBeanOperation><Operation objectname="OpenNMS:Name=Collectd" operation="invoke" result="success" return=""></Operation></MBeanOperation> And finally start the process: http://localhost:8181/invoke?objectname=OpenNMS%3AName=Collectd&operation=start and check the source: <?xml version="1.0" encoding="UTF-8"?> <MBeanOperation><Operation objectname="OpenNMS:Name=Collectd" operation="invoke" result="success" return=""></Operation></MBeanOperation> Okay, now that the gun is in your hand, have fun but don't shoot yourself. I would be careful about stopping something like Eventd, since I have no idea what will happen if Eventd was stopped and something like the Poller tried to send an event. We will continue to play with this, and I hope we can add an admin page to do this for things like capsd, collectd and the poller. It will probably require some more code (such as a "pause" method) to restart something like Eventd. Have fun. -T -- Tarus Balog Consultant Sortova Consulting Group, http://www.sortova.com +1-919-696-7625 ta...@so... _______________________________________________ discuss mailing list (di...@li...) To subscribe, unsubscribe, or change your list options, go to: http://lists.opennms.org/mailman/listinfo/discuss |