If and client settings?

I have a task which runs and queries the state of solarwinds client via curl and api
the result is a number 1 - 45 which mean various things.

I would like to build a simple if matrix to load a second client property with the english word to make the state less cryptic for people.

The client setting with the number is "_Solarwinds_Status"
I am trying to set a new client setting “_Solarwinds_State” with words

example:
if {exists setting “_Solarwind_status” whose (value of it as string = “1” ) of client}
setting “_Solarwinds_State”=“Up” of client
endif

Ideally add a string of ‘elseif’ for the other numbers.

I was hoping to do this in an analyses and not in another task? As I will have multiple tasks actually updating the _Solarwinds_status as they issue other commands to solarwinds and check the results.

If you need the string result to be visible at the client (i.e. you’re doing something with it in client relevance or checking the registry), then yes you’d need a separate Task.

If you just need to see the text result in the Console, Web Reports, etc. then you could make a second Property based on the “_Solarwind_status” client setting. Just a separate Analysis Property, for example.

For selecting from a list of mappings, it can be useful to use a ‘tuple’. I don’t know the real values you’re looking for but this may give a start.

q: items 1 of (-1, "Not Set"; 1, "Up"; 2, "Down"; 3, "Unreachable"; 4, "Something else") whose (item 0 of it = value of setting "_Solarwinds_Status" of client as integer | -1)
A: Not Set

If the client setting doesn’t exist, I’m coercing ‘-1’ and mapping that to ‘Not Set’, otherwise taking the value from the client setting and returning the string that maps to it.

2 Likes