19 Replies Latest reply on Oct 20, 2017 11:24 AM by aLTeReGo

    Volume Alert Macro Question

    aLTeReGo

      This is going to sound a bit strange. That's probably because it is, but I'm wondering if anyone has any unique ideas/suggestions on how to leverage alert macros to pass along the correct variable to something like a TreeSize Pro, or WinDirStat that would generate a report upon a volume alert trigger.

       

      TreeSize Pro offers some pretty extensive command-line options, but I can't seem to figure out how to leverage the Orion alert macros so I don't have to create an alert for each and every monitored volume.

      http://www.jam-software.com/treesize/online_manual/EN/index.html?command_line_opt.html

       

      The idea is simple. If any monitored volume goes beyond 90% capacity, generate a report telling the system administrators where the disk space is being used.  Like all products in this category, TreeSize depends on UNC path. I need some method passing this UNC path to TreeSize in the alert trigger. 

       

      I.E. "treesize.exe \\%SERVERNAME%\%DRIVELETTER%$" or something cool that would translate into "treesize.exe "\\servername\C$". I have no interest in specific directories or shares. For my purposes I'm only interested in the administrative drive letter shares.

      Does anyone have any creative ideas on how to do this that doesn't involve creating lots of different alerts?

        • Re: Volume Alert Macro Question
          ecklerwr1

          I have no idea ALTe but sound like a cool idea... I'll experiment a little with this as I love TreeSize Pro and WinDirStat...

          • Re: Volume Alert Macro Question
            ecklerwr1

            It's going to have to be something like:

            "c:\bin\treesize.exe" \\${NodeID}\${Caption}

            Caption is the User-assigned name for this volume which could be c$, d$, etc. or I suppose if nothing else worked you could use a custom property instead.

            • Re: Volume Alert Macro Question
              ecklerwr1

              It's going to have to be something like:

              "c:\bin\treesize.exe" \\${NodeID}\${Caption}

              Caption is the User-assigned name for this volume which could be c$, d$, etc. or I suppose if nothing else worked you could use a custom property instead.

              • Re: Volume Alert Macro Question
                viol8tor

                Once you have your Volume Alert trigger setup,

                You can add this to the trigger action to give you the UNC:

                 

                ${SQL: Select '\\' + n.caption + '\' + (select substring(v.caption,1,1))

                from Volumes v

                join nodes n on v.nodeid=n.nodeid

                where v.volumeid=${VolumeID}}

                 

                This isn't tested, but should work.

                 

                Make sure your volume trigger specifies ' fixed disk' and you are checking for volume status of unknown.

                 

                - v

                  • Re: Volume Alert Macro Question
                    viol8tor

                    Sorry forgot to add the '$'

                     

                    ${SQL: Select '\\' + n.caption + '\' + (select substring(v.caption,1,1)) + '$'

                    from Volumes v

                    join nodes n on v.nodeid=n.nodeid

                    where v.volumeid=${VolumeID}}

                     

                    -v

                    • Re: Volume Alert Macro Question
                      W1ngnu7

                      Has this been verified to work?  I like this whole idea of using Treesize.

                        • Re: Volume Alert Macro Question
                          aLTeReGo

                          The concept is sound, but it's all a matter of what you want to do with this information once it's been created. You could in theory run blat or something similar to email you resulting report, or export it to HTML or GIF/JPG/PNG and link to it in an iframe within the volume details view.

                            • Re: Volume Alert Macro Question
                              aLTeReGo

                              I spent some time getting this working in my lab. Below is an example of those results. Essentially I created an alert that would notify me if any Windows volume exceeds 90% utilization, and email me a report of its filesystem usage. It may need to be adapted to suite your environment slightly based on the following requirements

                               

                              1. Install TreeSize Pro on Your Orion server, accepting the default install location (or adjust the file path location in the Treesize.bat attached)

                              2. Import the Advanced Alert included in the attached ZIP file into Orion

                              3. Copy the Treesize.bat to the root your Orion servers C:\ Drive (or adjust the file path location in the Advanced Alert)

                              4. Download Blat and extract the archive to your search path (such as c:\windows). If you're running Windows 2008 you may need to right click on each file, select properties, and click "unblock" for blat to work properly. (Note: Alternatively you can extract blat to a specific directory such as c:\blat\ provided you update the file location in the treesize.bat file attached)

                              4. Change the User Account the Advanced Alert Manager runs under from System to a domain admin account, so TreeSize has appropriate permissions to access network shares. (Note: alternatively you can use a local administrator account for the Advanced Alert Manager and utilize PsSxec to execute TreeSize with a domain admin account if you'd rather not run the service itself under a domain account)

                               

                              When you're done you should be receiving email notifications similar to the one below when the volume usage of a monitored windows host exceed 90% utilization.

                               

                              TreeSize Email.png

                                • Re: Volume Alert Macro Question
                                  W1ngnu7

                                  The IP address in the .BAT file, is that the solarwinds server?

                                  • Re: Volume Alert Macro Question
                                    chosenv3

                                    Hello,

                                     

                                    Thank you so much for this. I have been looking for something like this for so long and we already use Treesize so it saves us purchasing additional licenses!

                                     

                                    I am however having an issue with getting it to work.Hopefully its something simple that you can help with.

                                     

                                    I have installed Treesize Pro on my Solarwinds server to the default location.

                                     

                                    I put the batch file under D:\Treesize

                                     

                                    Below is the batch file - edited to hide business information.

                                     

                                    "C:\Program Files\JAM Software\TreeSize Professional\TreeSize.exe" /HTML "C:\Windows\Temp\%2.HTML" %1$

                                    BLAT "C:\Windows\Temp\%2.HTML" -S "%~3 is %~4 used" -to xxx@xxx -f Solarwinds@xxx.com -server xxx@xxx.co.uk

                                     

                                    When I run BLAT on its own, it emails me the file, so I know this isn't the issue.

                                     

                                    When I run the treesize line on its own, this launches treesize but obviously doesn't work due to incorrect parameters. But I know treesize is launching ok.

                                     

                                    When I run a test against the Advanced alert, I am told that the alert triggers correctly.

                                     

                                    So I think the issue is with the execute program command.

                                     

                                    C:\Windows\System32\cmd.exe /C D:\Treesize\treesize.bat ${SQL:Select '\\' + n.IP_Address + '\' + (select substring(v.caption,1,1)) from Volumes v join nodes n on v.nodeid=n.nodeid where v.volumeid=${VolumeID}} ${Node.Caption} "${Fullname}" "${VolumePercentUsed}"

                                     

                                    Any advice would be appreciated.

                                     

                                    Many Thanks

                                    • Re: Volume Alert Macro Question
                                      aLTeReGo

                                      There has been some question as to the alert trigger action contained in this alert. It passes a UNC path variable to a batch file (treesize.bat) and tells it what volume on which server to run Treesize against.

                                       

                                       

                                      C:\Windows\System32\cmd.exe /C C:\treesize.bat ${SQL:Select '\\' + n.IP_Address + '\' + (select substring(v.caption,1,1)) from Volumes v join nodes n on v.nodeid=n.nodeid where v.volumeid=${VolumeID}} ${Node.Caption} "${Fullname}" "${VolumePercentUsed}"
                                      
                                      

                                       

                                       

                                      When viewed in Task Manager, you can see Treesize is generating an HTML file with the name of the server, then passing the UNC path to that server volume. In this case, "LAB-VM03-1" has the IP address '10.199.1.194' and the volume this alert is triggering against is the "F:\".

                                       

                                      Hopefully that helps to clarify any confusion. 

                                      • Re: Volume Alert Macro Question
                                        aLTeReGo

                                        Updated Alert definition for use with Orion's Web Based Alerting (older version attached above is for use with the legacy Win32 Advanced Alert Manager). The Batch file included in the Zip file attached above and BLAT are still required.