Tideway Community Forum

forgot password?
   
 
Problem getting regkey (NoAccessMethod)
Posted: 18 November 2008 02:27 PM   [ Ignore ]  
Newbie
Avatar
Rank
Total Posts:  30
Joined  2008-03-19

Hello,

I have a pattern that should extract a regkey, but for some reason it doesn’t.
In the discovery log I see that the credential slave is not able to perform the operation (NoAccessMethod).
Does anyone know what this means and how I can fix this?

triggers
    on hostinfo 
:= HostInfo createdmodifiedconfirmed;
  
end triggers;
 
  
body
 
    host 
:= model.host(hostinfo);
    if 
not host then
      stop
;
    
end if;
 
    if 
host.os_type <> "Windows" then
      stop
;
        
end if;
 
    
// ING Update Version
    
regkey := raw "\HKEY_LOCAL_MACHINE\SOFTWARE\ING\OperatingSystem\UpdateVersion";
    
regqry := discovery.registryKey(hostregkey);
    if 
regqry then
        build_ver 
:= regqry[0].Caption;
        if 
build_ver then
            host
.build_version := build_ver;
        else
            
model.withdraw(host,"build_version");
        
end if;
    
end if; 


Here’s a bit of the log:

1262557504: 2008-11-18 14:38:08,248: discovery.servants: DEBUG: Main_i::getOptions() called
1262557504: 2008-11-18 14:38:08,250: security.api: DEBUG: Authorize user ‘[eca_engine]‘, operation ‘discovery/options/read’
1262557504: 2008-11-18 14:38:08,251: discovery.device: INFO: Host::getRegistryValue() for 10.243.52.115, recordName 0ab8a4142ad96c0909b43024ad7ef4dd
1262557504: 2008-11-18 14:38:08,251: discovery.hosts: DEBUG: getRegistryValue() - running query \HKEY_LOCAL_MACHINE\SOFTWARE\ING\OperatingSystem\UpdateVersion
1262557504: 2008-11-18 14:38:08,251: api.audit: DEBUG: 10.243.52.115: getRegistryValue(): omniORB-1262557504: Try pool
1262557504: 2008-11-18 14:38:08,251: api.audit: DEBUG: 10.243.52.115: getRegistryValue(): omniORB-1262557504: Try to query via AD slave
1262557504: 2008-11-18 14:38:08,251: api.audit: DEBUG: 10.243.52.115: getRegistryValue(): omniORB-1262557504: Try to query via slave
1262557504: 2008-11-18 14:38:08,252: discovery.slavecred.getSlave: DEBUG: No entry for Slave in the naming service.
1262557504: 2008-11-18 14:38:08,253: discovery.slavecred.getSlave: DEBUG: Testing Slave connectivity
1262557504: 2008-11-18 14:38:08,259: discovery.slavecred.getSlave: DEBUG: Slave contacted
1262557504: 2008-11-18 14:38:08,265: common.utils: DEBUG: slave:credential slave is newer than min_version
1262557504: 2008-11-18 14:38:08,265: common.utils: DEBUG: slave:credential slave isValidVersion min_version=‘6.1’ min_revision=‘0.0’ result=0
1262557504: 2008-11-18 14:38:08,265: discovery.slavecred.isValidSlaveVersion: DEBUG: isValidSlaveVersion min_version=‘6.1’ min_release=‘0.0’ result=True
1262557504: 2008-11-18 14:38:08,273: api.audit: DEBUG: 10.243.52.115: getRegistryValue(): omniORB-1262557504: Slave cannot perform operation
1262557504: 2008-11-18 14:38:08,273: discovery.hosts: DEBUG: getRegistryValue() - raising NoAccessMethod()
1262557504: 2008-11-18 14:38:08,273: discovery.device: INFO: finished Host::getRegistryValue() for 10.243.52.115

 Signature 

“with a hip hop the hippie to the hippie
the hip hip a hop a you dont stop the rockin
to the bang bang boogie say up jump the boogie
to the rhythm of the boogie the beat”

