<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[[nxsnmpset]: Hex-String]]></title><description><![CDATA[<p dir="auto">Здравствуйте, подскажите как с помощью nxsnmpset установить значение с типом Hex-String, т.е.:</p>
<pre><code>snmpset -v3 -a SHA -A password -l authPriv -u writeuser -x DES -X password 10.34.222.74 .1.3.6.1.4.1.171.14.14.1.2.1.6.1 x c0a8055d
iso.3.6.1.4.1.171.14.14.1.2.1.6.1 = Hex-STRING: C0 A8 05 5D
</code></pre>
<p dir="auto">А вот с помощью nxsnmpset (и соответственно в NXSL) сделать подобное не получается:</p>
<pre><code>nxsnmpset -v 3 -a SHA1 -A password -u writeuser-e DES -E password 10.34.222.74 .1.3.6.1.4.1.171.14.14.1.2.1.6.1 c0a8055d
SET operation failed (Wrong value)

nxsnmpset -v 3 -a SHA1 -A password -u writeuser -e DES -E password 10.34.222.74 .1.3.6.1.4.1.171.14.14.1.2.1.6.1@STRING c0a8055d
SET operation failed (Wrong value)

nxsnmpset -v 3 -a SHA1 -A password -u writeuser -e DES -E password 10.34.222.74 .1.3.6.1.4.1.171.14.14.1.2.1.6.1@IPADDR c0a8055d
SET operation failed (Wrong type)

nxsnmpset -v 3 -a SHA1 -A password -u writeuser -e DES -E password 10.34.222.74 .1.3.6.1.4.1.171.14.14.1.2.1.6.1@IPADDR 192.168.5.93
SET operation failed (Wrong type)
</code></pre>
<p dir="auto">.1.3.6.1.4.1.171.14.14.1.2.1.6.1 - это OID коммутаторов Dlink определяющий IP адрес сервера, на который сливается конфиг.</p>
<p dir="auto">Используется:</p>
<pre><code>ii  netxms-agent:amd64                     4.1.377-1                                       amd64        NetXMS agent
ii  netxms-base:amd64                      4.1.377-1                                       amd64        NetXMS core libraries
ii  netxms-dbdrv-pgsql:amd64               4.1.377-1                                       amd64        PostgreSQL driver for netxms-server
ii  netxms-dbdrv-sqlite3:amd64             4.1.377-1                                       amd64        SQLite3 driver for netxms-server
ii  netxms-release                         1.10                                            all          Package to install apt source and gpg keyring
ii  netxms-server:amd64                    4.1.377-1                                       amd64        meta package
</code></pre>
]]></description><link>https://forum.netxms.org/topic/7464/nxsnmpset-hex-string</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 08:12:11 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/7464.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 12 Jul 2022 07:08:07 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [nxsnmpset]: Hex-String on Wed, 02 Nov 2022 10:15:19 GMT]]></title><description><![CDATA[<p dir="auto">Обновил nxsnmpset, теперь у него появился ключ -H для указания hex строки. Будет в следующем патч релизе 4.2.</p>
]]></description><link>https://forum.netxms.org/post/31984</link><guid isPermaLink="true">https://forum.netxms.org/post/31984</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Wed, 02 Nov 2022 10:15:19 GMT</pubDate></item><item><title><![CDATA[Reply to [nxsnmpset]: Hex-String on Tue, 26 Jul 2022 11:19:36 GMT]]></title><description><![CDATA[<p dir="auto">Thank you for your example<br />
Script / function to backup configs via tftp for Dlink Industrial (cisco-like) Switches 1510 Series</p>
<p dir="auto">Gotta Love Google Translate</p>
]]></description><link>https://forum.netxms.org/post/31690</link><guid isPermaLink="true">https://forum.netxms.org/post/31690</guid><dc:creator><![CDATA[Dawid Kellerman]]></dc:creator><pubDate>Tue, 26 Jul 2022 11:19:36 GMT</pubDate></item><item><title><![CDATA[Reply to [nxsnmpset]: Hex-String on Thu, 14 Jul 2022 13:17:12 GMT]]></title><description><![CDATA[<p dir="auto">Спасибо огромное за помощь, все получилось!</p>
<p dir="auto">Вот скрипт / функция backup-а конфигов по tftp для Dlink Industrial (cisco-like) Switches 1510 Series, но в целом, как шаблон, подойдет для других моделей, меняются только OID-ы.<br />
 </p>
<pre><code>/* 1. Create snmp transport to current node */
println ("[INFO]: Node name - " . $node-&gt;name);

