Collecting information from Cisco switchs using SNMP

Dear All,
I have a wide network with more than 250 sites connected using the DSL. the WAN devices are under the provider responsability and the LAN devices are directly in my responsability. In each site, I have :
1 or 2 Cisco switchs (2960 or 3560), connecting via fibr.
or
Linksys switch connected via ethernet cable
and
cisco 877 router connected to switch
cisco 881G router conected to switch
pc and printers
In order to improve the availibilty of our network, we lauch every day a script from local pc to test connectivity of LAN equipements :
ping to switchs (Vlan 1), ping to ip fa0/0 cisco router1, ip cisco router2, ping to HSRP address (of two router). the resulting ini file will be inserted in a database and exported to excel for analysing.
I'm asking if someone can help in order to implement SNMP and let me know the name of cisco MIB to implement to :
- to have from SNMP information, the result of show cdp nei, show interface status, show ip int brief,...
- to have if wan router LAN interface are up,connected
-  others usefuls informations.
Thanks and regards,
AA

Hi,
the basic SNMP config for 2960 and 3560 is:
     snmp-server community <> RO
The configuration for SNMP traps to get alerts from the device if there is for example a failure with a fan is:
          snmp-server enable traps
          snmp-server host <> <>
This enables all traps available with your IOS version. You can the disable not wanted traps by using the "no"-command like this.
Example for dot1x traps:
          no snmp-server enable traps dot1x
With a snmp client you can then do a snmpwalk (or snmp get) without a specific OID to get all the SNMP information from the device:
On a Linux server the following command should work:
     snmpwalk -v 2c -c <> -T <>
-v = use SNMP version 2c
-c = use the community string you configured on the device
-T = output in the dotted decimal format
But be careful, this will be a lot of data output.
Here you will find a docu for configuring SNMP on a Cisco device:
http://www.cisco.com/en/US/docs/ios/12_2/configfun/configuration/guide/fcf014.html
Sven