Profile
 
 
Posted: 18 November 2008 04:52 PM   [ Ignore ]   [ # 1 ]  
Newbie
Rank
Total Posts:  5
Joined  2008-02-29

Hi Edwin,

NoAccessMethod means we’ve run out of possible ways to obtain the data. Presumably you have a credential set up for this host? And there’s no firewalls in the way? Since the host is already being created, I would guess that’s all ok. Do you have the log from the slave itself? It should shed more light on what’s going on.

By the way, are you aware you can achieve the first part of your pattern much more neatly (and more efficiently)? Just trigger directly on the Host being created or confirmed:

triggers
  on host 
:= Host createdconfirmed where host.os_type "Windows";
end triggers;
 
body
  
// ING Update Version
  
regkey := raw "\HKEY_LOCAL_MACHINE\SOFTWARE\ING\OperatingSystem\UpdateVersion";
  ... 

Chris.

Profile
 
 
Posted: 19 November 2008 11:47 AM   [ Ignore ]   [ # 2 ]  
Newbie
Avatar
Rank
Total Posts:  30
Joined  2008-03-19

Hi Chris,

I have checked the logs on the slave and I noticed an error that said ‘no hive’ so I removed the first ‘/‘ in front of the regkey.

But… now I’m getting ECA errors:

Error while executing a rule—AttributeError: ‘int’ object has no attribute ‘startswith’
Pattern Name CustomHostWindowsING.custom_host_windows_ING
Error Line Numbers 31
Error Count 1
Discovery Access 10.243.40.65 @ 2008-11-19 11:44:18.33
Pattern CustomHostWindowsING.custom_host_windows_ING
Internal Error Details   File “./__init__.py”, line 535, in processEvent
  File “./rule.py”, line 129, in doExecute
  File “/usr/tideway/var/code_1/eca/generated_code/CustomHostWindowsING.py”, line 239, in execute
  llr_tpl_build_ver = dict_get(llr_tpl_regqry[0], ‘Caption’)
  File “./base.py”, line 873, in __getitem__
  File “./base.py”, line 226, in multiGetWithFlags

Sssssooooo…
    ...Any idea?

 Signature 

“with a hip hop the hippie to the hippie
the hip hip a hop a you dont stop the rockin
to the bang bang boogie say up jump the boogie
to the rhythm of the boogie the beat”

Profile
 
 
Posted: 19 November 2008 01:37 PM   [ Ignore ]   [ # 3 ]  
Newbie
Avatar
Rank
Total Posts:  30
Joined  2008-03-19

Got a bit further!

I have changed “regqry[0].Caption” to “regqry.Caption” (I had the “[0]“ there because I have used one of the tpl’s in the ‘pattern ideas’ topic as an example)

The pattern is successfully extracting the regkeys now. The only question now is how to to assign the found value -as an attribute-  to the Host node.
When I do a ‘search Host show build_version” it doesn’t show yet.
Suggestions are welcome.

 Signature 

“with a hip hop the hippie to the hippie
the hip hip a hop a you dont stop the rockin
to the bang bang boogie say up jump the boogie
to the rhythm of the boogie the beat”

Profile
 
 
Posted: 20 November 2008 10:12 AM   [ Ignore ]   [ # 4 ]  
Newbie
Rank
Total Posts:  5
Joined  2008-02-29

Hi Edwin,

The line:

host.build_version := build_ver

should work. Are you certain that part of the pattern is executing? ie. are you actually getting build_ver from the registry query? You could add a log statement inside the “if” to make sure:

log.info("Got build_ver"); 

or something similar. This will get logged in tw_svc_eca_patterns_xx.log, where xx is a number. If you’ve got more than just 00, you’ll have to look in all of them, I’m afraid.

By the way, which pattern did you use to end up with regqry[0].Caption? I’d like to get it fixed if it’s wrong.

Regards,

Chris.

Profile
 
 
Posted: 20 November 2008 01:13 PM   [ Ignore ]   [ # 5 ]  
Newbie
Avatar
Rank
Total Posts:  30
Joined  2008-03-19

Hi Chris,

The log message is a good idea, but I already know that the registry is read because I can find the Discovered Registry Value in the UI. (please see attached picture).

As an example I used this tpl. So that probably explains the way my tpl is set up.

Image Attachments
registry.JPG
 Signature 

“with a hip hop the hippie to the hippie
the hip hip a hop a you dont stop the rockin
to the bang bang boogie say up jump the boogie
to the rhythm of the boogie the beat”

Profile
 
 
Posted: 20 November 2008 05:31 PM   [ Ignore ]   [ # 6 ]  
Newbie
Rank
Total Posts:  1
Joined  2008-03-25

Hi,

Try “regqry.value” instead - the result of a registry query is set in an attribute called “value” on the resulting Discovered Registry Value.

The example tpl you cribbed from is doing WMI queries, where the attribute names depend on what you asked for in the query - so if you have a WMI query “select Caption, Name from Win32_BIOS” you end up with two attributes available “Caption” & “Name”.

Profile
 
 
Posted: 21 November 2008 08:58 AM   [ Ignore ]   [ # 7 ]  
Newbie
Avatar
Rank
Total Posts:  30
Joined  2008-03-19

Yep, regqry.value does the job! My tpl is ready now.
Chris, Roland, many thanks for your help!

 Signature 

“with a hip hop the hippie to the hippie
the hip hip a hop a you dont stop the rockin
to the bang bang boogie say up jump the boogie
to the rhythm of the boogie the beat”

Profile