Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docpublic:systemes:ansible_cisco [2023/01/08 17:28]
adminjp [compte Cisco avec clé ssh]
docpublic:systemes:ansible_cisco [2023/01/08 18:14] (current)
adminjp [Playbook ansible cisco cli cmd]
Line 65: Line 65:
 routeur(conf-ssh-pubkey-data)#ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC+NTIY3H4/yfQymt1kKfgNzEkfSKNkx8U4 routeur(conf-ssh-pubkey-data)#ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC+NTIY3H4/yfQymt1kKfgNzEkfSKNkx8U4
 routeur(conf-ssh-pubkey-data)#Fxn65ZNmt5cx61MEXYK6Ok8HkRWCRAh6DCm/NzDzPLPqMZCj5VeMkIk1RMccafdCVxKfBnPd routeur(conf-ssh-pubkey-data)#Fxn65ZNmt5cx61MEXYK6Ok8HkRWCRAh6DCm/NzDzPLPqMZCj5VeMkIk1RMccafdCVxKfBnPd
 +.....
 routeur(conf-ssh-pubkey-data)#8gjWECltaV10HCSKeUgZ2S9rT8KIUGlvMhp5Mg1jmRMIgOK+/iJOdMaKylx3zklR8lcJYzTt routeur(conf-ssh-pubkey-data)#8gjWECltaV10HCSKeUgZ2S9rT8KIUGlvMhp5Mg1jmRMIgOK+/iJOdMaKylx3zklR8lcJYzTt
 routeur(conf-ssh-pubkey-data)#UQ== ansnet@ansmnode.domain.fr routeur(conf-ssh-pubkey-data)#UQ== ansnet@ansmnode.domain.fr
Line 84: Line 84:
 Current privilege level is 10 Current privilege level is 10
 </code> </code>
 +
 +
 +===== Playbook ansible cisco cli cmd =====
 +
 +playbook ansible qui lance une commande cisco en cli affichant les stats de CPU QOS  
 +
 +<code>
 +routeur#show platform hardware fed switch active qos queue stats internal cpu policer
 +
 +                         CPU Queue Statistics                  
 +============================================================================================
 +                                              (default) (set)     Queue        Queue
 +QId PlcIdx  Queue Name                Enabled   Rate     Rate      Drop(Bytes)  Drop(Frames)
 +--------------------------------------------------------------------------------------------
 +0    11     DOT1X Auth                  Yes     1000      1000                0          
 +1    1      L2 Control                  Yes     2000      2000                0          
 +2    14     Forus traffic               Yes     4000      4000                0          
 +3    0      ICMP GEN                    Yes     750       750      0            0          
 +4    2      Routing Control             Yes     5500      5500                0          
 +5    14     Forus Address resolution    Yes     4000      4000                0          
 +6    0      ICMP Redirect               Yes     750       750      7021943669  59789154  
 +7    16     Inter FED Traffic           Yes     2000      2000                0          
 +8    4      L2 LVX Cont Pack            Yes     1000      1000                0          
 +9    19     EWLC Control                Yes     13000     13000    0            0          
 +10   16     EWLC Data                   Yes     2000      2000                0          
 +11   13     L2 LVX Data Pack            Yes     1000      1000                0          
 +12        BROADCAST                   Yes     750       750      31304954    155792    
 +13   10     Openflow                    Yes     250       250      0            0          
 +14   13     Sw forwarding               Yes     1000      1000     2977910     41510     
 +15        Topology Control            Yes     13000     16000    0            0          
 +...
 +
 +</code>
 +
 +c'est une commande complexe pour laquelle je n'ai pas trouvé d'OID snmp, ce qui aurai bcp plus simple ...
 +
 +le playbook ansible ci-dessous realise l'execution de cette commande et stocke le resultat dans un fichier texte locale et noeud master ansible depuis lequel il s'execute 
 +
 +<code>
 +[ansnet@ansmnode .ssh]$ cat /home/ansnet/ansnet/playRecPolicy.yml
 +---
 +
 +- name: Playbook to show qos queue stats internal cpu policer on Cisco 9K
 +  connection: network_cli
 +  hosts: routeur
 +  remote_user: ansnetco
 +  gather_facts: False
 +
 +  tasks:
 +    - name: Show platform hardware qos queue stats internal cpu policer on Device
 +      ios_command:
 +        commands:
 +                - show platform hardware fed switch active qos queue stats internal cpu policer
 +      vars:
 +        ansible_ssh_user: ansnetco
 +        ansible_ssh_pass: "{{ ios_password }}"
 +        ansible_network_os: "ios"
 +        #        ansible_ssh_private_key_file: '/home/ansnet/.ssh/id_rsa_ansiblenet46'
 +
 +      register: config
 +
 +    - name: Save output to output folder
 +      copy:
 +        content: "{{ config.stdout[0] }}"
 +        dest: "/home/ansnet/ansnet/output/{{ inventory_hostname }}-cpu-policer.txt"
 +</code>
 +
 +reste a parser le ficher txt pour en retirer les valeurs a grapher . 
 +
 +
  
 ==== references URLs ==== ==== references URLs ====
docpublic/systemes/ansible_cisco.1673198922.txt.gz · Last modified: 2023/01/08 17:28 by adminjp
[unknown link type]Back to top
CC Attribution-Noncommercial-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0