Export "SIP Show Peers" to external sql server

Rookie with cron jobs and such, but how would I go about running a daily “Sip show peers” command and having that exported from the pbx automatically and saved possibly to a database or sql server?

a cron job to send a csv to you at an appropriate time :-

20 4 * * * /usr/sbin/asterisk -x "sip show peers"|sed -e 's/  */,/g' -e  's/,$//'|mail -s "your Daily sip show peers" [email protected]

dicko,
Thank you for responding and supplying that information. What would I need to adjust this to send to a off system sql server or database instead of getting it as an email?

That would depend on what is your sql server or database, strip off the top and bottom lines and pipe it not though mail but through whatever sql client your server has that can read csv’s and INSERT them in an orderly fashion into a TABLE of your choice.

(this will not be trivial for a rookie, I suggest you get in touch with your IT department, if that is you, then either the good old RTFM method or hire a consultant familiar with your setup )

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.