Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. # check_junos_ipmonitoring.py
  2.  
  3. This Script is intended for Nagios or Icinga to monitor the Status of an ip-monitoring.
  4.  
  5. # Requirements
  6. * Python3
  7. * junos-eznc
  8.  
  9. # Command Line Options
  10. * -r,--router <host> - Hostname or IP of Router to query
  11. * -u,--user <username> - NETCONF User
  12. * -p,--password <password> - NETCONF Password
  13. * -t,--test <name> - Name of the policy to check
  14.  
  15. # Examples
  16.  
  17. python3 check_junos_ipmonitoring.py -r srx.corp.local -u admin -p password -t failover
  18.  
  19. ## Icinga2 check
  20. ```
  21. object CheckCommand "junos-ipmonitoring" {
  22. import "plugin-check-command"
  23. object CheckCommand "junos-ipmonitoring" {
  24. import "plugin-check-command"
  25. command = [ CustomPluginDir + "/check_junos_ipmonitoring.py" ]
  26. arguments = {
  27. "-r" = {
  28. description = "HOST"
  29. value = "$address$"
  30. }
  31. "-u" = {
  32. description = "netconf user"
  33. value = "$junos_netconf_user$"
  34. }
  35. "-p" = {
  36. description = "netconf password"
  37. value = "$junos_netconf_password$"
  38. }
  39. "-t" = {
  40. description = "policy name"
  41. value = "$junos_ipmonitoring_policy$"
  42. }
  43. }
  44. }
  45.  
  46. object Service "ip monitoring failover" {
  47. import "generic-service"
  48. host_name = "srx"
  49. check_command = "junos-ipmonitoring"
  50. vars.junos_netconf_user = "admin"
  51. vars.junos_netconf_password = "password"
  52. vars.junos_ipmonitoring_policy = "failover"
  53. }
  54.  
  55. ```
  56.  
  57. ## Juniper Configuration Example
  58. * Netconf
  59. ```
  60. set system services netconf ssh
  61. ```
  62.  
  63. * ip-monitoring check
  64. ```
  65. # define a test
  66. set services rpm probe pingcheck test 8.8.8.8 target address 8.8.8.8
  67. set services rpm probe pingcheck test 8.8.8.8 probe-count 5
  68. set services rpm probe pingcheck test 8.8.8.8 probe-interval 1
  69. set services rpm probe pingcheck test 8.8.8.8 test-interval 60
  70. set services rpm probe pingcheck test 8.8.8.8 thresholds successive-loss 3
  71. set services rpm probe pingcheck test 8.8.8.8 next-hop 10.0.0.1
  72. # define ip-monitoring policy (the policy name "failover" is what is used on the -t flag)
  73. set services ip-monitoring policy failover match rpm-probe pingcheck
  74. set services ip-monitoring policy failover then preferred-route route 0.0.0.0/0 next-hop 192.0.2.1
  75. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement