Switchvox Developer Blog

Monitoring Switchvox with SNMP and Zabbix

Larry Gilbert
Author: Larry Gilbert
Article posted on May 4th, 2010

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.

Step One : Switchvox SNMP Settings
Before starting in on Zabbix, you’ll need to make a couple of changes on your Switchvox to allow access to SNMP without throwing it open to the whole world.

Network Settings

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.

Highlighted: the SNMP community name field

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.

Access Control

Next, look under Machine Admin again for Access Control. Here, set Switchvox’s internal firewall to allow SNMP access from your monitoring host.

Switchvox's access control page; the SNMP setting is highlighted
Step Two : Zabbix monitoring of Switchvox calls
Now that that’s done, we’re ready to have some fun. One metric you might be interested in tracking is the number of phone calls being handled at any given time (it’s a phone system, after all).

Adding a host entry to Zabbix

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.

Creating a host entry in Zabbix
Add the first item: Number of current calls

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 1.3.6.1.4.1.22736.10.5.1 (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.”

Details of Zabbix's "Create Item" screen

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.

After filling in values for the new item
Check your work

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.

The host configuration screen, showing that SNMP is available on the Switchvox

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.)

"Latest data" view of the new item
Step Three : Zabbix monitoring of VOIP providers

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).

Add a new item

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 1.3.6.1.4.1.22736.10.2.2.

Adding an item for VOIP providers

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.)

Check your work

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).

Both new items in the "Latest data" view
Step Four : Monitoring system resources
We can also monitor general system resources such as memory and hard disk space. There are a couple of ways to get at data for these. Switchvox provides its own set of values, as detailed in the list of Switchvox OIDs for “Hardware Status” in the admin manual. It also provides values from the “iso.org.dod.internet.private.enterprises.ucdavis” tree (here’s a handy reference courtesy of ByteSphere Technologies). If up-to-the-minute data is important to you, you should use the latter, as the Switchvox values are a snapshot taken only once every 10 minutes. For the purposes of this tutorial, though, we will go ahead and use the Switchvox values.

Add items for memory and hard disk usage

Let’s add items for used memory and hard disk space, starting with the memory. As the admin manual says, the OID is 1.3.6.1.4.1.22736.10.3.1.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.

Adding the new item for used memory
Add an item for CPU load

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.

Entering new item for CPU load
Step Five : Raising alarms with triggers
We’ve got some good data to look at and to analyze with fancy graphs (the Zabbix graphs are another exercise for the reader). But it would be nice to use these in a way that will actively warn us if there is a problem. In Zabbix, this is where triggers come in. A trigger simply watches for specific values or specific kinds of changes in values, then fires off an action such as sending an e-mail if and when this happens.

Beginning a new trigger: VOIP provider failure

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.

The trigger creation screen
Set the condition for firing the trigger

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.

Creating a new trigger condition

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.)

The completed condition information
Wrap up the new trigger

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.

The completed trigger screen
Check your work

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.)

The new trigger on the trigger monitoring page

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.

We’ve barely scratched the surface of what can be done with Zabbix monitoring in this article. But the basics shown here, together with the the Zabbix documentation and the list of SNMP OIDs in the Switchvox admin manual, should give you a good springboard for developing a complete panel of things to monitor to keep your PBX running smoothly and give you early warning of trouble so you can spot it before your phone users do.

8 Responses to “Monitoring Switchvox with SNMP and Zabbix”

  1. [...] Digium – Switchvox BlogFirst, 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. [...]

  2. Best VOIP Place…

    [...]Digium - Switchvox Blog[...]…

  3. Rowenta Streamer Sale…

    [...]Digium - Switchvox Blog[...]…

  4. Healthy Juice Drinks…

    Digium - Switchvox Blog…

  5. Workout Routines…

    Digium - Switchvox Blog…

  6. Modern bedroom ideas and your budget…

    Digium - Switchvox Blog…

  7. modern bedroom design ideas…

    Digium - Switchvox Blog…

  8. cheap creatine supplements…

    Digium - Switchvox Blog…

Leave a Comment