How to execute GET method for SNMP of OID without passing the SNMP version.
As in my case, some of the devices respond to V1.0 and some for V2.0.
I have come acrossed in OIDVIEW , there is a "Automatic" SNMP version rather than passing version.
I know V3.0 requires password and username. where as in the case of V1.0 and V2.0 it is just community.
public static string GetData(string ipaddress)
{
string community = "private", response = "";
SimpleSnmp snmp = new SimpleSnmp(ipaddress, community);
if (!snmp.Valid)
response="ip address is invalid. -" + ipaddress;
Dictionary<Oid, AsnType> result = snmp.Get(SnmpVersion.Ver2,
new string[] { "1.3.6.1.2.1.1.1.0" });
if (result == null)
response=("No results received. -" + ipaddress);
else
{
foreach (KeyValuePair<Oid, AsnType> kvp in result)
response = kvp.Value.ToString();
}
return response;
}
I'm expecting something like SnmpVersion.Automatic along with SnmpVersion.Ver1 , Ver2 , Ver3
Is there a solution using snmpsharpnet or any other components?
If you spend some time on RFC documents such as RFC 3584,
https://www.rfc-editor.org/rfc/rfc3584
you will see that even v1 and v2c differ.
#SNMP is designed to be low level library and it does not attempt to be an application level stuff such as OIDVIEW. No detail should be hidden from the users, and that's why there is no "automatic".
"Automatic" is something outside of SNMP RFC documents. OIDVIEW might define it as an algorithm that picks up the most suitable version for users, but I don't see a need that #SNMP to support such vendor defined behaviors.
You can check out snmpsharpnet or other components of course.
Related
I am migrating some code to dml 1.4. Old code used the miss_bank parameter to handle miss read and writes and forward them to some other bank:
dml 1.2;
bank main_bank {
parameter miss_bank = $dev.forwrad_bank;
}
bank forward_bank {
// structure here
}
However the miss bank parameter is now deprecated in dml 1.4 so I have been trying to workaround this issue and get the same or similar behavior.
For this I overridden the io_access_memory function of my main_bank as follows
method io_memory_access(generic_transaction_t *memop, uint64 offset, void *aux_p) -> (bool) {
local bool success = default(memop,offset,aux_p);
if (!success){
log info,4:"Fowarding access to: %s", forward_bank.qname;
success = forward_bank.io_memory_access(memop,offset,aux_p);
}
return success;
}
This works fine for write/read access when there is a miss bank access they are forwarded to the specified bank. However I have noticed this does not work for set inquiry access. I get a log that says, for example "Unmapped inquiry write at 0xdeadbeef" but access is not forwarded to the next bank, seems like the default function returns true anyways.
Is this no longer supported in dml 1.4 and if so how could I work around this?
Actually I have integrated CCAvenue JSP_Kit to my Lifreay portal 6.2. Till payment every thing is working properly that means after filling all the payment details and submitting no error is coming. But we are getting a response as null.
Below is the code of ReponseHandler.jsp.
encResp is coming null after payment or after cancel the request.
<%
String workingKey = "working key"; //32 Bit Alphanumeric Working Key should be entered here so that data can be decrypted.
String encResp= request.getParameter("encResp");
AesCryptUtil aesUtil=new AesCryptUtil(workingKey);
String decResp = aesUtil.decrypt(encResp);
StringTokenizer tokenizer = new StringTokenizer(decResp, "&");
Hashtable hs=new Hashtable();
String pair=null, pname=null, pvalue=null;
while (tokenizer.hasMoreTokens()) {
pair = (String)tokenizer.nextToken();
if(pair!=null) {
StringTokenizer strTok=new StringTokenizer(pair, "=");
pname=""; pvalue="";
if(strTok.hasMoreTokens()) {
pname=(String)strTok.nextToken();
if(strTok.hasMoreTokens())
pvalue=(String)strTok.nextToken();
hs.put(pname, pvalue);
}
}
}
%>
In the portal world you typically don't have access to the full and original HttpServletRequest. You can get access to it by calling
origRequest = PortalUtil.getOriginalHttpServletRequest(
PortalUtil.getHttpServletRequest());
This, of course, means that you're somewhat outside of the spec, however if you really need to communicate through servlet parameters, that might be your only option. I'd also recommend to add this code to a better testable/maintainable location - e.g. inside the Java Portlet class.
Here's the PortalUtil interface.
Hi we want to add tags to a userprofile programmatically.
We are using the Social Business Toolkit for this purpose.
More specifically we use the ProfileService, first we need to get the current tags and this always gives 0 results.
String userEmail = "ABC#XYZ.com";
Map<String, String> params = new HashMap<String, String>();
EntityList<Tag> tags = app.profileService.getTags(userEmail, params);
or
EntityList<Tag> tags = app.profileService.getTags("427ffbb1-ab50-4e82-97b2-46bf5584e799");
both give no tags (tags.size == 0) when we try to print them
if (tags.size() <= 0) {
System.out.println("No tags to be displayed");
}
for (Tag tag : tags) {
System.out.println("Tag : " + tag.getTerm());
System.out.println("Tag Frequency: " + tag.getFrequency());
System.out.println("Tag Visibility : "
+ tag.isVisible());
System.out.println("");
}
I have tried to test this with Connections Cloud and Greenhouse , but for those platforms I get authorization errors.
I tried this both with a 4.5 and 5.0 Connections environment, both giving the same result.
However when I use the URL
profiles/atom/profileTags.do?targetEmail=ABC%40YYZ.com
I do get (XML) results.
We are using version 1.1.9.
On both environments, you need to use the key to access a user's tags.
https://apps.na.collabserv.com/profiles/atom/profileTags.do?targetKey=fb4435f4-f67d-4f4e-b905-669a31445d0f
You can get the key from the service document. http://www-10.lotus.com/ldd/appdevwiki.nsf/xpAPIViewer.xsp?lookupName=API+Reference#action=openDocument&res_title=Retrieving_the_Profiles_service_document_ic50&content=apicontent
Those two environments do not use targetEmail.
Thanks
Paul
I have inserted data into accumulo. But how would i know the exact count of the table ?
Is there any method or API to read the accumulo table size of number of entries ?
First off, Accumulo doesn't know the exact size of a table during active ingest -- it will be an approximate. I don't think any public API methods exist to get this information, although there are some internal methods you could call. Something like the following should work:
ClientContext context = new ClientContext(instance, credentials, clientConfiguration);
MasterClientService.Iface client = null;
MasterMonitorInfo mmi = null;
while (null == mmi) {
try {
client = MasterClient.getConnection(context);
if (client != null) {
mmi = client.getMasterStats(Tracer.traceInfo(), context.rpcCreds())
}
} finally {
if (null != client) {
MasterClient.close(client);
}
}
}
for (Entry<String,TableInfo> table : mmi.getTableMap().entrySet()) {
System.out.println(table.getKey() + "=>" + (table.getValue().recs + table.getValue().recsInMemory));
}
This is similar to how the Accumulo monitor obtains these values. Because these are internal APIs, they're a little rough to use and may change across releases. If you'd like to see these APIs exposed through the normal Instance or Connector methods, please open an issue on the project's JIRA instance!
Do you need to do it programatically? If not, there are various ways that you can do this. The easiest is to go to the Accumulo monitor page on port 50095. If you don't have a ton of data, from the command line you can simply do
accumulo shell -u username -p password -e "scan -t foo -np" | wc -l
I think I'm missing something about how to search in JavaMail.
Download empty messages from a folder
Create a new SearchTerm that matches your results
Filter (yourFolder.search) the results using your search term.
This works. But - why do it this way? If I'm using javamail to connect to something like gmail, the search isn't being executed server-side, and it doesn't seem like there is any advantage to using the whole javax.mail.search.SearchTerm constructs in terms of efficiency or reducing the amount of data that needs to be sent over the network...
I don't see any way that executes a search on the server side and returns a list of matches. Any ideas?
EDIT: Including pseudocode of what I'm doing now, which doesn't execute any search on the server-side. Even if I converted this to use SearchTerm it still wouldn't be doing anything server-side, right?
Properties props = System.getProperties();
props.setProperty("mail.store.protocol", "gimaps");
final Session session = Session.getDefaultInstance(props, null);
final GmailSSLStore store = (GmailSSLStore) session.getStore("gimaps");
store.connect(ADDRESS, PASSWORD);
final GmailFolder allMailFolder = (GmailFolder) store.getFolder("[Gmail]/All Mail");
allMailFolder.open(Folder.READ_ONLY);
final Message[] allMessages = allMailFolder.getMessages();
System.out.println("Messages:" + allMessages.length);
FetchProfile fp = new FetchProfile();
fp.add(FetchProfile.Item.ENVELOPE);
allMailFolder.fetch(allMessages, fp);
for (final Message message : allMessages) {
final Address[] addrs = message.getFrom();
if (addrs != null) {
for (final Address addr : addrs) {
if (addr.toString().toLowerCase().contains("george")) {
System.out.println(addr.toString());
}
}
}
}
You're doing something wrong, but you haven't provided enough details about what you're doing for us to know what you're doing wrong.
Are you using IMAP?
Show us some code and the debug output.
If you're searching in an IMAP folder using the predefined SearchTerm implementations, it will try to perform the search on the server. Look at the implementation of SearchSequence.generateSequence. In your example you would probably want to use FromStringTerm.
If you're using the gimap provider, you can also use Google's IMAP extensions, which include the X-GM-RAW search attribute, allowing you to search exactly like in the Gmail web interface. The java implementation is in GmailRawSearchTerm and only works server-side.