Switchvox SMB 4.5 introduces the ability to expose the PBX’s operational data with the Simple Network Management Protocol (SNMP). Now you can keep tabs on your Switchvox along with other devices on your network in a single SNMP monitor.
In this post I’ll give you some quick examples of things you can do with this. Here at Digium’s San Diego office we use Zabbix 1.8.2, but the principles are the same for any network monitor capable of working with SNMP.
First, go under Machine Admin to the Network Settings panel. Look for the SNMP settings there. These are all security settings for authorization. At the very least you should set the community name to a secret string. If you use a non-Zabbix monitor that supports SNMPv3, also set the user name and password to something secure; SNMP versions 1 and 2c do not use the name and password.
SNMPv3 is recommended as it is much more secure than older versions. However, you may need to use the older versions if you have good reason. In the case of Zabbix, it has a known bug with SNMPv3 waiting to be fixed at this writing. For the sake of demonstration, we choose to use SNMPv2c here. Caution: don’t forget that changing your network settings drops any active calls.
Next, look under Machine Admin again for Access Control. Here, set Switchvox’s internal firewall to allow SNMP access from your monitoring host.
Go to Configuration / Hosts and click “Create Hosts.” The most important things here are the Switchvox’s IP address and domain name. You need to enter at least one or the other, but you can enter both. Zabbix will use whichever you tell it to use.
We’ll need to look up the “SNMP Settings” section in the Switchvox Administrator Manual, examine the items listed there, and find the object ID (OID) for the item we want to track. Here we find the OID for total current calls is 126.96.36.199.4.1.227188.8.131.52 (in Zabbix, you don’t need to enter the leading dot). Let’s create an item for that. Under Configuration / Hosts, set the drop-down menu on the right to “Items” and click “Create Item.”
Most of the defaults provided by Zabbix are reasonable for this (you may have to select your new host if it’s not showing in the host field). You can enter whatever you want for a description. But to enter the appropriate fields for SNMP, we’ll need to change the type to “SNMPv2 agent” first. Then we can fill in the OID as well as the community name we set on the Switchvox. We’ll enter a key name of “swvxCurrentCallsTotal”, which is just an arbitrary handle to use if we want to use this item in calculations later. Finally, we fill in the “new application” field with “Phone calls”; this is a name (arbitrary, again) that will help us organize monitored items, as we’ll see below.
Once saved, Zabbix should begin reading and tracking this value immediately. But first you might want to make sure that SNMP is working in general. You should be back on the Configuration / Hosts page, so choose “Hosts” in the drop-down menu, look for the Switchvox’s entry, and look under the “Availability” column. Among the status indicators there, you should see the SNMP indicator highlighted in green. If it’s gray, wait a bit longer since there might not have been an update since you added the item. If it’s red, the SNMP check is not working; go back to the Switchvox admin pages and verify that you’ve used the correct community name and opened access to SNMP under Access Control. If it’s green, all is well.
Now if you go to the Monitoring / Latest Data page and look up the Switchvox, you should see the number of calls for the moment and the last time there was an update for that item. (Also, now you can see how the name “Phone calls” is used.)
Another item that would be good to track is the status of VOIP providers–you’ll want to know if any of them go down (especially if you have only one).
Look at the list of Switchvox OIDs in the manual and under “VOIP Providers” you’ll see an item for the number of providers in an “OK” state. (Later we’ll see how to keep an eye on this value for changes.) The OID to use is 184.108.40.206.4.1.227220.127.116.11.
In the same subsection, you’ll see that you can even monitor individual providers if you want. (You can do that on your own time; we have only so much space here.)
Go back to Monitoring / Latest Data and you should see both items now. If you wait a minute or two and you still don’t see the new one, go back and make sure you used the correct SNMP community name (usually the lack of new data is the only clue you’ll get that the community name is wrong).
Let’s add items for used memory and hard disk space, starting with the memory. As the admin manual says, the OID is 18.104.22.168.4.1.22722.214.171.124.1. Now things get a little different. We enter “B” for units to indicate bytes; this is a magic value that tells Zabbix to automatically scale the values to kilobytes, megabytes, etc. as needed. Then we need to enter a custom multiplier of 1024 because the values reported via SNMP are in fact kilobytes; otherwise the values stored will be too small. Switchvox only updates these values once every 10 minutes, so there’s no need to set the update interval to be shorter than 600 seconds.
One other useful value is the CPU load (again, Switchvox’s version of this value updates only once every 10 minutes). Here too we have to do something a little differently: since the value can have up to two decimal places, the type has to be set to “Numeric (float).” Otherwise, Zabbix will reject the item as “not supported” since it can’t store a floating-point number as an integer.
For a PBX, a useful trigger would be in the event of one or more VOIP providers failing. We can base the trigger on the value of the “total OK providers” item we defined earlier falling below a defined level.
To begin, go to the Configuration / Hosts page, look for the entry for your Switchvox, and hit its “Triggers” link to take you to its triggers page. Click the “Create Trigger” button in the upper right corner to get a new form for creating a trigger. Go ahead and enter a name for it now.
Zabbix has an easy method for choosing the expression to evaluate in a trigger; we can reach it by hitting “Select” next to the expression field.
For the item, we hit “Select” and get a new window with the list of items we’ve defined. We choose “Number of providers OK” from the list. Looking at the drop-down menu for “Function,” we have a dizzying array of choices, but for our purpose, the simplest is the best: just watch for the number of OK values to fall below a certain number. Choose “Last value < N” for the function, then enter the minimum number of OK providers in the field for N. (You can enter the actual number you want to watch for, or if you want to experiment and intentionally set off the trigger, you can enter an inflated number here.)
Hit “Insert” to save the condition. Why is it “Insert”? Because in reality we can define more than one condition for a trigger–although we don’t need to here. We can just skip down to “Severity” and set it to reflect the seriousness of the situation in the trigger. There’s no need to touch anything else right now.
Once we’ve saved this, we have our first trigger. We can look it up under Monitoring / Triggers now. If the limit defined above is the real-life number we want to watch for, the status will say “OK” and the severity will show up with a green background (even if it is a high severity). If you took the suggestion of setting the limit intentionally too high, you should see the word “PROBLEM” in red, blinking. (There is a third status, “UNKNOWN”, that shows up in gray at times when Zabbix is unable to get a current value.)
Zabbix will also let you define an action to be taken when a trigger is fired–for example, sending an e-mail or instant message, or executing a command.