Skip to content

Commit

Permalink
small update to cope with larger call volume
Browse files Browse the repository at this point in the history
This is really to avoid the plugin returning a `Execution error: too many values to unpack` when call volume is high.
  • Loading branch information
jmordica authored Feb 6, 2018
1 parent 9936c30 commit 6f6d6d7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nixstatsagent/plugins/asterisk.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import plugins
import subprocess

### You need to add `nixstats ALL=(ALL) NOPASSWD: /usr/sbin/asterisk` to /etc/sudoers in order for this to work

class Plugin(plugins.BasePlugin):
__name__ = 'asterisk'

def run(self, *unused):
p = subprocess.Popen("sudo asterisk -rx 'core show calls' | grep 'active' | cut -f1 -d ' '", stdout=subprocess.PIPE, shell=True)
p, err = p.communicate()[0].decode('utf-8')
p = p.communicate()[0].decode('utf-8').replace("\n", "")
p = { "calls": p }
return p

Expand Down

0 comments on commit 6f6d6d7

Please sign in to comment.