Similar Messages

  • Set IP address of L3 switch using SNMP

    HI,
     I am using cisco catalust 3560-x series swtiches. And I am new to SNMP. I want to assign IP address to interfaces of this switch, using SNMP.  Kindly help me. Any help, any sugession, is most welcome.
    Thanks in advance
    Jeni A

    hi,
    Thanks for your response.
    Our requirement is as follows.
    I want to assign IP address to Switch fro my Java Application. I have implemented  a Telnet Client Code in Java, by which i can configure IP address in switch from my java application.
    But my boss said, Telnet is not secure and try using SNMP to do the same.
    When I was searching in Internet, I got this page https://supportforums.cisco.com/discussion/12090896/snmp-how-get-list-ip-addresses-and-corresponding-interface-names
    The above thread gives object ID to GET IP address of Switch interface. This Object is Read-only.
    In the similar way, is there any object, using which I can SET / assign IP address to switch interfaces.
    waiting for your response.
    Thanks in advance :)

  • Collect cdr from cisco gateway AS5300 into a database in realtime

    Hello !!
    somebody knows how can i collect cdr from cisco gateway AS5300 into a database in realtime?
    Regards

    You can use gw-accounting as explained below:
    gw-accounting
    To enable an accounting method for collecting call detail  records (CDRs), use the gw-accounting command in global  configuration mode. To disable an accounting method, use the no form of this command.
    gw-accounting {aaa | file | syslog [stats] }
    no gw-accounting {aaa | file | syslog [stats] }
    gw-accounting {h323 [vsa] | syslog | voip}
    no gw-accounting {h323 [vsa] | syslog | voip}
    Syntax Description
    aaa
    Enables accounting through the AAA system and sends call  detail records to the RADIUS server in the form of vendor-specific attributes  (VSAs).
    file
    Enables the file accounting method to store call detail  records in .csv format.
    syslog
    Enables the system logging facility to output accounting  information in the form of a system log message.
    stats
    (Optional) Enables voice quality statistics to be sent to the  system log.
    h323
    Enables standard H.323 accounting using Internet Engineering  Task Force (IETF) RADIUS attributes.
    vsa
    (Optional) Enables H.323 accounting using RADIUS VSAs.
    voip
    Enables generic gateway-specific accounting.
    You can find more info in cisco IOS voice command reference guide.
    This is an example to collect CDR of H.323 calls via RADIUS:
    gw-accounting syslog
    gw-accounting aaa
    attribute acct-session-id overloaded
    attribute h323-remote-id resolved
    acct-template callhistory-detail
    Regards.

  • NPS Discarding RADIUS request from Cisco switch (802.1x)

    Last few weeks I've been busy to get the following to work:
    - Cisco 2960 switch as the suppliant
    - Another Cisco 2960 as the authenticator switch
    - The supplicant is only able to send MS-EAP MS-ChapV2 requests
    - The NPS server is Windows 2008 R2 (and also tested on 2012 R2)
    This is called "NEAT" by Cisco; which does seem to work with Cisco ISE (http://www.cisco.com/c/en/us/support/docs/lan-switching/8021x/116681-config-neat-cise-00.html)
    but I'd like to get it to work with Windows NPS.
    Within NPS I've setup the following Connection Request policy:
    - NAS Port Type: Ethernet
    I'm using the following Network Policy:
    - User Group: DOMAIN\Switches (the useraccount used by the switch is part of this group)
    - NAS Port Type: Ethernet
    - Autehntcation Type: EAP
    Now the request sent by the switch is discarded. The actual error is the following (excluded irrelevant information):
    User:
    Account Name: Rotterdam-Switch-8-1
    Account Domain: DOMAIN
    Authentication Details:
    Connection Request Policy Name: Secure Wired Connections
    Network Policy Name: Switches Allowed
    Authentication Provider: Windows
    Authentication Server: SERVER.DOMAIN.local
    Authentication Type: EAP
    EAP Type: -
    Account Session Identifier: -
    Reason Code: 1
    Reason: An internal error occurred. Check the system event log for additional information.
    Wireshark on the NPS server shows:
    1. The RADIUS Access-Request (1) being received by the NPS Server
    2. The NPS Server sending out a RADIUS Access-Challenge (11) to the authenticator switch
    3. Another RADIUS Access-Request (1) is beging received by the NPS Server
    Packet 2 has an t=EAP-Message(79) with type MS-EAP-Authentication [Palekar](26) and MS-CHAPv2-ID set to 2 and OpCode 1 (Challange)
    Packet 3 has an t=EAP-Message(79) with type MS-EAP-Authentication [Palekar](26) and MS-CHAPv2-ID set to 2 and OpCode 2 (Response)
    I've also tried the following:
    - I've also tested with an invalid username/password. The request is correctly denied
    - I've also tested by added ALL EAP Types as condition to the Network Policy. The request isn't pickup by this policy anymore.
    Any help would be greatly appriciated ofcourse.
    Kind regards,
    Peter

    It only took like.. uhm.. forever.. but there's an answer which is "OK ish..".
    Cisco 2960 switches support EAP-MSCHAP; but it seems that NPS only supports EAP-MSCHAP for VPN Connections and not for Wired/Wirelss authentication. Something to do with inner and outer methods and NPS requireing PEAP as an outer method for Wired/Wirelss
    authentication.
    End result is that both the Cisco switches and NPS do support EAP-MD5. Though it's definitly not as secure (at all), it's definitly a step in the right direction and it's something that we'll be implementing.
    Now it seems that NPS doesn't support EAP-MD5 (which is supposidly depricated), it's possible to re-enable it. Using the following articles.
    http://support.microsoft.com/kb/922574/en-us
    Microsft mentioned me that "Though this article says it applies to Windows Vista only, it does apply to Server 2008R2 as well. Also I would suggest you the following link:
    http://support.microsoft.com/kb/981190"
    Please note that you'll have to enable 'Store password using reversible encryption’  on the accounts that will be used for NEAT authentication.
    All though I would have hoped EAP-MSCHAPv2 would work, I feel I do need to clarify that I understand Microsoft's point of view on this as well. They feel EAP methods without PEAP are simply not safe; which is understandable, espcially for EAP-MD5 which
    could be sniffer using a hub/repeater/etc.
    Kind regards,
    Peter

  • SAP Query - Additional field that collects information from table RESB

    Hello gurus. I have a question.
    I want to create a SAP Query that shows me the stock level of a list of materials, and also show me the total quantity of order reservations in an additional field.
    I created an InfoSet with table MARD, which is the one that holds the Stock information in a plant. Then I created an additional field which would read information from table RESB, the table that holds order reservations per material.
    So I wrote this piece of code:
    SELECT * FROM RESB
    WHERE MATNR EQ MARD-MATNR and
           WERKS EQ MARD-WERKS.
    ENDSELECT.
    if ( sy-dbcnt NE '0').
          MOVE RESB-BDMNG to ZQTY.
    ELSE.
          MOVE '' to ZQTY.
    ENDIF.
    This works fine. However, this is currently just catching the first record in table RESB that matches my condition.
    What I would like is to collect every instance of RESB-BDMNG and add them to field "ZQTY", have it loop in RESB until it finishes finding every record that match the MATNR and WERKS. With this I could get the total number of order reservations that this material has in that table.
    Could someone share some coding that would help me achieve this?

    Yes! That did it. That's what I needed to do. Thank you so much.
    While I'm at it, let me ask you a related question.
    When I execute the query, in the first records of the query where there's no value from RESB to transfer, the value of field ZQTY appears empty. Once it finds the first record in RESB and it populates ZQTY with a value, then the rest of the records with no hit get the proper value of 0.
    Do you know why the first records in the query appear empty and not with a 0? Is there anything I should add to the coding to fix this?

  • Query with collective information from MD04 in detail

    Hello gurus. I have a question about Infosets.
    Iu2019ve being asked to create a query that shows the information from transaction MD04, but for multiple materials. It should be a list that essentially lists every MD04 record for material in our plant, one after the other.
    I found a Function called MD_STOCK_REQUIREMENTS_LIST_API which contains this information. The problem is, this function exports the detailed data to a structure called MDEZ and the header data to a separate one called MDKP.
    I created an Infoset using u201CData Retrieval by programu201D and I typed MDEZ as the structure. I then coded the retrieval of data under the u201CData Reading Programu201D tab.
    The problem is, the MDEZ structure inside Function MD_STOCK_REQUIREMENTS_LIST_API doesnu2019t have the material number; this is exported to a separate one called E_MDKP.
    My question is; how can I also have the contents of MDKP added to this Infoset? When I create it, it only lets me use one single structure, I cannot also add MDKP.
    I tried creating an additional field just for the MATNR, but those extra fields cannot read what I coded under the u201CData Reading Programu201D tab. I tried to use a second internal table to drop the values of E_MDKP, and then loop it to fetch the MATNR, but I canu2019t add it to the additional field nor can I add it to a second structure.
    I made a query and it shows the MDEZ data correctly; I get one line per item found in MD04 for the materials I imported from our Plant, but I donu2019t know which material is which because that info is in the other structure MDKP.

    Thanks for your reply. if you don't mind me asking, how can I create my own structure to add it to the Infoset?
    When I create the infoset, I can either make from a Table Join, a Logical Database or data Retrieval. In the Table Join I cannot use structures, and under Data Retrieval, I can only use one of them.
    Is there a way to create a temporary (or permanent) structure that would contain MDEZ and the extra field MATNR that I need?
    Please advise.

  • Connectoriviews to get information from db system using connector framework

    Hi,
    How to Develop Connector iviews to get information from DB system by using Connection Framework API?
    please give one example to dev connector iviews to get info from db system uisng connector frame work api.
    if any body know please help
    Thanks,
    Sid

    Hi,
      For any external database like oracle or sql, you can use JDBC Connector iView.
    [Creating iViews for Databases (JDBC)|http://help.sap.com/saphelp_nw04/helpdata/en/f5/eb516b0e6a11d7b84900047582c9f7/frameset.htm]
    If you want to use SAP DB, then you can go for SAP connector iView
    [Creating iViews over Enterprise Applications and Databases|http://help.sap.com/saphelp_nw04/helpdata/en/f5/eb51610e6a11d7b84900047582c9f7/frameset.htm]
    For other iViews based on SAP systems.
    [Running the System Landscape Wizard|http://help.sap.com/saphelp_nw04/helpdata/en/1f/bddf3d48b05d5ae10000000a11405a/frameset.htm]
    Check this thread for an example.
    Creating JDBC System in SAP EP For SQL Server 2005
    Regards,
    Harini S

  • Collecting logs from Cisco Prime Infrastructure

    Hi ,
    I am currently working in integrating  Cisco Prime Infrastruture with the siem tool Qradar.
    Can any one help me out in below issues:
    1)How and where is the log stored in Cisco Prime.?
    2)Does the logs contains the logs of the devices that Cisco Prime manages?
    3)Is there any way to sent out the logs from Cisco Prime to a third party device.?

    Hi,
    1)How and where is the log stored in Cisco Prime.?
    /opt/CSCOlumnos/logs
    2)Does the logs contains the logs of the devices that Cisco Prime manages?
    AFAIK,
    In the prime infrastructure Syslogs are directly read from udp port 514 and then filtered
    , the non SEV1 and SEV2 syslogs will be dropped and will not be entered into db . The
    syslog messages will not be saved into log files .
    Till now PI support only SEV 0,1 and 2 syslog.
    3)Is there any way to sent out the logs from Cisco Prime to a third party device.?
    unfortunately , this feature is not there in PI so far.
    Thanks-
    Afroz
    ***Ratings Encourages Contributors ****

  • SNMP information from Cisco 2800 ISRs

    I have several 2800 series routers setup as MGCP gateways with T1 PRI connections to the PSTN. Does anyone know what MIBs/OIDs to monitor for individual DS0 and DS1 activity? I opened a TAC case, but it wasn't very fruitful. Basically I just want to know how many active calls per PRI, averages, totals, uptime, etc.

    Hi, the MIB would be is this:
    ftp://ftp.cisco.com/pub/mibs/v2/ISDN-MIB.my
    hope this helps, please rate post if it does!

  • Information from Catalyst 4507 by SNMP

    Hello community!
    I need to get access to egp and host catalogs by snmp. I have the following switch's configuration:
    snmp-server community public RO
    snmp-server community privete RW
    Can you help me why doesn't it work?

    What version of IOS are you running? 
    Exterior Gateway Protocol (EGP) is BGP predecessor. I doubt that anybody is still running it.
    The support for EGP has been removed from IOS, at the same time as IGRP, in the 12.2T train. Therefore support for EGP is not available in 12.3 and up. 
    If you're still using a old OS, we can find details on what exactly you want to manage in EGP.
    If you mean BGP, you can configure the device for BGP traps and BGP related data, you can configure BGP traps or poll using CISCO-BGP4-MIB.
    -Thanks
    Vinod

  • Configuring HSRP in Cisco Switches using Dynamips

    Dear Friends,         
      I am in process of configuring hsrp using dynamips   
       when i am putting the comand
        SW1(config)#standby 1 ip 10.1.1.10
                                               ^                                
      % Invalid input detected at '^' marker.      
       its showing error i,e the command is support by switch ios
      Please check the show version command for ios details
    "SW1#sh version Cisco IOS Software, 3600 Software (C3640-IK9O3S-M), Version 12.4(7), RELEASE SOF TWARE (fc6) Technical Support: http://www.cisco.com/techsupportCopyright (c) 1986-2006 by Cisco Systems, Inc. Compiled Wed 01-Mar-06 00:58 by alnguyen  ROM: ROMMON Emulation Microcode ROM: 3600 Software (C3640-IK9O3S-M), Version 12.4(7), RELEASE SOFTWARE (fc6)  SW1 uptime is 3 hours, 13 minutes System returned to ROM by unknown reload cause - suspect boot_data[BOOT_COUNT] 0 x0, BOOT_COUNT 0, BOOTDATA 19 System image file is "tftp://255.255.255.255/unknown"    Cisco 3640 (R4700) processor (revision 0xFF) with 94208K/4096K bytes of memory. Processor board ID 00000000 R4700 CPU at 100MHz, Implementation 33, Rev 1.2 16 FastEthernet interfaces DRAM configuration is 64 bits wide with parity enabled. 125K bytes of NVRAM. 8192K bytes of processor board System flash (Read/Write)  Configuration register is 0x2102  "
    Can anyone help me in solving this issue. Any kind of help is greatly appreciated

    Hi,
    SW1(config)#
    you have to be in (layer-3) interface configuration mode, e.g. on a SVI:
    R1#conf termR1(config)#interface vlan1R1(config-if)#standby 1 ip 1.1.1.1
    Hope that helps
    Rolf

  • Retrieval of Information from Excel Sheet using JDBC-ODBC

    Hello,
    Currently I am writing a program that extracts information fromexcel sheet. This excel sheet have some values in Chinese. I am able to extract English character from the different column in excel, but if some column contain chineese valur then it prints ???. After that I looked on net and found some details in to convert Big5 (Chinese) character into unicode, but this is not working and in that case nothing is displayed. I am attaching the my code. In my code the 'customer' field contain chinese character.
    import java.io.ByteArrayInputStream;
    import java.io.InputStreamReader;
    import java.io.BufferedReader;
    import java.io.Reader;
    import java.io.IOException;
    import java.sql.*;
    public class ExcelJDBC
         Connection con;
         Statement stmt;
         public ExcelJDBC(String url)
              try
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              catch(java.lang.ClassNotFoundException e)
                   System.err.print("ClassNotFoundException: ");
                   System.err.println(e.getMessage());
              try
                   con = DriverManager.getConnection(url, "", "");
                   stmt = con.createStatement();
              catch(SQLException ex)
                   System.out.println("SQL EXCEPTION OCCURED");
                   System.err.println("SQLException: " + ex.getMessage());
                   ex.printStackTrace();
         public void sql(String sql)
              try
                   stmt.execute(sql);
              catch(SQLException ex)
                   System.out.println("SQL EXCEPTION OCCURED");
                   System.err.println("SQLException: " + ex.getMessage());
                   ex.printStackTrace();
         public void closeAll()
              try
                   stmt.close();
                   con.close();
              catch(SQLException ex)
                   System.out.println("SQL EXCEPTION OCCURED");
                   System.err.println("SQLException: " + ex.getMessage());
                   ex.printStackTrace();
         //big5 to unicode conversion
         private String b2u(String str2convert) throws IOException
              System.out.println("The input string is :" + str2convert);
              StringBuffer buffer = new StringBuffer();
              byte[] targetBytes = str2convert.getBytes();
              ByteArrayInputStream stream = new ByteArrayInputStream(targetBytes);
              InputStreamReader isr = new InputStreamReader(stream,"Big5");
              Reader in = new BufferedReader(isr);
              int chInt;
              while((chInt = in.read()) < -1)
                   buffer.append((char)chInt);
              in.close();
              System.out.println("The output string is :" + buffer.toString());
              return buffer.toString();
         public void sqlQuery(String sql)
              try
                   ResultSet rc = stmt.executeQuery(sql);
                   if(rc != null)
                        int count = 0;
                        while (rc.next())
                             String value = "";
                             value = b2u(rc.getString("workorder"));
                             System.out.println("The workorder is : "+value);
                             String customer = rc.getString("Customer");
                             value = b2u(customer);
                             System.out.println("The Customer is : "+value);
                             count++;
                        System.out.println("Entering in loop " count " time.\n");
              catch(SQLException ex)
                   System.out.println("SQL EXCEPTION OCCURED");
                   System.err.println("SQLException: " + ex.getMessage());
                   ex.printStackTrace();
              catch(IOException ex)
                   System.out.println("IO EXCEPTION OCCURED");
                   System.err.println("IOException: " + ex.getMessage());
                   ex.printStackTrace();
    public static void main(String[] args)
         String url = "jdbc:odbc:detailsdsn";     
         try
              ExcelJDBC ej = new ExcelJDBC(url);
              ej.sqlQuery("SELECT \"workorder\", \"Customer\" FROM \"Sheet1$\"");
              ej.closeAll();
         catch(Exception ex)
              System.out.println("SQL EXCEPTION OCCURED");
              System.err.println("SQLException: " + ex.getMessage());
              ex.printStackTrace();
    I will highly appriciate any answer of my problem.
    Regards,
    Ruchi

    Try to find out, what characters really are in your string customer.
    I assume you used System.out.print..(), when you got them as '?'.
    Find out which unicodes they are!
    Afterwards I see two possibilites:
    Either
    1) you see real unicodes for Chinese characters, and it was only the unability of System.out to print them others than as '?', then you can convert these characters however you want. Maybe your further processing can handle them directly as unicode.
    or
    2) you get really '?' in your string. Then Excel (or JDBC or ODBC or ???) hasn't been able to transmit these Chinese characters to your program others than converting them all into '?'. Then you are lost, because you can't know which Chinese character each '?' originally could have been.
    Hope this helps.
    Please tell us, which you experienced, 1) or 2).

  • Help needed extracting information from command output using sed

    I want to be able to pipe the output of:
    playerctl metadata
    into sed and extract only the relevant information. I have a working knowledge of regular expressions but I'm not how to get sed to only output the matched text. For reference, this is an example output of the playerctl command:
    {'mpris:artUrl': <'http://open.spotify.com/thumb/ddf652a13affe3346b8f65b3a92bd3abfdbf7eca'>, 'mpris:length': <uint64 290000000>, 'mpris:trackid': <'spotify:track:0xqi1uFFyefvTWy0AEQDJ7'>, 'xesam:album': <"Smokey's Haunt">, 'xesam:artist': <['Urthboy']>, 'xesam:autoRating': <0.23000000000000001>, 'xesam:contentCreated': <'2012-01-01T00:00:00'>, 'xesam:discNumber': <1>, 'xesam:title': <'On Your Shoulders'>, 'xesam:trackNumber': <6>, 'xesam:url': <'spotify:track:0xqi1uFFyefvTWy0AEQDJ7'>}%
    I'm trying to get the track name and artist name and combine them into one string. Perhaps sed isn't the tool for the job but I'm not really sure what else to try. Any help is very appreciated.

    If that was valid json, which it doesn't appear to be, you could use jshon to query it.
    Are you sure that is the exact output of the command? It looks sort of off...
    In the meatime, this is pretty hacky:
    awk 'BEGIN { RS=","; FS="'\''" }; /artist/ { artist = $4 }; /title/ { title = $4 } END { print artist": "title }' file
    Urthboy: On Your Shoulders

  • Collecting information from CardLayout / RadioButtons

    Hi there,
    I have a following code,
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    //public class CardLayoutDemo implements ItemListener {
    public class jlistandClayout implements ListSelectionListener {
        JPanel cards; //a panel that uses CardLayout
        //final static String BUTTONPANEL = "JPanel with JButtons";
        //final static String TEXTPANEL = "JPanel with JTextField";
          final static int temp   =    4;
        public void addComponentToPane(Container pane) {
            //Put the JComboBox in a JPanel to get a nicer look.
            JPanel comboBoxPane = new JPanel(); //use FlowLayout
            String[] GUNIT      = new String[temp];
            GUNIT[0] = "2";
            GUNIT[1] = "3";
            GUNIT[2] = "5";
            GUNIT[3] = "4";
              JList cb = new JList(GUNIT); // added
              cb.addListSelectionListener(this); // added
            comboBoxPane.add(cb);
            JPanel[]  GPANEL              = new JPanel[temp];
            JRadioButton[][]   GBUTTON    = new JRadioButton[1][temp];
            for(int i=0; i<temp; i++){
                 GPANEL[i] =    new JPanel();
                 ButtonGroup    bGroup   = new ButtonGroup();
                 GPANEL.setLayout(new GridLayout(1,temp));
         for(int f=0; f < temp; f++){
              GBUTTON[0][0] = new JRadioButton(GUNIT[i] + "A");
              GBUTTON[0][1] = new JRadioButton(GUNIT[i] + "B");
              GBUTTON[0][2] = new JRadioButton(GUNIT[i] + "C");
              GBUTTON[0][3] = new JRadioButton(GUNIT[i] + "D");
              bGroup.add(GBUTTON[0][f]);
              GPANEL[i].add(GBUTTON[0][f]);
    JPanel GoPanel = new JPanel();
    JButton Go = new JButton("Go");
    GoPanel.add(Go);
    //Create the panel that contains the "cards".
    cards = new JPanel(new CardLayout());
    for(int j=0; j < temp; j++){
    cards.add(GPANEL[j], GUNIT[j]);
    pane.add(comboBoxPane, BorderLayout.PAGE_START);
    pane.add(cards, BorderLayout.CENTER);
    pane.add(GoPanel, BorderLayout.PAGE_END);
    public void itemStateChanged(ItemEvent evt) {
    CardLayout cl = (CardLayout)(cards.getLayout());
    cl.show(cards, (String)evt.getItem());
         public void valueChanged(ListSelectionEvent e)
    if (e.getValueIsAdjusting() == false) {
    CardLayout cl = (CardLayout)(cards.getLayout());
         JList list = (JList)e.getSource();
    cl.show(cards, (String)list.getSelectedValue());
    * Create the GUI and show it. For thread safety,
    * this method should be invoked from the
    * event-dispatching thread.
    private static void createAndShowGUI() {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);
    //Create and set up the window.
    JFrame frame = new JFrame("CardLayoutDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //Create and set up the content pane.
    jlistandClayout demo = new jlistandClayout();
    demo.addComponentToPane(frame.getContentPane());
    //Display the window.
    frame.pack();
    frame.setVisible(true);
    public static void main(String[] args) {
    //Schedule a job for the event-dispatching thread:
    //creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    Which creates the list with list items. The centre panel uses carlayout to contain different sub-panels with combination of radio buttons.
    I want to create a hashtable of values, which corresponds to selected radio buttons, after pressing go button. In other words, suppose I select 1B, 2A, 3C, and press Go button, then the hashtable contains the values 1B,2A, and 3C will be created.
    I am bit stuck. This is just a simple version of the problem that I have (the real version is too big, and bit complicated). Once I get the solution for this, then I could use this solution to my real problem. Your advices and ideas would be much appreciated. Thank you.
    Regards,
    Young

    This is what I have so far:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    //public class CardLayoutDemo implements ItemListener {
    public class jlistandClayout implements ListSelectionListener, ActionListener {
        JPanel cards;
          final static int temp   =    4;
          private String AButton; //just added
          private String BButton; //just added
          private String CButton; //just added
          private String DButton; //just added
        public void addComponentToPane(Container pane) {
            JPanel comboBoxPane = new JPanel();
            String[] GUNIT      = new String[temp];
            GUNIT[0] = "2";
            GUNIT[1] = "3";
            GUNIT[2] = "5";
            GUNIT[3] = "4";
              JList cb = new JList(GUNIT);
              cb.addListSelectionListener(this);
            comboBoxPane.add(cb);
            JPanel[]  GPANEL              = new JPanel[temp];
            JRadioButton[][]   GBUTTON    = new JRadioButton[1][temp];
            for(int i=0; i<temp; i++){
                 GPANEL[i] =    new JPanel();
                 ButtonGroup    bGroup   = new ButtonGroup();
                 GPANEL.setLayout(new GridLayout(1,temp));
         for(int f=0; f < temp; f++){
              AButton = GUNIT[i] + "A";//just added
              BButton = GUNIT[i] + "B";//just added
              CButton = GUNIT[i] + "C";//just added
              DButton = GUNIT[i] + "D";//just added
              GBUTTON[0][0] = p_jradiobuttonNew(AButton, GUNIT[i] + "A", false);//modified
              GBUTTON[0][1] = p_jradiobuttonNew(BButton, GUNIT[i] + "B", false);//modified
              GBUTTON[0][2] = p_jradiobuttonNew(CButton, GUNIT[i] + "C", false);//modified
              GBUTTON[0][3] = p_jradiobuttonNew(DButton, GUNIT[i] + "D", false);//modified
              bGroup.add(GBUTTON[0][f]);
              GPANEL[i].add(GBUTTON[0][f]);
    JPanel GoPanel = new JPanel();
    JButton Go = new JButton("Go");
    GoPanel.add(Go);
    //Create the panel that contains the "cards".
    cards = new JPanel(new CardLayout());
    for(int j=0; j < temp; j++){
    cards.add(GPANEL[j], GUNIT[j]);
    pane.add(comboBoxPane, BorderLayout.PAGE_START);
    pane.add(cards, BorderLayout.CENTER);
    pane.add(GoPanel, BorderLayout.PAGE_END);
    private JRadioButton p_jradiobuttonNew( //just added. this is how I usually create and initialize the components
              final String a_sCommand
                   ,final String a_sText
              ,boolean isSelected
                   javax.swing.JRadioButton jradiobutton = new JRadioButton();
                   jradiobutton.setText( a_sText );
                   jradiobutton.setActionCommand( a_sCommand);
              return jradiobutton;      
    public void actionPerformed( //to be completed
    java.awt.event.ActionEvent a_actionevent
    public void itemStateChanged(ItemEvent evt) {
    CardLayout cl = (CardLayout)(cards.getLayout());
    cl.show(cards, (String)evt.getItem());
         public void valueChanged(ListSelectionEvent e)
    if (e.getValueIsAdjusting() == false) {
    CardLayout cl = (CardLayout)(cards.getLayout());
         JList list = (JList)e.getSource();
    cl.show(cards, (String)list.getSelectedValue());
    * Create the GUI and show it. For thread safety,
    * this method should be invoked from the
    * event-dispatching thread.
    private static void createAndShowGUI() {
    //Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);
    //Create and set up the window.
    JFrame frame = new JFrame("CardLayoutDemo");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    //Create and set up the content pane.
    jlistandClayout demo = new jlistandClayout();
    demo.addComponentToPane(frame.getContentPane());
    //Display the window.
    frame.pack();
    frame.setVisible(true);
    public static void main(String[] args) {
    //Schedule a job for the event-dispatching thread:
    //creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    just added more lines and commented only the parts that are changed...the whole point of showing you this code is to see if it is possible to add the action listeners to all the radiobuttons like this. Please correct me if I am wrong. Thank you
    Young

  • Collect information from an exprenal SQL DB and collect it into a SCOM Databag so we can collect the data, report and report on it.

    The DB is collecting counts.  We want to collect the counts into a bag, then once in the bag be able to report the counts (need to collect on an hourly basis)

    Hi TLC426,
    you can use a timed powershell or vb script to connect to the db and run a sql command against it. The result must then be parsed and returned in the property bag.
    As a starting point you should have a look at Pete Zerger's blog post
    http://www.systemcentercentral.com/scom-query-sql-database-for-value-in-monitoring-script/ .
    Just wrap around the creation of a property bag and replace the eventlog entry generation with returning the value.
    Please keep in mind that you should always should return a property bag, even it is empty.
    Regards
    Boris
    Regards, Boris

Maybe you are looking for

  • How can I copy my FF e-mail address book to newly installed T-Bird?

    Win7, 32bit, PC. I'm moving to a new ISP (i.e. from BT to Plusnet). I've been using Firefox as both browser and e-mail client but to help me maintain clarity I want to use T-Bird as e-mail client. I would like to copy my address book from Firefox to

  • File Sharing over IPsec with RV220W

    Hello all, Ultimately, the issue is that I have two RV220Ws with an IPsec VPN tunnel between them that appears to be up but that I can't seem to get folder sharing going over. Here's the background. I originally had two Netgear FVS318s set up with a

  • Using a Search Window to Filter Data In PowerPivot on Sharepoint?

    When viewing a PowerPivot workbook natively all is well. However when I save it to Sharepoint and view it via a browser, I find that the option to filter data by typing in a value is no longer present. (All there is is an extremely LONG list of value

  • Satellite C660-1J2 - Changing the display colour

    HI hope someone can assist me this is new computer, a splash screen came up saying that the screen colour was set to high and that uses CPU power or you can set it to lower or not see this screen and you can change in effects. Were or how can I get t

  • Accounting entries in invoice

    Hi, I have cancel the invoice document with amount usd 600, system create the accounting entries as below.. Vendor: USD 600 Debit GR/IR Clearing account: USD 154600 Credit  Purchase Service account: USD 154000 Debit Is these entries are correct if no