I have two devices
1. Device 1
2. Device 2
for now I have two separate probe files for both the devices since both follows different format in Intermapper status window. I want to combine them into a single probe file.
Solutions Tried:
Tried giving the following condition under snmp-device-display tag
${EVAL: $DT == "Device 1"? "format for device 1" : $DT == "Device 2"? "format for device 2" : ""}
The problem was, I was not able to give this particular stmt inside the string
${chartable: ##.## : $value1}
The output of the EVAL conditions must be a string, since my format was too big (more than 255 char), it throwed me an exception. Rectified it by splitting the string and concatenating it.
Here is some sample code similar to the solution I have tried:
<snmp-device-variables>
DT_, 1.3.6.1.4.1.44555.1.1.10.0, DEFAULT, "dt"
DT1VAL1_ 1.3.6.1.4.1.44555.1.1.10.1 DEFAULT, "d1v1"
DT1VAL2_ 1.3.6.1.4.1.44555.1.1.10.2 DEFAULT, "d1v2"
DT1VAL3_ 1.3.6.1.4.1.44555.1.1.10.3 DEFAULT, "d1v3"
DT1VAL4_ 1.3.6.1.4.1.44555.1.1.10.4 DEFAULT, "d1v4"
DT2VAL1_ 1.3.6.1.4.1.44555.1.1.11.1 DEFAULT, "d1v1"
DT2VAL2_ 1.3.6.1.4.1.44555.1.1.11.2 DEFAULT, "d1v2"
DT2VAL3_ 1.3.6.1.4.1.44555.1.1.11.3 DEFAULT, "d1v3"
</snmp-device-variables>
<snmp-device-display>
\0\ ${EVAL: $DT_=="device1" ? " \4\ DT1VAL1_:\0\ ${chartable: ##.## : $DT1VAL1_} \3G\Val1\M0\
\4\ DT1VAL2_:\0\ ${chartable: ##.## : $DT1VAL2_} \3G\Val2\M0\
\4\ DT1VAL3_:\0\ ${chartable: ##.## : $DT1VAL3_} \3G\Val3\M0\
\4\ DT1VAL4_:\0\ ${chartable: ##.## : $DT1VAL4_} \3G\Val4\M0\"
: $DT_ == "device2" ? " \4\ DT2VAL1_:\0\ ${chartable: ##.## : $DT2VAL1_} \3G\Val2\M0\
\4\ DT2VALUE2_:\0\ ${chartable: ##.## : $DT2VAL2_} \3G\Val2\M0\
\4\ DT2VALUE3_:\0\ ${chartable: ##.## : $DT2VAL3_} \3G\Val3\M0\":""}
</snmp-device-display>
Kindly give me any other solution we can follow to combine probes.
Related
C:\HaxeToolkit\haxe\std/eval/_std/haxe/Exception.hx:39: characters 4-53 : Array<haxe.StackItem> should be haxe.CallStack
C:\HaxeToolkit\haxe\std/eval/_std/haxe/Exception.hx:42: characters 4-48 : Array<haxe.StackItem> should be haxe.CallStack
C:\HaxeToolkit\haxe\std/eval/_std/haxe/Exception.hx:57: characters 27-44 : Class<haxe.CallStack> has no field exceptionToString
C:\HaxeToolkit\haxe\std/eval/_std/haxe/Exception.hx:82: characters 20-27 : haxe.CallStack has no field asArray
C:\HaxeToolkit\haxe\std/eval/_std/haxe/Exception.hx:4: lines 4-89 : Field stack has different type than in core type
C:\HaxeToolkit\haxe\std/eval/_std/haxe/Exception.hx:4: lines 4-89 : haxe.CallStack should be haxe.CallStack
export/release/windows/haxe/ApplicationMain.hx:298: characters 1-8 : Build failure
It creates the export folder but it's missing the exe.
How do I fix this?
When SNMP walking or using a 'Single OID Viewer' probe I can retrieve any of the OIDs information. However, when trying to use the custom probe from the interactive snmp probe creator all of the OIDs return '[N/A]'
Any help would be greatly appreciated.
I am adding more info below for context
1. snippet code for a custom probe
2. what I am expecting
3. What my code returns
Below is an example code for the OID variables I require
-- The purpose of the code is to record status data from a device and displays the device status for user.
<snmp-device-variables>
TLPPOIName_, spvLDasName.${Slot},DEFAULT, "TLPPOIName"
PoiDescription_, spvLDasCommercialDescription.${Slot},DEFAULT, "PoiDescription"
PoiAttDl1_, spvLDasAttDigDl.${Slot}.1,DEFAULT, "Poi Attenuation Dl path 1"
PoiAttDl2_, spvLDasAttDigDl.${Slot}.2,DEFAULT, "Poi Attenuation Dl path 2"
PeakPwr1_, spvLDasPeakPwrDl.${slot}.1, DEFAULT, "PeakPwr path 1"
PeakPwr2_, spvLDasPeakPwrDl.${slot}.2, DEFAULT, "PeakPwr path 2"
PwrAlarm_, spvLDasPwrAlarmHysteresis.${Slot},DEFAULT, "PwrAlarm"
</snmp-device-variables>`
<datasets>
$PoiAttDl1_, "PoiAttDl1", "dB", "true", "Poi Attenuation Dl path 1"
$PoiAttDl2_, "PoiAttDl2", "dB", "true", "Poi Attenuation Dl path 2"
$PeakPwr1_, "PeakPwr1", "dBm", "true", "PeakPwr path 1"
$PeakPwr2_, "PeakPwr2", "dBm", "true", "PeakPwr path 2"
$PwrAlarm_, "PwrAlarm", "dBm", "true", "PwrAlarm"
</datasets>`
<snmp-device-display>
\B5\TLPPOI\P0\
\4\ TLPPOIName:\0\ $TLPPOIName_\M0\
\4\ PoiDescription:\0\$PoiDescription_ \M0\
\4\ Poi Attenuation Dl path 1:\0\$PoiAttDl1_ \M0\
\4\ Poi Attenuation Dl path 2:\0\$PoiAttDl2_ \M0\
\4\ PeakPwr path 1:\0\$PeakPwr1_ \M0\
\4\ PeakPwr path 2:\0\$PeakPwr2_ \M0\
\4\ PwrAlarm:\0\$PwrAlarm_\M0\
</snmp-device-display>
SNMP walk results: Below are example of values I expect to see
VZW 800
20
2
Display window after I use the custom probe I wrote
TLPPOIName: [N/A]
I'm trying to run in TestRig the following grammar:
grammar COBOLfragment;
// hidden tokens
WS : [ ]+ -> channel(HIDDEN);
NL : '\n' -> channel(HIDDEN);
// keywords
PERIOD : '.';
DIVISION : 'DIVISION';
SECTION : 'SECTION';
DATA : 'DATA';
WORKING_STORAGE : 'WORKING-STORAGE';
FILE : 'FILE';
FD : 'FD';
EXTERNAL : 'EXTERNAL';
GLOBAL : 'GLOBAL';
BLOCK : 'BLOCK';
CONTAINS : 'CONTAINS';
CHARACTERS : 'CHARACTERS';
// data
INTEGER : [0-9]+;
ID : [A-Z][A-Z0-9]*;
dataDivision :
DATA DIVISION PERIOD
fileSection?
workingStorageSection?
;
fileSection :
FILE SECTION PERIOD
fileDescription*
;
fileDescription :
FD fileName=ID
// (IS? GLOBAL)? // 1. IS GLOBAL clause
// (IS? EXTERNAL)? // 2. IS EXTERNAL clause
blockClause?
PERIOD
;
blockClause :
BLOCK CONTAINS? blockSize=INTEGER CHARACTERS
;
workingStorageSection :
WORKING_STORAGE SECTION PERIOD
;
with the following input:
DATA DIVISION.
FILE SECTION.
FD FD01
WORKING-STORAGE SECTION.
Clearly the third line of input ("FD FD01") is missing the terminator PERIOD asked for in fileDescription rule.
The DefaultErrorStrategy correctly acknowledges this and conjures up the missing token:
On stderr the correct report is displayed: line 4:0 missing '.' at 'WORKING-STORAGE'.
But if the fragments commented out are enabled (that is, the clauses 'IS EXTERNAL' and 'IS GLOBAL' are brought in the grammar again), then single token insertion fails:
On stderr the misleading report is displayed: line 4:0 no viable alternative at input 'WORKING-STORAGE'
How to enable the full grammar (with IS EXTERNAL and IS GLOBAL clauses) retaining the ability to correct the missing PERIOD?
Side note 1: if I enable either IS EXTERNAL or IS GLOBAL, but not both clauses, then the DefaultErrorStrategy works nicely and injects the missing token.
Side note 2: the code generated for a grammar with both clauses enabled has the following extra code (compared to a grammar with just one of them enabled):
public final FileDescriptionContext fileDescription() ... {
...
try {
...
switch ( getInterpreter().adaptivePredict(_input,4,_ctx) ) {
case 1:
{
setState(31);
_la = _input.LA(1);
if (_la==IS) {
{
setState(30); match(IS);
}
}
setState(33); match(GLOBAL);
}
break;
}
...
}
catch (RecognitionException re) {
...
And the adaptivePredict() call is the culprit, because it throws no viable alternative at input 'WORKING-STORAGE' before the parser has a chance to match(PERIOD) (in the generated code, not pasted here).
I've managed to solve it adding a new clause for both IS clauses:
(here just the fragments changed)
...
fileDescription :
FD fileName=ID
isClauses?
blockClause?
PERIOD
;
isClauses :
IS? GLOBAL (IS? EXTERNAL)?
| IS? EXTERNAL
;
...
Now the DefaultErrorStrategy does its work and injects the missing PERIOD.
Why not isClauses : (IS? GLOBAL?) (IS? EXTERNAL)?;
Well, I tried that first, of course. But got a warning (warning(154): rule 'fileDescription' contains an optional block with at least one alternative that can match an empty string) and no missing PERIOD injected.
Somehow my corporate email address has found its way onto a spam/phish list. I suppose it's unavoidable, but I can't think of any time that I've sent an email to an external address and I'm very curious to know how it could have 'escaped'.
I would like to create a SELECT formula to find any mails where one or more recipients are external (ie. do not end with '#mycompany.com', '#mycompany.com>' or '/MYCOMPANY/COM'.
I've used '#Contains' in other queries, but #Contains and #Ends don't really do the job here. If they returned a count of the number of matches, then I could compare it to the total number of recipients. Any mails where these totals are unequal will be the ones I'm looking for. But they only return booleans.
I would do it like this (do NOT mix MYDOMINODOMAIN with /MYCOMPANY/COM):
_myDomains := #Lowercase("MYDOMINODOMAIN" : "mycompany.com" : "mycompany.net");
_mailRecipientString := #LowerCase(#ReplaceSubstring(SendTo : CopyTo : BlindCopyTo : Recipients; #Char(13) : #Char(9) : #Char(34) : #Char(39) : "," : "<" : ">" : "\"" : " " ; " "));
_mailRecipientValues := #Explode(#Implode(_mailRecipientString;" "); " "; #False);
_mailDomains := #Unique(#Trim(#Explode(#Implode(#Word(_mailRecipientValues; "#"; 2); " "); " "; #False)));
SELECT #Trim( #Replace( _mailDomains ; _myDomains ; "" ) ) != ""
What does this formula do?
Every address in SendTo, CopyTo, BlindcopyTo and (this is for paranoia as it contains the three former) Recipients ALWAYS has an #. I get the domains of this addresses using #Word.
Then I replace the "good" domains in this list with an empty string (#Lowercase to be sure). If the result is something different than the empty string -> Found one
Following is part of my grammar
TestLabelBase returns ResultExpressionRhs : 'VL:' path=STRING ;
AlphabateModifier : (abc?='ABC' | def?='DEF' | ghi?='GHI') ;
When I write following rule TestLabel it works fine:
TestLabel returns ResultExpressionRhs: TestLabelBase (modifier=AlphabateModifier)?;
but when I use following rule for TestLabel it says
An unassigned rule call is not allowed, when the 'current' was already created.
TestLabel returns ResultExpressionRhs: (modifier=AlphabateModifier)? TestLabelBase ;
Can you please explain the reason behind this?
Have a read of Parsing Expressions with Xtext, specifically about Therein the first element is an unassigned rule call.
You need to change your rule to:
TestLabel returns ResultExpressionRhs
: (modifier=AlphabateModifier)? base=TestLabelBase
;
Cheers, Steve