transport = $node-&gt;createSNMPTransport();
if (transport == null)
{
	println ( "[ERROR]: Failed to create SNMP transport" );
	return -1;
}
/* 2. Generate backup name */
/* 2.1 Path prefix / Node name / Date and time manipulation */
snmpName = transport-&gt;get(".1.3.6.1.2.1.1.5.0")-&gt;printableValue;
pathPrefix = "ma-switches";
backupName = ( pathPrefix . "/" . snmpName . "/" . "backup_" . strftime("%d-%m-%Y_%H-%M", time()) . ".cfg");
println ( "[INFO]: " . backupName );
/* 2.2 Backup */
/*
.dlinkIndustrialCommon.dlinkSwSystemFileMIB.dsfMIBObjects.dsfCopyTable.dsfCopyEntry
 - dsfCopyType :: 2 - Upload TFTP / 3 - Upload FTP / 5 - Download TFTP
.1.3.6.1.4.1.171.14.14.1.2.1.2.1 = INTEGER: 2
 - dsfCopySrcUrl :: 'startup-config','running-config','system-log','attack-log'
.1.3.6.1.4.1.171.14.14.1.2.1.3.1 = STRING: "running-config"
 - dsfCopyDstUrl :: backupName variable
.1.3.6.1.4.1.171.14.14.1.2.1.4.1 = STRING: "backup_date_time.cfg"
 - dsfCopyRemoteAddrType :: 0 - unknown / 1 - ipv4 / 2 - ipv6 / 12 - dns
.1.3.6.1.4.1.171.14.14.1.2.1.5.1 = INTEGER: 1
 - dsfCopyRemoteAddr :: 192.168.5.93
.1.3.6.1.4.1.171.14.14.1.2.1.6.1 = Hex-STRING: C0 A8 05 5D
 - dsfCopyRowStatus
.1.3.6.1.4.1.171.14.14.1.2.1.12.1 = INTEGER: 4
*/
output = transport-&gt;set(".1.3.6.1.4.1.171.14.14.1.2.1.2.1", 2, "INTEGER");
if (!output) { println ("[ERROR]: Can't set backup method TFTP (" . $node-&gt;name . ")"); return -2 ; };

output = transport-&gt;set(".1.3.6.1.4.1.171.14.14.1.2.1.3.1", "running-config", "STRING");
if (!output) { println ("[ERROR]: Can't set backup remote source (" . $node-&gt;name . ")"); return -3 ; };

output = transport-&gt;set(".1.3.6.1.4.1.171.14.14.1.2.1.4.1", backupName, "STRING");
if (!output) { println ("[ERROR]: Can't set backup local filename (" . $node-&gt;name . ")"); return -4 ; };

output = transport-&gt;set(".1.3.6.1.4.1.171.14.14.1.2.1.5.1", 1, "INTEGER");
if (!output) { println ("[ERROR]: Can't set dest address-type to IPv4 (" . $node-&gt;name . ")"); return -5 ; };

/* https://www.netxms.org/forum/oe-oo/nxsnmpset-hex-string/ */
bs = new ByteStream();
bs-&gt;writeByte(0xC0);
bs-&gt;writeByte(0xA8);
bs-&gt;writeByte(0x05);
bs-&gt;writeByte(0x5D);

output = transport-&gt;set(".1.3.6.1.4.1.171.14.14.1.2.1.6.1", bs);
if (!output) { println ("[ERROR]: Can't set destanation IP address (" . $node-&gt;name . ")"); return -6 ; };
/* 3. Run backup */
output = transport-&gt;set(".1.3.6.1.4.1.171.14.14.1.2.1.12.1", 4, "INTEGER");
if (!output) { println ("[ERROR]: Runnig backup process failed (" . $node-&gt;name . ")"); return -12 ; };
/* 4. End */
return 0;
</code></pre>
]]></description><link>https://forum.netxms.org/post/31661</link><guid isPermaLink="true">https://forum.netxms.org/post/31661</guid><dc:creator><![CDATA[sa_drug]]></dc:creator><pubDate>Thu, 14 Jul 2022 13:17:12 GMT</pubDate></item><item><title><![CDATA[Reply to [nxsnmpset]: Hex-String on Thu, 14 Jul 2022 10:23:36 GMT]]></title><description><![CDATA[<p dir="auto">Например так:</p>
<pre><code>bs = new ByteStream();
bs-&gt;writeByte(0xC0);
bs-&gt;writeByte(0xA8);
bs-&gt;writeByte(0x05);
bs-&gt;writeByte(0x5D);

snmp = $node-&gt;createSNMPTransport();
snmp-&gt;set(".1.3.6.1.4.1.171.14.14.1.2.1.6.1", bs);
</code></pre>
]]></description><link>https://forum.netxms.org/post/31659</link><guid isPermaLink="true">https://forum.netxms.org/post/31659</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Thu, 14 Jul 2022 10:23:36 GMT</pubDate></item><item><title><![CDATA[Reply to [nxsnmpset]: Hex-String on Thu, 14 Jul 2022 08:14:20 GMT]]></title><description><![CDATA[<p dir="auto">А не могли бы привести пример, не нахожу в документации ничего про ByteStream.</p>
]]></description><link>https://forum.netxms.org/post/31655</link><guid isPermaLink="true">https://forum.netxms.org/post/31655</guid><dc:creator><![CDATA[sa_drug]]></dc:creator><pubDate>Thu, 14 Jul 2022 08:14:20 GMT</pubDate></item><item><title><![CDATA[Reply to [nxsnmpset]: Hex-String on Wed, 13 Jul 2022 16:01:40 GMT]]></title><description><![CDATA[<p dir="auto">Сейчас nxsnmpset не поддерживает задание OCTET STRING в шестнадцатеричном виде. Я добавил feature request: <a href="https://track.radensolutions.com/issue/NX-2278" rel="nofollow ugc">https://track.radensolutions.com/issue/NX-2278</a>.</p>
<p dir="auto">В текущей версии это можно делать из NXSL скрипта - при помощи ByteStream собрать нужную последовательность байтов и передать в SNMP SET.</p>
]]></description><link>https://forum.netxms.org/post/31651</link><guid isPermaLink="true">https://forum.netxms.org/post/31651</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Wed, 13 Jul 2022 16:01:40 GMT</pubDate></item></channel></rss>