UNSOLVED

vSwizz

updated

3 years ago

V

vSwizz

1 Rookie

•

24 Posts

0

7235

April 8th, 2019 07:00

OME 3.1 running multiple racadm commands in one job?

Hi,

 

Just wondering if anyone knows whether the above is possible. Running 1 command per job works perfectly, but say I want to edit all of the event filters, do I have to run a job per change when using RACADM? For example is there a way to run the following:

 

eventfilters set -c idrac.alert.config.swc.warning -a none -n snmp
eventfilters set -c idrac.alert.config.swc.critical -a none -n snmp

As one job? Or do I have to run two separate jobs?

 

Cheers

  • Daniel My

    12 Elder

    •

    6205 Posts

    6092

    0

    Posted April 8th, 2019 10:00

    Hello

    I don't think it will work that way. There is a note on the help page that only one executable or script is allowed at a time. If you click the question mark in the top right and search script you should pull up the information. The reason it will likely fail is because of the way the remote command works. It is going to perform a racadm remote command with the authentication method provided, after that it will input the command. If you are entering multiple commands it will run them back to back. There is an expectation that each line will contain the racadm remote authentication information since the commands are not session based. Authentication should occur with each command.

    If you are wanting to send multiple commands then I suggest sending them in a script. You can find information in the OMEnt manual and iDRAC CLI guide.

    http://www.dell.com/openmanagemanuals/

    http://www.dell.com/idracmanuals/

    Thanks

  • vSwizz

    1 Rookie

    •

    24 Posts

    6032

    0

    Posted April 9th, 2019 03:00

    Thanks for the response. Its a shame that this is the way the OME Racadm 'job' works, as it would be great to create a batch job to run a load of racadm commands.

     

    Also I noticed a bug in that the only way to run racadm commands against an entire custom group is to select one device, and then under target change it to groups and select the required groups. it seems a hacky way for it to work and some people may not even know that functionality is there. 

  • Daniel My

    12 Elder

    •

    6205 Posts

    6002

    0

    Posted April 9th, 2019 09:00

    There probably is a way to do a batch job. I would think that there are two ways it could be done in a batch.

    The first method would be to start a session and then run all of the racadm commands with the appropriate line breaks. At the end perform a log out, so it would be login, commands, and then logout in the batch file. The second method would be to enter multiple commands using remote racadm in each command. You will likely need to insert pauses if you have a long list of remote racadm commands.

  • Palaniraj

    2 Posts

    4762

    0

    Posted July 25th, 2019 13:00

    Hi Dan, Is something can you put that command or syntax here in thhis chat ? how to put pause or log in or log out in a batch file ?

  • ElectricalTears

    1 Rookie

    •

    15 Posts

    4745

    0

    Posted July 25th, 2019 22:00

    I've written a couple of bash scripts to just loop through a list of hosts and use a heredoc for passing in commands.

    Eg for setting up a monitoring user and enabling SNMPv3

     

     

     

    read -e -p "Enter server names separated by space: " servers
    if $(command -v sshpass > /dev/null); then
            read -p "Enter drac root user password: " password
            connect="sshpass -p $password ssh"
    else
            echo "You will have to manually enter passwords without sshpass"
            connect='ssh'
    fi
    
    read -e -p "Enter monitoring user password: " monPassword
    
    for host in ${servers[@]}; do
            echo 'connecting to' $host
            $connect root@$host << EOF
            racadm set iDRAC.Users.3.Username monitoring
            racadm set iDRAC.Users.3.Password $monPassword
            racadm set iDRAC.Users.3.Enable 1
            racadm set idrac.users.3.ProtocolEnable
    EOF

     

     


    This is kinda slow and doesn't always work very well, and if you're working on 100's of servers then simply iterating isn't enough, you need some way to fork your processes.

    So now I'm looking at moving the scripts to Ansible, for example a very simple playbook demonstrating multiple racadm commands

     

     

    ---
    
    - hosts: exampleserver
      gather_facts: no
      tasks:
        - name: Get Server OS name
          raw: racadm get System.ServerOS.HostName
        - name: Get power redundancy
          raw: racadm get System.Power.RedundancyPolicy

     

     

  • Palaniraj

    2 Posts

    4727

    0

    Posted July 26th, 2019 06:00

    Really appreciating your update on this one.. Yeah I have more than 200+ hosts and batch job is not quite working well.. I made an entry of each of racadm commands and put that in powershell and running it and seems running one by one.. some kind it's working.. 

  • naplee

    3 Posts

    376

    0

    Posted June 25th, 2023 05:00

    It's Year 2023, JUNE ... and this is what worked best for me:

     

    a) in a CMD window:    type .\getcmds.txt | plink root@1.2.3.4 -pw calvin

    If you have installed Putty on Windows, look for plink.exe in the Install path

    Where the file "getcmds.txt" for my test, had 3 lines:

    getractime

    getsvctag

    exit

     

    b)  in a CMD window:  type .\getcmds.txt | ssh root@1.2.3.4 > GETout.txt

    -- it will prompt for a password

    -- you can explore automating passing of the password via scripting, by reading here:

    https://man.openbsd.org/ssh#AUTHENTICATION

     

    c) there is a WINscp equivalent to (a) that one could research

     

    d) In a Powershell window, type -

    $s2 = New-SSHSession -ComputerName "1.2.3.4" -Credential (New-Object System.Management.Automation.PSCredential -ArgumentList "root", (ConvertTo-SecureString -String "calvin" -AsPlainText -Force))
    Invoke-SSHCommand -SessionId $s2.SessionId -Command getractime
    Invoke-SSHCommand -SessionId $s2.SessionId -Command getsvctag
    Invoke-SSHCommand -SessionId $s2.SessionId -Command getversion
    Invoke-SSHCommand -SessionId $s2.SessionId -Command getssninfo
    Invoke-SSHCommand -SessionId $s2.SessionId -Command getled
    Invoke-SSHCommand -SessionId $s2.SessionId -Command getsysinfo
    Invoke-SSHCommand -SessionId $s2.SessionId -Command "get system.location"
    Invoke-SSHCommand -SessionId $s2.SessionId -Command "get system.LCD"
    Invoke-SSHCommand -SessionId $s2.SessionId -Command "hwinventory nic"
    Invoke-SSHCommand -SessionId $s2.SessionId -Command exit
    Remove-SSHSession -SessionId $s2.SessionId

    One could attempt to Invoke a series of commands, programatically into one Invoke-SSHCommand invocation. I did not have time to explore this.

     

    Hope others found this useful.

     

    -Nap

     

  • naplee

    3 Posts

    374

    0

    Posted June 25th, 2023 06:00

    It's Year 2023, JUNE ... and this is what worked best for me: (with Pictures)

     

    a) in a CMD window:    type .\getcmds.txt | plink root@1.2.3.4 -pw calvin

    If you have installed Putty on Windows, look for plink.exe in the Install path

    Where the file "getcmds.txt" for my test, had 3 lines:

    getractime

    getsvctag

    exit

    2023-06-25_PLINK-racadm-.jpg

    b)  in a CMD window:  type .\getcmds.txt | ssh root@1.2.3.4 > GETout.txt

    -- it will prompt for a password

    -- you can explore automating passing of the password via scripting, by starting here:

    https://man.openbsd.org/ssh#AUTHENTICATION

     

    c) there is a WINscp equivalent to (a) that one could research

     

    d) In a Powershell window, type -

    $s2 = New-SSHSession -ComputerName "1.2.3.4" -Credential (New-Object System.Management.Automation.PSCredential -ArgumentList "root", (ConvertTo-SecureString -String "calvin" -AsPlainText -Force))
    Invoke-SSHCommand -SessionId $s2.SessionId -Command getractime
    Invoke-SSHCommand -SessionId $s2.SessionId -Command getsvctag
    Invoke-SSHCommand -SessionId $s2.SessionId -Command getversion
    Invoke-SSHCommand -SessionId $s2.SessionId -Command getssninfo
    Invoke-SSHCommand -SessionId $s2.SessionId -Command getled
    Invoke-SSHCommand -SessionId $s2.SessionId -Command getsysinfo
    Invoke-SSHCommand -SessionId $s2.SessionId -Command "get system.location"
    Invoke-SSHCommand -SessionId $s2.SessionId -Command "get system.LCD"
    Invoke-SSHCommand -SessionId $s2.SessionId -Command "hwinventory nic"
    Invoke-SSHCommand -SessionId $s2.SessionId -Command exit
    Remove-SSHSession   -SessionId $s2.SessionId










    One could attempt to Invoke a series of commands, programmatically into a single Invoke-SSHCommand invocation. I did not have time to explore this.

    2023-06-25_PWRshell-racadm-.jpg

     

    Hope others found this useful.

     

    -Nap

  • naplee

    3 Posts

    315

    0

    Posted June 28th, 2023 03:00

    Adding to my Post of Above (06-25-2023 08:07 AM),

    The Powershell script of (d) output, should be enhanced as follows: (so that no data is missing)

     

    $commandOutput = Invoke-SSHCommand -SessionId $s2.SessionId -Command getsysinfo
    $commandOutput.Output >> iSSHoutput.txt
    "==============================================================================================================`n" >> iSSHoutput.txt
    $commandOutput = Invoke-SSHCommand -SessionId $s2.SessionId -Command getssninfo
    $commandOutput.Output >> iSSHoutput.txt
    "==============================================================================================================`n" >> iSSHoutput.txt
    $commandOutput = Invoke-SSHCommand -SessionId $s2.SessionId -Command getversion
    $commandOutput.Output >> iSSHoutput.txt
    "==============================================================================================================`n" >> iSSHoutput.txt

     

     

     

     
     
  • 0

    0

    Posted January 30th, 2024 21:11

    From any bash/bash like shell command line with ssh:

    cat << EOF | ssh ${CHASSIS_USER}@${CHASSIS} | tee ${CHASSIS_DUMP_FILE}
    getsysinfo
    getioinfo
    getdcinfo
    getpbinfo
    getsel
    retraclog
    racdump
    dumplogs
    getversion -l
    exit
    EOF