SNMP - How to set a null or nothing value - snmp

I'm working on some powershell scripts to set values for oid's.
One of the settings requires me to wipe out the current values first. Then set new ones. But I cannot seem to find the right syntax to make this work.
The syntax is DISPLAYSTRING but I'm having to use hex values to set them.
Here what the MIB says:

Generally, you can't. That object has a MAX-ACCESS of "read-write", meaning you can read from it and write to it. It is possible that the agent reports the object as "not existing" until you write to it (which is a bit naughty; that's what "read-create" is for). But that doesn't mean you can delete it or null it out. You cannot tell it not to have a value.
However, I believe you're misinterpreting the requirements. I suggest using the "No additional mapping" value of 0; my interpretation of the description is that this is the "null mapping" it speaks of.
Alternatively, consult the documentation or vendor to find out how use of this particular MIB is intended.

Related

Can't figure out how to search LOINC using FHIR for a specific test by name?

Can anyone provide some insight on the required syntax to use to search LOINC using FHIR for a specific string in the labs descriptive text portion of an Observation resource?
Is this even possible?
The documentation is all over the place and I can't find an example for this generic kind of search.
I found similar examples here: https://www.hl7.org/fhir/2015Sep/valueset-operations.html
Such as: GET "[base]/ValueSet/23/$validate-code?system=http://loinc.org&code=1963-8&display=test"
But none of them are providing a general enough case to do a global search of the LOINC system for a specific string in an Observation resource.
None of my attempts to use the FHIR UI here, http://polaris.i3l.gatech.edu:8080/gt-fhir-webapp/search?serverId=gatechreadonly&resource=Observation , have been successful. I keep getting a 500 Internal Server Error because I don't know the correct syntax to use for the value part of the search, and I can't find any documentation out of all the copious documents online that explains this very simple concept.
Can anyone provide some insight?
Totally frustrated at this point.
Observation?code=12345-6
or
Observation?code=http://loinc.org|12345-6
where 12345-6 is whatever LOINC code you want to look for (e.g. 39802-4)
The second ensures you'll only match on LOINC codes as opposed to codes from other systems, though given the relatively unique format of LOINC codes, you're mostly safe without including that.
If you want to search for a set of codes, then you can separate the codes or the tuples with commas: E.g.
Observation?code=12345-6,12345-7
or
Observation?code=http://loinc.org|12345-6,http://loinc.org|123456
If you expect to search by a really long list of codes frequently, you can define a value set that includes all the desired codes and then filter by value set:
Observation?code:in=http://somwhere.org/whatever/ValueSet/123
Note: for readability, I haven't escaped the URL contents, but you'll need to escape the URL values appropriately.

How to get units of a variable from SNMP stream?

I'm new to snmp4j. I used the sample code in [1] to extract some meaningful information from a SNMP stream.
In the sample code, oid and value of the variable is extracted, but the value comes without its units. For example
,oid 1.3.6.1.4.1.2021.4.6.0 (SNMP-MIB::memAvailReal.0) gives the value 13385068 without its unit KB. Is there a way to get the value with its units in snmp4j?
Can somebody please look in to this?
[1]https://gist.github.com/akirad/5597203
I believe that the value you're retrieving is simply a SCALAR of type Integer32.
The description in the MIB is "Available Real/Physical Memory Space on the host."
It doesn't even specify the units there, so I don't think there's anywhere to retrieve the units data from. Happy to be corrected by someone if I'm wrong though!
memAvailReal OBJECT-TYPE
SYNTAX Integer32
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"Available Real/Physical Memory Space on the host."
::= { memory 6 }
In other words, its a numeric value and the descriptive metadata from the MIB file doesn't even reveal the units so there's no where to get that info from in code.
Edit:
I googled around some more and found another version of the UCD-SNMP-MIB with this definition:
memAvailReal OBJECT-TYPE
SYNTAX Integer32
UNITS "kB"
MAX-ACCESS read-only
STATUS current
DESCRIPTION
"The amount of real/physical memory currently unused
or available."
::= { memory 6 }
So the info is available in this version of the MIB...
It looks like you can probably make use of this information using the SmiManager class:
http://www.snmp4j.org/smi/doc/com/snmp4j/smi/SmiManager.html
https://oosnmp.net/confluence/pages/viewpage.action?pageId=5799973
But integrating SmiManager into your application might not be trivial (and on looking into it a little bit further , it appears that there's a licence required to use SmiManager!).
For my own little project I'm pre-parsing MIBs and storing the parts of them I need in my NoSQL database rather than including full-blown MIB parsing support. That way I can have a dict of metadata associated with every OID that is easier to access/update and manipulate.
Hope that helps.

Can "sparse zero" be set to the value other than (BYTE)0x00, really?

If I understood the text correctly, Platform SDK contains an innuendo what it can:
The default data value of a sparse file is zero; however, it can be
set to other values.
However, combing thru related text gave me absolutely no signs of corresponding FSCTLs which allows sets or retrieves sparse zero value. So, is there a mistake in the introduction or there are undocumented FS control codes?
Probably really poor writing. Yes,the default value is zero and you can't make the default value be anything except zero.
You can, however, change those zeros to whatever you want by WriteFile. Which, of course, is not what you are asking for.

How might one cope with the ambiguous value produced by GetDllDirectory?

GetDllDirectory produces an ambiguous value. When the string this call produces is empty, it means one of the following:
nobody has called SetDllDirectory
somebody passed NULL to SetDllDirectory
somebody passed an empty string to SetDllDirectory
The first two cases are equivalent for my purposes, but the third case is a problem. If I want to write save/restore code (call GetDllDirectory to save the "old" value, SetDllDirectory to set a "new" value temporarily, and later SetDllDirectory again to restore the "old" value), I run the risk of reversing some other programmer's intent.
If the other programmer intended for the current working directory to be in the DLL search order (in other words, one of the first two bullets is true), and I pass an empty string to SetDllDirectory, I will be taking the current working directory out of the DLL search order, reversing the other programmer's intent.
Can anyone suggest an approach to eliminate or work around this ambiguity?
P.S. I know having the current working directory in the DLL search order could be interpreted as a security hole. Nevertheless, it is the default behavior, and my code is not in a position to undo that; my code needs to be compatible with the expectations of all potential callers, many of which are large and old and beyond my control.
No fix for this. Between a rock and a hard place, you ought to assume that NULL was passed. There is already a way to enable safe searching with a registry setting.

WiX: Invalid Language Id

Some executable files have resources marked "language neutral".
Is it possible to package these binaries using WiX?
The error I receive is: error LGHT0204 : ICE03: Invalid Language Id; Table: File, Column: Language, Key(s)
Setting the Product.Language attribute to '0' does not fix the problem.
You can suppress the retrieval of file information by passing this option to light.exe:
-sh
Suppress file information: do not get hash, version, language and
other file properties
To fix the original cause of the error, compare the incorrect language ID to the ones here.
Alternatively, if you verify that the Language Id is truly valid (I've never seen a case where the ICE was wrong though) then I would suppress the ICE before suppressing the hash information (-sh). The hash information is very important for your install. Instead use "light.exe -sice ICE03" to skip that ICE.
Also note that the ICE03 checks are pretty important so make sure you solve all the other issues befor supressing this it. There is a feature request out there to suppress only specific errors instead of the whole ICE.

Resources