Ad Widget

Collapse

how to control switch ports(enable/disable) via zabbix

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • immike
    Junior Member
    • Oct 2015
    • 1

    #1

    how to control switch ports(enable/disable) via zabbix

    Dears,
    I want to enable or disable Cisco switch ports on MAP webpage. I have wrote a shell script,How to transfer port number parameters to this script?
    Is there any solution?
  • aigars.kadikis
    Senior Member
    Zabbix Certified SpecialistZabbix Certified Professional
    • Mar 2018
    • 208

    #2
    Hello immike,

    Sound like your script communicates with your Cisco device via SNMPv3 or SSH. Is it true? Would you mind to share your work?

    Meanwhile, the implementation of your idea can be as follows:
    1) parametrized your script to accept arguments.
    2) script must be tested from users 'zabbix' environment.
    3) the hardest work would be to design a template which uses host prototype functionality and creates a virtual host per each port. This may not be visually satisfying if you have multiple 96 ports switches. But for very few devices with not so many ports, it can be OK.
    4) place the script in 'externalscripts' directory. Set the right permissions to the script. Must be executable. The script is owned by user zabbix, group zabbix.
    4) configure your script under [Administration -> Scripts]. Write a full path to the script + use either macro {HOST.HOST} or {HOST.NAME} as an argument.
    5) manually add all ports you are interested in the map.

    Regards,

    Comment


    • immike
      immike commented
      Editing a comment
      Target=`cat DesktopNumber.txt`
      SWInfo=`grep $Target mapping.dat`
      SWIP=`echo $SWInfo | awk -F" " '{print $2}'`
      SWPort=`echo $SWInfo | awk -F" " '{print $3}'`
      Username=`cat AdminInfo.dat | awk -F" " '{print $1}'`
      ACPasswd=`cat AdminInfo.dat | awk -F" " '{print $2}'`
      ENPasswd=`cat AdminInfo.dat | awk -F" " '{print $3}'`

      expect <<EOF
      spawn telnet $SWIP
      expect "Username:"
      send "$Username\r"
      expect "Password:"
      send "$ACPasswd\r"
      expect ">"
      send "en\r"
      expect "Password:"
      send "$ENPasswd\r"
      expect "#"
      send "conf t\r"
      expect "config)#"
      send "int $SWPort\r"
      expect "config-if)#"
      send "shutdown\r"
      expect "config-if)#"
      send "end\r"
      expect "#"
      send "exit\r"
      expect eof
      EOF
Working...