This comand (watch "asterisk -rx 'sip show peers' | grep xxxx") is only for monitoring 1 extensión?

HI,

I need to know if this comand is only for 1 extensión or i can put more extensión to minitoring?

watch “asterisk -rx ‘sip show peers’ | grep XXXX”

Thanks.

Yes you can modify your command to search for additional peers.

asterisk -rx ‘sip show peers’

monitors all sip devices (it does not monitor extensions).

grep is the Unix pattern matching command line tool. XXXX is presumably a device name that appears in the output of the first command, doesn’t contain characters that are special to grep, and is not spoofed by any other output from the first command.

grep can use regular expression patterns that can match multiple device names, or you can omit it completely and just look at the full output.

Note, as this involves launching three programs in at least two processes, it is quite expensive. watch will mean this happens every two seconds.

I’d strongly recommend running an interactive asterisk console and just trying commands to see what output they produced. You can use help for a list, and help XXX YYY for comands beginning XXX YYY, etc., for descriptions of the commands.

1 Like

Well david,
thank you very much for your help, but what I want to know is if to that command I can add another device in that same line or should I open another console to monitor another device?

I am new to asterisk I have read the manuals and everything but there are still certain lines of command that I do not handle very well, and I would like to know more advanced commands which I am doing tests every time I find one and study it.

The question doesn’t relate to Asterisk. It relates to a very fundamental Unix command.

As already noted, you can monitor all devices managed by chan_sip, by deleting “| grep XXXX”, and you can replace XXXX by patterns that will match any sub-set of those devices.

Please type “man grep” at a shell prompt, for more details.

Running multiple consoles would increase the load on the system a lot more.