NetXMS Support Forum

English Support => General Support => Topic started by: anw on January 24, 2016, 04:47:53 PM

Title: Switch Version Check - String transformation
Post by: anw on January 24, 2016, 04:47:53 PM
Hi
i want to monitor my Switch OS Versions.
Could you help me transform the Value i get after doing snmp check
the value i get is:
Juniper Networks, Inc. ex2200-c-12t-2g Ethernet Switch, kernel JUNOS 12.3R11.2, Build date: 2015-09-24 11:55:10 UTC Copyright (c) 1996-2015 Juniper Networks, Inc.

how can i transform this to only check the "JUNOS 12.3R11.2" part  , and setup notifications if its not version XXX

thanks
Title: Re: Switch Version Check - String transformation
Post by: tomaskir on January 24, 2016, 05:08:31 PM
You can use a transformation script like this:

foundMatch = $1 ~= "Juniper Networks, Inc\. .* kernel (.*), Build date: .*";

return foundMatch ? $1 : "Unknown";


Then set threshold on the DCI to "Operation" "!= : not equal to" and the version you want to have on your devices into "Value".

This will generate SYS_THRESHOLD_REACHED events (by default, feel free to generate different event if you want) when the version is invalid.
Handle the event in EPP as you wish to generate Alarms / notifications (by default it will already create an Alarm in NetXMS).
Title: Re: Switch Version Check - String transformation
Post by: anw on January 24, 2016, 06:29:10 PM
awesome thank you

i created a new event, and setup EPP notification to send me an email.

how can forward the actual Kernel Version to the notification?
so i get an email like: "JUNOS is out of date, running Version XXX"

thanks!
Title: Re: Switch Version Check - String transformation
Post by: tomaskir on January 24, 2016, 10:28:29 PM
Here is general info on how to setup emails (I guess you already have that working tho):
https://wiki.netxms.org/wiki/How_to_send_e-mail_notification_when_disk_space_is_low

In the "Send E-Mail" action, you have access to all parameters of the event.
See this link for how they are formatted:
https://wiki.netxms.org/wiki/UM:Event_Processing#Macros_for_Event_Processing

Threshold violation events are all modeled by the "SYS_THRESHOLD_REACHED" event.
Which means that %4 is the current value of the DCI.
For list of all parameters and what numbers they are see the "SYS_THRESHOLD_REACHED" event template (Configuration > Event configuration).
Title: Re: Switch Version Check - String transformation
Post by: anw on January 25, 2016, 04:40:35 PM
ok got it working

thank you very much