2 Replies Latest reply on Sep 4, 2018 10:36 AM by Andrew LaGrone

    Passing credentials to perl monitor to be used inside the script body

    Andrew LaGrone

      I tagged my question onto this template, Re: How to monitor Mysql replication status in solarwinds? but I thought I would ask it here in case someone saw it.

       

      I'm trying to monitor our MySQL replication status using the above template, and it looks like you have to plug your credentials into the arguments line using plain text. If I do that, both my DBA group and my InfoSec guys are going to have a fit. I know we can do this in powershell, but I'm not sure if this can be done in perl. How can I (can I?) hand off and use the credential assigned to the application monitor in the perl script body?

       

      In powershell, I would do something like this:

           Function SecureStringToString($value){

                [System.IntPtr] $bstr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($value);

                    try {

                          [System.Runtime.InteropServices.Marshal]::PtrToStringBSTR($bstr);

                          }

               finally {

                        [System.Runtime.InteropServices.Marshal]::FreeBSTR($bstr);

                         }

               }

       

      $c = Get-Credential -credential ${CREDENTIAL}

           [string] $username = $c.Username

           [string] $password = SecureStringToString $c.Password

       

      Is there something for perl (or am I not handling the monitor I linked above correctly?)