Friday, February 5, 2021

HOWTO make rpc calls to acquire details from junos routers or switches

For alerts and regular maintenance action you typically need to acquire details for the state of the juniper device. 


You basically need a mini-RSI that you can easily execute.


If you build a file for the collection, you can call the file up and acquire the details.


example collection file use rpc format 

 "cat junosroutercollection.txt"


=================SOF contents ===========================

<rpc>

        <get-bgp-summary-information>

        </get-bgp-summary-information>

</rpc>

<rpc>

        <get-route-summary-information>

        </get-route-summary-information>

</rpc>

<rpc>

        <get-arp-table-information>

        </get-arp-table-information>

</rpc>

<rpc>

        <get-system-uptime-information>

        </get-system-uptime-information>

</rpc>


<rpc>

        <get-ospf-interface-information>

        </get-ospf-interface-information>

</rpc>


<rpc>

        <get-vpls-connection-information>

        </get-vpls-connection-information>

</rpc>


<rpc>

        <get-system-uptime-information>

        </get-system-uptime-information>

</rpc>


<rpc>

        <get-software-information>

        </get-software-information>

</rpc>


<rpc>

        <get-system-users-information>

        </get-system-users-information>

</rpc>


<rpc>

        <get-arp-table-information>

                <no-resolve/>

        </get-arp-table-information>

</rpc>


<rpc>

        <get-interface-information>

                <level-extra>descriptions</level-extra>

        </get-interface-information>

</rpc>

<rpc>

        <get-route-engine-information>

        </get-route-engine-information>

</rpc>

<rpc>

        <get-fpc-information>

                <detail/>

        </get-fpc-information>

</rpc>


<rpc>

        <get-statistics-information>

        </get-statistics-information>

</rpc>


<rpc>

        <get-alarm-information>

        </get-alarm-information>

</rpc>


<rpc>

        <get-license-summary-information>

        </get-license-summary-information>

</rpc>


<rpc>

        <get-log>

                <filename>messages</filename>

        </get-log>

</rpc>

===================================================



Now to execute just cat and pipe the details thru netconf

e.g 

                   cat   <filename>   | ssh  <username>@<x.x.x.x>   -s netconf


You can get creative and pipe thru mail 

cat   <filename>   | ssh  <username>@<x.x.x.x>   -s netconf | mailx -s collection noc@yourdomain.net




Ken Felix 

NSE ( network security expert) and Route/Switching Engineer
kfelix  -----a----t---- socpuppets ---dot---com
     ^      ^
=(  @  @ )=
         o

        /  \


No comments:

Post a Comment