To add a new Variable within Opsview Monitor, Users should click on the 'Variables' menu item within the Settings tab:
Once within the Variables section, Users should click on the 'Add New' button which will load a modal window allowing the configuration and saving of the new Variable:
Once the 'Add New' button has been clicked, a modal window will appear like the image below.
Users can choose to provide friendly names for the arguments instead of 'arg1, arg2, arg3', etc. In the example below, we have created a Variable that will be used to pass authentication details to a Service Check, and have thus changed arg1 to 'Username' and arg2 to 'Password'. Please note, it is not necessary to add a colon after your new label, i.e. 'Username:', as Opsview Monitor adds the colon automatically.
As can be seen in the screen above, the 'Encrypt' button has been checked for 'Arg2', meaning any value entered here when the variable is added to a host, will be stored and handled in an encrypted fashion.
Click 'Submit Changes' and the new Variable is created.
Adding a Variable to a Service Check within Opsview Monitor is very simple.
First, note the name of your Variable and the arguments (where relevant), i.e. arg1 is username, arg2 is password and so forth.
Next, open the Edit window for the Service Check in question. First, click on 'Service Checks' within the Settings menu tab as shown below:
Once the Service Checks window is loaded, add a new Service Check or click edit in the Service Checks contextual menu. Note: Variables can only be added to plugin-based Service Checks.
In the example above, we have simply inserted %MYLOGINDETAILS:1% and %MYLOGINDETAILS:2% (representing the arg1 and arg2 fields from our Variable) to an existing check with the standard 'u/-p flags (username/password). Click 'Submit changes' and the Variable is now 'added' to the Service Check.
Adding a Variable to a Host is done via the 'Variables' tab within the Host Settings edit window, as covered in Section 'Configuring a host: 'Variables' tab'.
To add a Variable to a Host, navigate to 'Host Settings' within the Settings menu tab and edit the Host in question.
Once the host's modal window is opened, click on the 'Variables' tab, which will present a screen similar to the one below:
To add a new Variable, click on the 'Add New' button which will add a new line to the table, as shown below:
The drop-down on the left allows the User to choose the Variable; here we can select our newly-created MYLOGINDETAILS. (Note the % symbols are not shown here).
Once the Variable is selected, enter some text in the value ' as the value field is not used for the MYLOGINDETAILS Variable, we have just entered a description in the screen below (as the value cannot be blank). For Variables whose values are used, i.e. DISK, then the value must contain a relevant value i.e. '/tmp' or '/home/users' etc.
Once the Variable has been saved, the arguments window in the lower half of the modal window is enabled:
In the example above the Username and Password labels we set earlier for arg1 and arg2 can be seen. We can leave these as the default, or we can choose to 'override' them ' i.e. add a value custom to this one host:
Once the 'Submit Changes' button is pressed, the Variable and its overridden values are saved ' and the Password field encrypted.