Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Flatly)
  • No Skin
Collapse
Brand Logo

NetXMS Forum

  1. Home
  2. Support (Russian)
  3. Запуск скрипта, версия 4.5.6 (ошибка T_IDENTIFIER)

Запуск скрипта, версия 4.5.6 (ошибка T_IDENTIFIER)

Scheduled Pinned Locked Moved Support (Russian)
5 Posts 3 Posters 50.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A
    A
    Akira
    wrote on last edited by
    #1

    Я видимо туплю, как запускать скрипты

    Взял скрипт примера тут
    https://wiki.netxms.org/wiki/Using_nxshell_to_automate_bulk_operations#List_Inventory_Software_for_all_nodes

    for node in [o for o in s.getAllObjects() if isinstance(o, objects.Node)]:
      print 'Node: ', node.getObjectName()
      try:
        for package in s.getNodeSoftwarePackages(node.getObjectId()):
            print package.getName()
      except:
        print "No package found"
    

    А у меня лезет ошибка сразу
    line 1 T_IDENTIFIER expecting '('

    Буду очень благодарен, если поможете со скриптом, который у всех нод в контейнере поставит галки

    Disable SSH...
    Disable configuration pulling
    Disable routing...
    Disable topology...
    Disable network discovery


    Capture.JPG

    1 Reply Last reply
    0
    • U
      U
      uldis
      wrote on last edited by
      #2

      Привет, доброе утро.

      Я использовал этот ресурс viki, и моя оболочка выглядит немного иначе, чем ваша, и скрипт не выдает никаких ошибок. Пожалуйста, попробуйте запустить его из оболочки UNIX и с последней версией


      shell output.png

      1 Reply Last reply
      0
      • A
        A
        Alex Kirhenshtein
        wrote on last edited by
        #3

        Этот скрипт из вики расчитан на запуск при помощи nxshell (python).
        Execute script в консоли запускает nxsl скрипты.

        Из NXSL можно отключить таким скриптом:

        $node->enableSsh(false);
        $node->enableConfigurationPolling(false);
        $node->enableRoutingTablePolling(false);
        $node->enableTopologyPolling(false);
        $node->enableDiscoveryPolling(false);
        

        Можно запустить на ноде, или добавить в Hook::ConfigurationPoll.

        Ну или можно обойти ноды скриптом:

        for (n : GetAllNodes())  {
            n->enableSsh(false);
            n->enableConfigurationPolling(false);
            n->enableRoutingTablePolling(false);
            n->enableTopologyPolling(false);
            n->enableDiscoveryPolling(false);
        }
        
        1 Reply Last reply
        0
        • A
          A
          Akira
          wrote on last edited by
          #4

          А кстати как вообще дефолтные настройки раздела "Polling" сделать для новых нод?

          1 Reply Last reply
          0
          • U
            U
            uldis
            wrote on last edited by
            #5

            дефолтные настройки изменить нельзя, так как они жестко закодированы. Есть  Hook::ConfigurationPoll скрипт где вы можете добавить следующее

            if (classof($object) == "Node") {
              $node->enableConfigurationPolling(false);
            }

            Первый раз после создания noda будет запущен Configurstion poll, а затем он будет отключен.

            1 Reply Last reply
            0

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            Powered by NodeBB Contributors
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups