Function for find if a process exists

Hi Paul,

Now I made some more investigations and I had to correct myself. There is a difference between array_find() and string_find(). Array_find() gives back the line number starting with 0, string_find() gives back the position number also starting with 0. With array_find() it seems only to be possible to search for complete lines (see following screenshot):

Snmp Walk starts with line number 1!
dude10.jpg
Another screenshot of the oid_column(“1.3.6.1.2.1.25.2.3.1.3”,600) output in an editor:
dude11.jpg
Some examples:
array_find “C:\ Label:System…” gives back 0
string_find "C:" : 0
array_find “D:\ Label:System…” : 1
string_find "D:" : 42
array_find “E:\ Label:System…” : 2
string_find "E:" : 82

…and so on.

Once again, I am not really sure what you like to do, but if you want to search in the sample OID for drive letters, from my point of view string_find() should be the correct function.

By the way, I use Dude 3.0

Bye
Heimo

Thanks, that’s very interesting, I was wondering why I was getting the weird numbers back using the string_find, it’s returning the position of the string it found, not the index.

So all I need to figure out is how I can search for just a character or 2 using an array_find, or make a string_find return the index instead of the position of the character.

Thanks for your help

Regards
Paul

Hi Paul,

The following function code gives back the index (line) number starting with 0

if(
string_find(oid_column(“1.3.6.1.2.1.25.2.3.1.3”,600),“E:”)<>4294967295,
array_find(oid_column(“1.3.6.1.2.1.25.2.3.1.3”,600),
string_substring(oid_column(“1.3.6.1.2.1.25.2.3.1.3”,600),
string_find(oid_column(“1.3.6.1.2.1.25.2.3.1.3”,600),“E:”),
(
string_find(oid_column(“1.3.6.1.2.1.25.2.3.1.3”,600),“,”,
string_find(oid_column(“1.3.6.1.2.1.25.2.3.1.3”,600),“E:”))
-string_find(oid_column(“1.3.6.1.2.1.25.2.3.1.3”,600),“E:”
)
))),
“not found”
)

As you see, I search for drive letter “E:”, if you want to search for another one replace all four “E” with f.e. “C”.

If you need the index (line) number starting with 1 (maybe for some OID endnumbers) simply add +1, as in the follwing code.

if(
string_find(oid_column(“1.3.6.1.2.1.25.2.3.1.3”,600),“E:”)<>4294967295,
array_find(oid_column(“1.3.6.1.2.1.25.2.3.1.3”,600),
string_substring(oid_column(“1.3.6.1.2.1.25.2.3.1.3”,600),
string_find(oid_column(“1.3.6.1.2.1.25.2.3.1.3”,600),“E:”),
(
string_find(oid_column(“1.3.6.1.2.1.25.2.3.1.3”,600),“,”,
string_find(oid_column(“1.3.6.1.2.1.25.2.3.1.3”,600),“E:”))
-string_find(oid_column(“1.3.6.1.2.1.25.2.3.1.3”,600),“E:”
)
)))+1,
“not found”
)

I am not a programmer, so sorry if there exist a simplier way to get what you want :wink:

Bye
Heimo