Всем доброго дня. Скачал https://www.netways.org/projects/plugins/repository/revisions/master/raw/plug...
но данный скрипт, читая лог файл смстулс
2013-08-20 12:47:36,6, GSM1: Checking if modem is ready
2013-08-20 12:47:36,7, GSM1: -> AT
2013-08-20 12:47:36,7, GSM1: Command is sent, waiting for the answer
2013-08-20 12:47:36,7, GSM1: <- OK
2013-08-20 12:47:36,6, GSM1: Pre-initializing modem
2013-08-20 12:47:36,7, GSM1: -> ATE0+CMEE=1;
2013-08-20 12:47:37,7, GSM1: Command is sent, waiting for the answer
2013-08-20 12:47:37,7, GSM1: <- OK
2013-08-20 12:47:37,6, GSM1: Initializing modem
2013-08-20 12:47:37,7, GSM1: -> AT+CPMS="ME","ME","ME"
2013-08-20 12:47:38,7, GSM1: Command is sent, waiting for the answer
2013-08-20 12:47:38,7, GSM1: <- +CPMS: 0,23,0,23,0,23 OK
2013-08-20 12:47:38,7, GSM1: -> AT+CNMI=1,1,0,2
2013-08-20 12:47:38,7, GSM1: Command is sent, waiting for the answer
2013-08-20 12:47:39,7, GSM1: <- OK
2013-08-20 12:47:39,7, GSM1: -> AT+CSQ
2013-08-20 12:47:39,7, GSM1: Command is sent, waiting for the answer
2013-08-20 12:47:39,7, GSM1: <- +CSQ: 10,99 OK
2013-08-20 12:47:39,6, GSM1: Signal Strength Indicator: (10,99) -93 dBm (Workable), Bit Error Rate: not known or not detectable
2013-08-20 12:47:39,6, GSM1: Checking if Modem is registered to the network
2013-08-20 12:47:39,7, GSM1: ->
2013-08-20 12:47:40,7, GSM1: Command is sent, waiting for the answer
2013-08-20 12:47:40,7, GSM1: +CREG: 2,1 OK
2013-08-20 12:47:40,6, GSM1: Modem is registered to the network
2013-08-20 12:47:40,6, GSM1: Selecting PDU mode
2013-08-20 12:47:40,7, GSM1: -> AT+CMGF=0
2013-08-20 12:47:40,7, GSM1: Command is sent, waiting for the answer
2013-08-20 12:47:40,7, GSM1: <- OK
2013-08-20 12:47:40,6, GSM1: Checking memory size
2013-08-20 12:47:41,7, GSM1: -> AT+CPMS?
2013-08-20 12:47:41,7, GSM1: Command is sent, waiting for the answer
2013-08-20 12:47:41,7, GSM1: <- +CPMS: "ME",0,23,"ME",0,23,"ME",0,23 OK
2013-08-20 12:47:41,6, GSM1: Used memory is 0 of 23
2013-08-20 12:47:41,6, GSM1: No SMS received
определил, что модем не зарегистрирован в сети. Хотя в самом скрипте явно видится шаблон
if (!/\+CREG:\s*(\d,1)/) { $unreg = TRUE };
2013-08-20 12:47:40,7, GSM1: +CREG: 2,1 OK
было бы скажем 2,4 - в переменную $unreg вписалось бы TRUE
далее:
$unreg and nagexit('CRITICAL', "Modem not registered on network");
поидее должно работать и не выдавать ошибку CRITICAL, но у меня выдает).
зато у меня работает такая конструкция
if (!/\+CREG:\s*(\d,1)/) { my $unreg = TRUE }
else { $unreg = FALSE }; #а без этой строчки не работает.
........
if (!$unreg) { nagexit('CRITICAL', "Modem not registered on network") };
вообщем мой мир перевернулся. версия перла
perl -v
This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi