SWQL not working

Hello,

To start I am new to SolarWinds and SWQL.... I have a query that is working and it gets the total count of all my nodes  in those groups:
SELECT COUNT(1) AS countnodes
FROM Orion.ContainerMembers n
WHERE n.ContainerID IN ('60','61')

What I am needing to do is basically use that same query but tell me what nodes are down which I believe is <>1 and also use the query to give me all nodes that are up. I'm stuck

Thank you

Rick

  • Hello,

    you can add a condition based on the n.status like
    -- for the UP status

    AND n.Status = 1 

    -- for the DOWN status

    AND n.Status = 2 

    cheers

  • <>1 will return anything not '1', which is not quite the same as down, I'll post the codes at the bottom.

    I didn't get a chance to check on my environment with my own tables but something like this should work, (substitute the Status/Level for the appropriate property in the table):


    Query #1  All nodes that are not up:
    SELECT COUNT(ContainerMembers) AS countnodes
    FROM Orion.ContainerMembers n
    WHERE n.ContainerID IN ('60','61')
    AND (Status/Level <>1)

    Query #2 All nodes that are down:
    SELECT COUNT(2) AS countnodes
    FROM Orion.ContainerMembers n
    WHERE n.ContainerID IN ('60','61')

    Query #3 All nodes that are unreachable:
    SELECT COUNT(12) AS countnodes
    FROM Orion.ContainerMembers n
    WHERE n.ContainerID IN ('60','61')

    This article has a good few examples regarding syntax:

    https://documentation.solarwinds.com/en/success_center/orionplatform/content/core-fusion-swql-data-model-examples.htm

    This article dives into SWQL a bit deeper:
    thwack.solarwinds.com/.../swql-walkthrough


    //Status Codes
    StatusId StatusName

    0 Unknown

    1 Up

    2 Down

    3 Warning

    4 Shutdown

    5 Testing

    6 Dormant

    7 NotPresent

    8 LowerLayerDown

    9 Unmanaged

    10 Unplugged

    11 External

    12 Unreachable

    14 Critical

    15 PartlyAvailable

    16 Misconfigured

    17 Undefined

    19 Unconfirmed

    22 Active

    24 Inactive

    25 Expired

    26 MonitoringDisabled

    27 Disabled

    28 NotLicensed

    29 OtherCategory

    30 NotRunning

    31 Online

    32 OnBattery

    33 OnSmartBoost

    34 TimedSleeping

    35 SoftwareBypass

    36 Off

    37 Rebooting

    38 SwitchedBypass

    39 HardwareFailureBypass

    40 SleepingUntilPowerReturn

    41 OnSmartTrim

    42 EcoMode

    43 HotStandBy

    44 OnBatteryTest