Summary:ASTERISK-03505: simple program based on zttool to display status of the cards
Reporter:izo (izo)Labels:
Date Opened:2005-02-13 22:18:43.000-0600Date Closed:2008-01-15 15:39:26.000-0600
Versions:Frequency of
Environment:Attachments:( 0) irqmiss.c
( 1) irqmiss2.c
( 2) show_status_fix.txt
( 3) zap_show_status_rev2.diff.txt
Description:Simple program to display cards status including irqmisses
and bipolar violations. Usefull when used with monitoring scripts mrtg etc.
Comments:By: twisted (twisted) 2005-02-14 00:29:49.000-0600

Nice.  I like the output, would be easily parsable..

By: paradise (paradise) 2005-02-14 00:51:12.000-0600

simple but useful!

By: twisted (twisted) 2005-02-14 00:54:14.000-0600

You know what would be really awesome?  To be able to run this as an inet daemon, with a client app that connects over an obscure port to gather this information remotely...  Just think.... remote monitoring of this info from a centralized location..

By: nick (nick) 2005-02-14 11:14:33.000-0600

How about good ol fashoned SNMP?

By: twisted (twisted) 2005-02-14 11:15:53.000-0600

there already exists an snmp module.

By: Mark Spencer (markster) 2005-02-14 13:51:25.000-0600

Much of this information is already available in /proc/zaptel/foo.  Would simply adding IRQ misses to that be sufficient, or do you see this as more valuable as a stand alone application?

By: izo (izo) 2005-02-14 21:54:17.000-0600

Looks like zaptel.c already has ability to add irqmisses to /proc/zaptel/X
it only needs to be > 0.
I just added second version with crc4 ebit and fas counters.

I was just thinking that it would be nice to have like last 5 minute, 1 hour and 24 hours error counters on T1/E1s just like normal PBXes have it. But that would
require like 12 new variables or structure on a span.

By: Clod Patry (junky) 2005-02-18 12:07:03.000-0600

Just tested the irqmiss.c and it works fine on my side.

I agree with izo, that would be really great to have all this managed by itself.

I've an X100P (deprecated), but it seems to work on that one too.

So that would be great to see this in... i just had an idea, i'll come back to you next week on this, going out of city for the week-end.

By: Clod Patry (junky) 2005-02-21 23:03:15.000-0600

this is my idea, that application inside asterisk.
Which looks like:
debian*CLI> zap show status
                            Description     Alarms        IRQ    bpviol:       CRC4
                 Wildcard X100P Board 1         OK          0          0          0

which diplays all the status of all zap cards.

Patch made on CVS-HEAD-02/20/05-16:46:18.

Disclaimer's on file.

Give me feedbacks.

edited on: 02-21-05 23:04

By: Clod Patry (junky) 2005-02-21 23:09:00.000-0600

just tested on my prod machine:
gate2*CLI> zap show status
                            Description     Alarms        IRQ    bpviol:       CRC4
             TE410P (PCI) Card 0 Span 1         OK          0          0          0
             TE410P (PCI) Card 0 Span 2         OK          0          0          0
             TE410P (PCI) Card 0 Span 3         OK          0          0          0
             TE410P (PCI) Card 0 Span 4         OK          0          0          0
             TE410P (PCI) Card 1 Span 1         OK          0          0          0
             TE410P (PCI) Card 1 Span 2         OK          0          0          0
             TE410P (PCI) Card 1 Span 3        RED          0          0          0
             TE410P (PCI) Card 1 Span 4         OK          0          0          0

so everything seems fine.

By: Chuck Pearce (vulturecp) 2005-02-21 23:25:42.000-0600

File to patch: /usr/src/test/channels/chan_zap.c
patching file /usr/src/test/channels/chan_zap.c
Hunk #1 succeeded at 8645 (offset -341 lines).
Hunk #2 FAILED at 8718.
1 out of 2 hunks FAILED -- saving rejects to file /usr/src/test/channels/chan_zap.c.rej
missing header for unified diff at line 87 of patch
can't find file to patch at input line 87
Perhaps you should have used the -p or --strip option?
The text leading up to this was:
|or not\n";

STABLE 1.0.5 error

By: () 2005-02-22 11:26:52.000-0600

vulture, he may have patched against current CVS.

By: Clod Patry (junky) 2005-02-22 11:33:15.000-0600

i would make a patch for stable if drumkilla wants it.

