Forum Discussion

Kevin_Randolph1's avatar
Kevin_Randolph1
Icon for Nimbostratus rankNimbostratus
Jan 24, 2013

problem with locallb.monitor.set_template_user_defined_string_property()

I am using Python trying to call LocalLB.Monitor.set_template_user_defined_string_property() to set a user defined string:

 

 

def _shared_updates_template_user_defined_string_property(self, template_name, attr, val):

 

 

udsv = self.monitor.typefactory.create('LocalLB.Monitor.UserDefinedStringValue')

 

udsv.name = attr

 

udsv.value = val

 

 

self.monitor.set_template_user_defined_string_property([template_name], [udsv])

 

 

The (truncated) traceback:

 

NotFoundError: Server raised fault: 'Exception caught in LocalLB::urn:iControl:LocalLB/Monitor::set_template_user_defined_string_property()

 

Exception: Common::OperationFailed

 

primary_error_code : 16908342 (0x01020036)

 

secondary_error_code : 0

 

error_string : 01020036:3: The requested monitor parameter (test_monitor_name 1 template_user_defined_string_property.user_string_1=) was not found.'

 

 

I can understand such a message when trying to get the user defined string, but not setting it.

 

Does the name of the user defined string need to begin with some specifc string?

 

I am able to successfully use the get_ and set_template_string_property() methods.

 

 

Thanks,

 

Kevin

 

5 Replies

  • It occurs to me that the monitor type (http) I used may not support user defined strings.

     

     

    Is there a list of what monitor types support user defined strings, and what user defined strings are used for each?

     

     

    -KR
  • On a related matter, how do monitor template types such as SNMP DCA deal with variables?

     

    I created a SNMP DCA type template, and set a few variable names var1 = 1, etc. Then I tried all the various get_template methods and did not see any indication of var1. How do I get such variables from a template? Are they stored in user defined strings? If so, what name is used? I tried doing a get of user defined string 'var1' but no joy.

     

  • Problem solved.

     

     

    Monitor templates of type HTTP do not use user-defined strings.

     

     

    Monitor templates like SNMP DCA do use user-defined strings to hold user-defined variables. I had been using incorrect code attempting to get them.

     

  • I spoke too soon.

    I was able to get the user-defined strings for a SNMP DCA template that was created via the GUI, and had some variables defined. The variables are stored as user-defined strings.

    However, I am unable to set user-defined strings in such a monitor:

     
        udsv = self.monitor.typefactory.create('LocalLB.Monitor.UserDefinedStringValue')
        udsv.name = 'user_string_1'
        udsv.value = 'user_test_string_1'
    
        self.monitor.set_template_user_defined_string_property([template_name], [udsv])
    
    ---------
    [...]
    NotFoundError: Server raised fault: 'Exception caught in LocalLB::urn:iControl:LocalLB/Monitor::set_template_user_defined_string_property()
    Exception: Common::OperationFailed
            primary_error_code   : 16908342 (0x01020036)
            secondary_error_code : 0
            error_string         : 01020036:3: The requested monitor parameter (test_monitor_TTYPE_SNMP_DCA 1 user_string_1=) was not found.'