<?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[Script for synology NAS]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I have one problem with scripting for maintenance of synology NAS equipment. unfortunately, Synology NAS server hasn't implement SNMP agent with sending traps for some alert. Because that I have to create events and alarm internaly from DCI parameters.<br />
For the example, for the RAID status I can read DCI paratameter from NAS device which can be number of 1- 10. Every number present special condition of current RAID status. I have written one script to anaylize DCI parameters and generate specific event for any condition (number)<br />
This is my script for DCI parameter named "raidStatus".</p>
<p dir="auto">raid_Status= GetDCIValueByName($node, "raidStatus");<br />
details = "NORMAL";<br />
switch (raid_Status)<br />
{<br />
    case 1:<br />
        evt = "SYNOLOGY_RAID_STATUS_NOTIFICATION";<br />
        details = "NORMAL";<br />
        break;<br />
    case 2:<br />
        evt = "SYNOLOGY_RAID_STATUS_NOTIFICATION";<br />
        details = "REPAIRING";<br />
        break;<br />
    case 3:<br />
        evt = "SYNOLOGY_RAID_STATUS_NOTIFICATION";<br />
        details = "MIGRATING";<br />
        break;<br />
    case 4:<br />
        evt = "SYNOLOGY_RAID_STATUS_NOTIFICATION";<br />
        details = "EXPANDING";<br />
        break;<br />
    case 5:<br />
        evt = "SYNOLOGY_RAID_STATUS_NOTIFICATION";<br />
        details = "DELETING";<br />
        break;<br />
    case 6:<br />
        evt = "SYNOLOGY_RAID_STATUS_NOTIFICATION";<br />
        details = "CREATING";<br />
        break;<br />
    case 7:<br />
        evt = "SYNOLOGY_RAID_STATUS_NOTIFICATION";<br />
        details = "SYNCING";<br />
        break;<br />
    case 8:<br />
        evt = "SYNOLOGY_RAID_STATUS_NOTIFICATION";<br />
        details = "CHECKING";<br />
        break;<br />
    case 9:<br />
        evt = "SYNOLOGY_RAID_STATUS_NOTIFICATION";<br />
        details = "ASSEMBLING";<br />
        break;<br />
    case 10:<br />
        evt = "SYNOLOGY_RAID_STATUS_NOTIFICATION";<br />
        details = "CANCELING";<br />
        break;<br />
    case 11:<br />
        evt = "SYNOLOGY_RAID_STATUS_ERROR";<br />
        details = "DEGRADE";<br />
        break;<br />
    case 12:<br />
        evt = "SYNOLOGY_RAID_STATUS_ERROR";<br />
        details = "CRASHED";<br />
        break;</p>
<p dir="auto">PostEvent($node,evt,null, details);</p>
<p dir="auto">Also, I have one event and suitable event procesing policy role with activation one NXSL script for creation new events for any RAID status case, like a "SYNOLOGY_RAID_STATUS_NOTIFICATION" with massage which I would get from my script, for example  "CHECKING".<br />
Suitable Event for this case is configured with name "SYNOLOGY_RAID_STATUS_NOTIFICATION" and message<br />
"Synology RAID status: %1"</p>
<p dir="auto">During testing process I got NetXMS system error message that one of parameters can not convert to string.<br />
I didn't found much guides for NXSL programing and I can't understand where is the problem with script posting parameters.</p>
<p dir="auto">if anybody have suggestion for resolve this problem, please help me to solve this.</p>
<p dir="auto">Thanks,<br />
best regards,<br />
Tomislav</p>
]]></description><link>https://forum.netxms.org/topic/5758/script-for-synology-nas</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 08:37:44 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/5758.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 12 Dec 2018 14:22:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Script for synology NAS on Thu, 03 Jan 2019 14:02:50 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">I have resolved this script error. I found mistake on first line "raid_Status= GetDCIValueByName($node, "raidStatus");"<br />
DCI parameter must be configured by DCI ID "raid_Status= GetDCIValueByName($node, "1.3.6.1.4.1.6574.3.1.1.3.0");<br />
Now everything is working fine.<br />
First I am put suggested code to eliminate error for null value of DCI parameter and after that I went to read again function GetDCIValueByName and found my mistake of parameters description.</p>
<p dir="auto">Also, I will try the second suggestion to put script directly in Threshold of DCI value but I have only one solution resolved.</p>
<p dir="auto">Thanks guys,</p>
<p dir="auto">Have a nice day and happy new year 2019.<br />
Tomislav</p>
]]></description><link>https://forum.netxms.org/post/25163</link><guid isPermaLink="true">https://forum.netxms.org/post/25163</guid><dc:creator><![CDATA[CrUser]]></dc:creator><pubDate>Thu, 03 Jan 2019 14:02:50 GMT</pubDate></item><item><title><![CDATA[Reply to Script for synology NAS on Thu, 03 Jan 2019 09:59:59 GMT]]></title><description><![CDATA[<p dir="auto">Thank guys for this advice, I will try both and I hope that it will be solved.</p>
]]></description><link>https://forum.netxms.org/post/25162</link><guid isPermaLink="true">https://forum.netxms.org/post/25162</guid><dc:creator><![CDATA[CrUser]]></dc:creator><pubDate>Thu, 03 Jan 2019 09:59:59 GMT</pubDate></item><item><title><![CDATA[Reply to Script for synology NAS on Wed, 19 Dec 2018 20:48:39 GMT]]></title><description><![CDATA[<p dir="auto">This is not directly related, but if I understand your requirements correctly it may be simpler to use the DCI itself to generate the events, rather than running another script over it.<br />
For example, add a transformation script to the DCI similar to this (that's taken from our matching Synology DCI):</p>
<pre><code>switch ( $1 )
{
	case "1": return "Healthy";
	case "2": return "Repairing";
	case "3": return "Migrating";
	case "4": return "Expanding";
	case "5": return "Deleting";
	case "6": return "Creating";
	case "7": return "Syncing";
	case "8": return "Parity Checking";
	case "9": return "Assembling";
	case "10": return "Cancelling";
	case "11": return "Degraded";
	case "12": return "Crashed";
	default: return "INVALID DATA (". $1 .")";
}
</code></pre>
<p dir="auto">Then use Thresholds to trigger events based on the above. The data collected is passed on to the event.<br />
You could also configure the thresholds to then automatically close any alerts (i.e. trigger a "normal/reset" style event and configure it to close matching alarms in the event processing policy) if the threshold goes back to normal.<br />
All within the DCI without the need for calling an external script to read the DCI value.</p>
]]></description><link>https://forum.netxms.org/post/25111</link><guid isPermaLink="true">https://forum.netxms.org/post/25111</guid><dc:creator><![CDATA[Tursiops]]></dc:creator><pubDate>Wed, 19 Dec 2018 20:48:39 GMT</pubDate></item><item><title><![CDATA[Reply to Script for synology NAS on Wed, 12 Dec 2018 22:01:48 GMT]]></title><description><![CDATA[<p dir="auto">My guess is that raid_Status is NULL or some other value that does not match any of the cases.</p>
<p dir="auto">To catch this, add</p>
<pre><code>    default:
      evt = "SYNOLOGY_RAID_STATUS_ERROR";
      details = "NO_STATUS";
</code></pre>
<p dir="auto">Assuming that allows the script to run, check that "raidStatus" is the Parameter and not the Description for the DCI you are getting the value from.<br />
Possibly the script is not being run on the node where the "raidStatus" DCI is located.</p>
]]></description><link>https://forum.netxms.org/post/25094</link><guid isPermaLink="true">https://forum.netxms.org/post/25094</guid><dc:creator><![CDATA[gdodd]]></dc:creator><pubDate>Wed, 12 Dec 2018 22:01:48 GMT</pubDate></item></channel></rss>