By: abatista (abatista) 2005-02-23 22:40:05.000-0600

This sounds like something I would love to see.  But I am only running stable. Is there a way to get this patch to work on stable?

By: Clod Patry (junky) 2005-02-23 22:41:53.000-0600

i'll make a diff for stable soon, but i'll wait for that one going to head before.

By: Clod Patry (junky) 2005-02-26 07:03:03.000-0600

any testers can test the patch and report any feedbacks?
More tests are done on patch, faster the patch will be added into CVS.


By: nick (nick) 2005-02-26 11:45:22.000-0600

Might I suggest making this into 'zap show statuses' and then figuring out how to do 'zap show status <card/span>'?


By: paradise (paradise) 2005-02-26 12:18:52.000-0600

what about this scenario:
zap show status               -> to show status of all cards and spans
zap show status <card>        -> to show status of all spans of card <card>
zap show status <card/span>   -> to show status of span <span> of card <card>

By: Clod Patry (junky) 2005-02-26 12:54:01.000-0600

ive no trouble with the statues's name.

But i've called it status do to an eventual filters by cards and spans.

By: Matt O'Gorman (mogorman) 2005-03-16 21:47:39.000-0600

commit, no commit, close? or leave to rot...

By: Paul Cadach (pcadach) 2005-04-07 08:46:44

Any update on this available?

By: Clod Patry (junky) 2005-04-07 10:25:17

Sorry, i was busy with another thing, i'll submit something new soon.

By: Clod Patry (junky) 2005-05-09 23:17:38

i really dont have time for this weeks, can we commit it and i'll add later?
Any feedbacks here? Does that work/doesn't work for someone?

By: Kevin P. Fleming (kpfleming) 2005-05-15 13:17:03

Notes on zap_show_status.diff.txt:

- Don't use static variables inside a function unless they need to preserve their values across function calls.

- Don't use an array of ZT_SPANINFO structs when you only need one.

- #undef FORMAT2

- Close the control socket when you are done with it

- Don't use strcpy(alarms, ""), use alarms[0] = '\0';

- Don't use 'zapata' in the help texts, use 'Zaptel' or 'Zaptel-supported'.

- Don't use 'active' in the help text, since the command will easily display the status of inactive cards/spans as well.

By: Clod Patry (junky) 2005-05-15 21:38:40

Thanks Kevin, i really appreciated your feedbacks, it allows me to improve my knowledges and make stronger code.
rev2 (with your comments fixed) will be in soon.

By: Kevin P. Fleming (kpfleming) 2005-05-16 10:35:54

Committed to CVS HEAD, thanks!

By: Clod Patry (junky) 2005-06-13 21:27:05

I need to add a small patch in here.

By: Clod Patry (junky) 2005-06-13 21:29:22

show_status_fix.txt will print something in the console, cause right now, if no zaptel interface was installed, no ast_cli were there, so some users was like: "huh? command didn't work" and they don't know why exactly.

By: Kevin P. Fleming (kpfleming) 2005-06-21 19:49:05

I don't understand... there is an fprintf to STDERR immediately above that which tells them it could not open /dev/zap/ctl. Why do we need another message that basically tells them the same thing?

By: Clod Patry (junky) 2005-06-21 22:50:18

cause there's no output to the end-user.
so on some systems, you could get something like:
debian*CLI> zap show status

which is confusing for the end-user. A better way is to at least, ast_cli a message.

so with this patch, you would get:
debian*CLI> zap show status
No Zaptel interface found.

By: Kevin P. Fleming (kpfleming) 2005-06-23 22:37:12

Committed status fix to CVS HEAD, thanks!

By: Digium Subversion (svnbot) 2008-01-15 15:35:05.000-0600

Repository: asterisk
Revision: 5701

U   trunk/channels/chan_zap.c

r5701 | kpfleming | 2008-01-15 15:35:05 -0600 (Tue, 15 Jan 2008) | 2 lines

add 'zap show status' CLI command to display card/span status (bug ASTERISK-3505)



By: Digium Subversion (svnbot) 2008-01-15 15:39:26.000-0600

Repository: asterisk
Revision: 5996

U   trunk/channels/chan_zap.c

r5996 | kpfleming | 2008-01-15 15:39:26 -0600 (Tue, 15 Jan 2008) | 2 lines

ensure that 'zap show status' always generates output, even when there are no interfaces present (bug ASTERISK-3505)