Package net.gridshield.nexsm.entityclasses

Examples of net.gridshield.nexsm.entityclasses.Host


        public void refreshInfo(Vertex v) {
            clearLabels();
            rmaxwitdh = 0;
            vselected = v;
            sip.showServices(v);
            Host h = _gm.getVertexHost(vselected);
            HostStatus hs = _gm.getVertexHostStatus(vselected);
            JLabel tmp = null;
            Font f = null;
            FontMetrics fm = null;
            tmp = labelsRight.get(labelsTexts[0]);
            f = tmp.getFont();
            fm = tmp.getFontMetrics(f);
            if (h != null) {
                tmp.setText(h.getName());
                tmp.setToolTipText(tmp.getText());
                tmp = labelsRight.get(labelsTexts[1]);
                tmp.setText(h.getDescription());
                tmp.setToolTipText(tmp.getText());
                tmp = labelsRight.get(labelsTexts[2]);
                tmp.setText(h.getAddress());
                tmp.setToolTipText(tmp.getText());
                tmp = labelsRight.get(labelsTexts[3]);
                tmp.setText(h.getParentsString());
            }
            if (hs != null) {
                tmp.setToolTipText(tmp.getText());
                tmp = labelsRight.get(labelsTexts[4]); // status info
                tmp.setText(hs.getPluginOutput());
                tmp.setToolTipText(tmp.getText());
                // ^^^^^ status info
               
                tmp = labelsRight.get(labelsTexts[5]); // current state
                String currState = hs.getCurrentState().toString();
                setFontColor(tmp, hs.getCurrentState(), hs.getProblemHasBeenAcknowledged());
                tmp.setText(currState + hasBeenAcknowledged(hs.getProblemHasBeenAcknowledged(), hs.getCurrentState()));
                tmp.setToolTipText(tmp.getText());
               
                // Last check
                tmp = labelsRight.get(labelsTexts[6]);
                long time = hs.getLastCheck();
                if (time != 0) {
                    tmp.setText(DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT).format(time));
                } else {
                    tmp.setText("N/A");
                }
                tmp.setToolTipText(tmp.getText());

                // time in actual state
                tmp = labelsRight.get(labelsTexts[7]);
                tmp.setText(timeInActualState(System.currentTimeMillis() -  hs.getLastStateChange()) + (hs.getLastStateChange() == 0?"+":""));
                tmp.setToolTipText(tmp.getText());

                tmp = labelsRight.get(labelsTexts[8])//previous hard state
                setFontColor(tmp, hs.getLastHardState());
                tmp.setText(hs.getLastHardState().toString());

                tmp = labelsRight.get(labelsTexts[9]);
                time = hs.getLastHardStateChange();
                if (time != 0) {
                    tmp.setText(DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT).format(hs.getLastHardStateChange()));   
                } else {
                    tmp.setText("N/A");
                }
                tmp.setToolTipText(tmp.getText());

                time = 0;
                time = hs.getLastTimeUp();
                tmp = labelsRight.get(labelsTexts[10]);
                if (time != 0) {
                    tmp.setText(DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT).format(hs.getLastTimeUp()));
                } else {
                    tmp.setText("N/A");
                }
                tmp.setToolTipText(tmp.getText());

                time = 0;
                time = hs.getLastTimeDown();
                tmp = labelsRight.get(labelsTexts[11]);
                if (time != 0) {
                    tmp.setText(DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT).format(hs.getLastTimeDown()));
                } else {
                    tmp.setText("N/A");
                }
                tmp.setToolTipText(tmp.getText());

                tmp = labelsRight.get(labelsTexts[12]);
                time = 0;
                time = hs.getLastTimeUnreachable();
                if (time != 0) {
                    tmp.setText(DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.SHORT).format(hs.getLastTimeUnreachable()));
                } else {
                    tmp.setText("N/A");
                }
                tmp.setToolTipText(tmp.getText());

                // check host to only show services links it has
                tmp = labelsInfo.get(16);
               
                if (_gm.getHostExtInfo(h.getName()) != null &&
                        _gm.getHostExtInfo(h.getName()).getNotesUrl().length() == 0) {
                    tmp.setEnabled(false);
                } else {
                    tmp.setEnabled(true);
                }
View Full Code Here


         * @param v The vertex to test for information to display
         * @return true if the vertex specified by v has some information to display,
         * false otherwise
         */
        public boolean hasSomethingToDisplay(Vertex v) {
            Host h = _gm.getVertexHost(v);
            HostStatus hs = _gm.getVertexHostStatus(v);
            boolean visible = _gm.isVisible(v, _vv.getName());
            return (visible && (h != null || hs != null));
        }
View Full Code Here

            jTableServices.setFont(new Font("Lucida Sans", Font.PLAIN, 10));
            add(jScrollPaneServices);
        }
       
        public void showServices(Vertex v) {
           Host h = _gm.getVertexHost(v);
           nsm.setHost(h);
           DefaultTableModel model = (DefaultTableModel)jTableServices.getModel();
           int rows = jTableServices.getRowCount();
           for (int i = 0; i < rows; i++)
               model.removeRow(0);
           Map <String,ServiceStatus> hostservices = _gm.getVertex_Services(h.getName());
           if (hostservices != null) {
               for (ServiceStatus ss: hostservices.values()) {
                   Vector vector = new Vector();
                   vector.add(ss.getServiceDescription());
                   vector.add(new StatusAndAck(ss.getCurrentState(), ss.getProblemHasBeenAcknowledged()));
View Full Code Here

     * @param v The vertex to test for information to display
     * @return true if the vertex specified by v has some information to display,
     * false otherwise
     */
    public boolean hasSomethingToDisplay(Vertex v, VisualizationViewer vv) {
        Host h =  getGraphManager().getVertexHost(v);
        HostStatus hs = getGraphManager().getVertexHostStatus(v);
        boolean visible = getGraphManager().isVisible(v, vv.getName());
        return (visible && (h != null || hs != null));
    }
View Full Code Here

            jTableServices.setFont(new Font("Lucida Sans", Font.PLAIN, 10));
            add(jScrollPaneServices);
        }
       
        public void showServices(Vertex v) {
           Host h = _gm.getVertexHost(v);
//           nsm.setHost(h);
           DefaultTableModel model = (DefaultTableModel)jTableServices.getModel();
           int rows = jTableServices.getRowCount();
           for (int i = 0; i < rows; i++)
               model.removeRow(0);
           Map <String,ServiceStatus> hostservices = _gm.getVertex_Services(h.getName());
           if (hostservices != null) {
               for (ServiceStatus ss: hostservices.values()) {
                   Vector vector = new Vector();
                   vector.add(ss.getServiceDescription());
                   vector.add(new StatusAndAck(ss.getCurrentState(), ss.getProblemHasBeenAcknowledged()));
View Full Code Here

            break;
            case OpenWindow:
                String klass = "";
                String hostname = "";
                String service = "";
                Host h = null;
                HostStatus hs = null;
                ServiceStatus ss = null;
                if (args.length >= 1) {
                    klass = (String)args[0];
                }
View Full Code Here

     * @throws java.lang.Exception If a problem is encountered
     */
    public void text(String str) throws Exception {
        if (hostDefinition) {
            if (host_name) {
                htmp = new Host(str);
            }
            if (alias) {
                htmp.setDescription(str);
            }
            if (ip) {
View Full Code Here

TOP

Related Classes of net.gridshield.nexsm.entityclasses.Host

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.