Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle platforms that don't support show system buffers command #239

Merged
merged 1 commit into from
Jan 17, 2024

Conversation

matejv
Copy link
Contributor

@matejv matejv commented Jan 17, 2024

Juniper ACX platform does not suppoort show system buffers command, so the system collector crashed:

INFO[0000] Loading config from single.yaml 
INFO[0000] Starting JunOS exporter (Version: 0.12.3)    
INFO[0000] Listening for /metrics on :9326 (TLS: false) 
2024/01/17 08:10:18 Running command on rtr1.examle.com: show interfaces descriptions
2024/01/17 08:10:18 Output for rtr1.examle.com: <rpc-reply xmlns:junos="http://xml.juniper.net/junos/22.4R0/junos">
    <interface-information xmlns="http://xml.juniper.net/junos/22.4R1-S1.2-EVO/junos-interface" junos:style="description">
            <physical-interface>
                <name>et-0/0/0</name>
                <admin-status>up</admin-status>
                <oper-status>up</oper-status>
                <description></description>
            </physical-interface>
            <physical-interface>
                <name>et-0/0/1</name>
                <admin-status>up</admin-status>
                <oper-status>up</oper-status>
                <description></description>
            </physical-interface>
            <physical-interface>
                <name>et-0/0/3</name>
                <admin-status>up</admin-status>
                <oper-status>up</oper-status>
                <description></description>
            </physical-interface>
            <physical-interface>
                <name>et-0/0/4</name>
                <admin-status>up</admin-status>
                <oper-status>up</oper-status>
                <description></description>
            </physical-interface>
            <physical-interface>
                <name>et-0/0/38</name>
                <admin-status>up</admin-status>
                <oper-status>up</oper-status>
                <description></description>
            </physical-interface>
            <physical-interface>
                <name>et-0/0/47</name>
                <admin-status>up</admin-status>
                <oper-status>down</oper-status>
                <description></description>
            </physical-interface>
            <physical-interface>
                <name>et-0/0/51</name>
                <admin-status>down</admin-status>
                <oper-status>down</oper-status>
                <description></description>
            </physical-interface>
            <physical-interface>
                <name>et-0/0/53</name>
                <admin-status>up</admin-status>
                <oper-status>up</oper-status>
                <description></description>
            </physical-interface>
            <physical-interface>
                <name>ae1</name>
                <admin-status>up</admin-status>
                <oper-status>up</oper-status>
                <description></description>
            </physical-interface>
    </interface-information>
    <cli>
        <banner></banner>
    </cli>
</rpc-reply>

2024/01/17 08:10:18 Running command on rtr1.examle.com: show system buffers
2024/01/17 08:10:18 Output for rtr1.examle.com: 
error: syntax error, expecting <command>: buffers

ERRO[0003] System: could not get buffer information: XML syntax error on line 3: unexpected EOF 

It's still nice to get other metrics (mainly os_version) that the system collector provides so I made a patch that won't crash if buffers command does not exist.

I've looked at pkg/features/environment/collector.go how it handles possible non existing command show chassis environment satellite and made a similar change in system collector.

@matejv matejv requested a review from czerwonk as a code owner January 17, 2024 07:17
Copy link
Owner

@czerwonk czerwonk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@czerwonk czerwonk merged commit 143e797 into czerwonk:main Jan 17, 2024
3 checks passed
@czerwonk
Copy link
Owner

Thanks for your contribution! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants