snmp
-
i have this is in config->scripting library
script name : testsub main()
{
return ret = SNMPSet("2c", .1.3.6.1.2.1.25.1.6.0, 10);
if (!ret)
{
trace(1,"SNMPSet failed");
return -1;
}}
and when trying to execute it from console it says
error : script test not found .
what should i do?
and is it enough for snmp set? isn't it necessary to install net-snmp? -
Your script has syntax error, and so it not compiles. Because of that you got "script not found" message (not very meaningful in this case, I agree). Besides that, it has other errors. First of all, you have to create SNMP transport object for node you want to query, and then use it in SNMPGet function. Below is an example of script which can be run from server's debug console to get SNMP object ID from node passed as parameter:
if ($1 == null) { println "Please specify node name as parameter"; return 3; } transport = CreateSNMPTransport(FindObject($1)); // Create SNMP transport for node if (transport == null) { println "Failed to create SNMP transport, exit"; return 1; } value = SNMPGetValue(transport, ".1.3.6.1.2.1.1.1.0"); if (value == null) { println "Failed to issue SNMP GET request"; return 2; } else { println "System description: " . value; return 0; }Example of running this script on my test server attached.
Best regards,
Victor

-
thanks
but i want to set an object such as .1.3.6.1.2.1.25.1.5.0
is this wrong?if ($1 == null)
{
println "Please specify node name as parameter";
return 3;
}
println $1;
transport = CreateSNMPTransport(FindObject($1));
if (transport == null)
{
println "Failed to create SNMP transport, exit";
return 1;
}ret = SNMPSet(transport, ".1.3.6.1.2.1.25.1.5.0", 4);
if (!ret)
{
println "failed";
trace(1,"SNMPSet failed");
return -1;
} -
Hi!
Script looks correct. But are you sure that .1.3.6.1.2.1.25.1.5.0 is writeable, and that community string set in NetXMS allows read/write access?
Best regards,
Victor
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login