1752660 Members
5696 Online
108788 Solutions
New Discussion юеВ

Re: Test SNMP/Telnet/SSH configuration from REST client

 
Dschonni
Occasional Contributor

Test SNMP/Telnet/SSH configuration from REST client

Hi there!

I decided to write a client to access IMC through its REST API, because I need to configure more than 1000 devices for auto-backup, which is a little bit messy to manage with the web interface.

The REST API makes it possible for me to change all the device settings from my command line tool but unfortunately it doesn't seem to support the "Test" option for the SNMP, Telnet and SSH configurations as in the web interface, which is important for this task.

Is there any other quite simple way for me to run these tests from my client? I thought about accessing the IMC host through command line (SSH). How can I achieve this in a good way or which commands do I have to execute? Or did I miss a much simpler solution to my problem?

Thanks in advance and kind regards,

Hannes

2 REPLIES 2
LindsayHill
Honored Contributor

Re: Test SNMP/Telnet/SSH configuration from REST client

I wonder if there's a different way of approaching the problem?  It depends what exactly you want to test.

Do you want to:

  1. Check that firewalls/routing are in place between IMC & the managed node?
  2. Check that the SNMP + login type + username/password stored in IMC match what's on the device?
  3. Check that backups can complete successfully?

If it's only #1, then you could have a script that logs into IMC via SSH, and runs snmpwalk/ssh/ping commands. Ansible would work for this.

In theory #2 should be fine if you're managing your configurations + IMC well, but yes, it is good to test. So maybe you could approach it in a different way. To test SNMP, is there some API call you can make that validates that you're getting information back from the device? e.g. request the serial number via API, or something like that (see https://kontrolissues.net/2016/04/11/serial-numbers-how-i-love-thee/)

Similarly, to check login type + user/pass settings, maybe by running a simple command on the device (show version, or something similar). That would test that connectivity + authentication is OK. See this for an example: https://kontrolissues.net/2016/02/14/deploying-code-to-devices-through-your-nms/

The other option is to make sure that backup failure reporting is configured. So your process is to configure the devices in IMC, set up the backup plan, then wait for the failure reports.

Dschonni
Occasional Contributor

Re: Test SNMP/Telnet/SSH configuration from REST client

Thank you for the detailed answer!

Do you want to [...] Check that the SNMP + login type + username/password stored in IMC match what's on the device?

In principle yes, but it's the other way round. So I actually want to check that e.g. SSH or SNMP read-write is configured on the device itself. Many of our devices don't have everything, that is necessary for doing the backups, configured properly.

To test SNMP, is there some API call you can make that validates that you're getting information back from the device?

Not really. API calls only query IMC's database. I can check if there has already been some successful SNMP communication but not if new parameters (e.g. for SNMP write access) work or not.

I decided to SSH onto the IMC host and run test commands/scripts there from within my program. It works well and it wasn't that complicated to implement. However it would be very useful to have such testing capabilities in the REST API.

In the end, of course, the backup history is the final information about successful backups, as you mentioned.

Thanks and regards